diff --git a/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.js b/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.js new file mode 100644 index 000000000..fb47a6147 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.js @@ -0,0 +1,295 @@ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " created the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']);" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']);" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.min.js new file mode 100644 index 000000000..abb10a02a --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.4.9/odysseus.min.js @@ -0,0 +1,2 @@ +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var s;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},s=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""}},t.prototype.buildContext=function(o,t){var e,s,a,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(s=t.context)||"process"===s,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(a=o.event)||"delete"===a||"join"===a||"leave"===a||"kick"===a||"join:request"===a||"join:request:accept"===a||"join:request:reject"===a||"invite"===a||"invite:accept"===a||"invite:reject"===a||"role:change"===a||"role:request"===a||"role:request:accept"===a||"role:request:reject"===a||"role:assign"===a||"progress"===a||"level"===a||"achievement"===a||"resolution"===a)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,s){var a,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(a=r[s]))throw"The "+s+" template for "+e+" event cannot be found";return o.template(a)},t.prototype.toString=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";return s=this.compile(o.event,"text"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,s){var a,r,d,i;if(null==e&&(e={}),null==s&&(s={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),a=this.buildContext(t,e),r=i({story:t,ext:e,ctx:a,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),s.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return s=this.compile(o.event,"image"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.js new file mode 100644 index 000000000..9fb210307 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.js @@ -0,0 +1,302 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.0 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " created the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']);" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']);" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.min.js new file mode 100644 index 000000000..2c0fa327d --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.0/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.0 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var s;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},s=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""}},t.prototype.buildContext=function(o,t){var e,s,a,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(s=t.context)||"process"===s,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(a=o.event)||"delete"===a||"join"===a||"leave"===a||"kick"===a||"join:request"===a||"join:request:accept"===a||"join:request:reject"===a||"invite"===a||"invite:accept"===a||"invite:reject"===a||"role:change"===a||"role:request"===a||"role:request:accept"===a||"role:request:reject"===a||"role:assign"===a||"progress"===a||"level"===a||"achievement"===a||"resolution"===a)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,s){var a,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(a=r[s]))throw"The "+s+" template for "+e+" event cannot be found";return o.template(a)},t.prototype.toString=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";return s=this.compile(o.event,"text"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,s){var a,r,d,i;if(null==e&&(e={}),null==s&&(s={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),a=this.buildContext(t,e),r=i({story:t,ext:e,ctx:a,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),s.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return s=this.compile(o.event,"image"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.js new file mode 100644 index 000000000..a31ffb071 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.js @@ -0,0 +1,302 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.0 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " created the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.min.js new file mode 100644 index 000000000..4f1057bf7 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.1/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.0 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var s;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},s=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed to '{{change.delta['new']}}'${ if (change.delta['old']) { }$ from '{{change.delta['old']}}'${ } }$.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed to {{change.delta['new']}}${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""}},t.prototype.buildContext=function(o,t){var e,s,a,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(s=t.context)||"process"===s,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(a=o.event)||"delete"===a||"join"===a||"leave"===a||"kick"===a||"join:request"===a||"join:request:accept"===a||"join:request:reject"===a||"invite"===a||"invite:accept"===a||"invite:reject"===a||"role:change"===a||"role:request"===a||"role:request:accept"===a||"role:request:reject"===a||"role:assign"===a||"progress"===a||"level"===a||"achievement"===a||"resolution"===a)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,s){var a,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(a=r[s]))throw"The "+s+" template for "+e+" event cannot be found";return o.template(a)},t.prototype.toString=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";return s=this.compile(o.event,"text"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,s){var a,r,d,i;if(null==e&&(e={}),null==s&&(s={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),a=this.buildContext(t,e),r=i({story:t,ext:e,ctx:a,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),s.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return s=this.compile(o.event,"image"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.js new file mode 100644 index 000000000..d31deec8a --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.js @@ -0,0 +1,302 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.1 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " created the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.min.js new file mode 100644 index 000000000..45346bb91 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.2/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.1 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var s;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},s=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""}},t.prototype.buildContext=function(o,t){var e,s,a,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(s=t.context)||"process"===s,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(a=o.event)||"delete"===a||"join"===a||"leave"===a||"kick"===a||"join:request"===a||"join:request:accept"===a||"join:request:reject"===a||"invite"===a||"invite:accept"===a||"invite:reject"===a||"role:change"===a||"role:request"===a||"role:request:accept"===a||"role:request:reject"===a||"role:assign"===a||"progress"===a||"level"===a||"achievement"===a||"resolution"===a)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,s){var a,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(a=r[s]))throw"The "+s+" template for "+e+" event cannot be found";return o.template(a)},t.prototype.toString=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";return s=this.compile(o.event,"text"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,s){var a,r,d,i;if(null==e&&(e={}),null==s&&(s={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),a=this.buildContext(t,e),r=i({story:t,ext:e,ctx:a,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),s.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return s=this.compile(o.event,"image"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.js new file mode 100644 index 000000000..9a780e1d3 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.js @@ -0,0 +1,302 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.3 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " created the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.min.js new file mode 100644 index 000000000..53a800a65 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.3/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.3 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var s;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},s=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} created the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""}},t.prototype.buildContext=function(o,t){var e,s,a,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(s=t.context)||"process"===s,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(a=o.event)||"delete"===a||"join"===a||"leave"===a||"kick"===a||"join:request"===a||"join:request:accept"===a||"join:request:reject"===a||"invite"===a||"invite:accept"===a||"invite:reject"===a||"role:change"===a||"role:request"===a||"role:request:accept"===a||"role:request:reject"===a||"role:assign"===a||"progress"===a||"level"===a||"achievement"===a||"resolution"===a)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,s){var a,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(a=r[s]))throw"The "+s+" template for "+e+" event cannot be found";return o.template(a)},t.prototype.toString=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";return s=this.compile(o.event,"text"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,s){var a,r,d,i;if(null==e&&(e={}),null==s&&(s={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),a=this.buildContext(t,e),r=i({story:t,ext:e,ctx:a,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),s.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,s;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return s=this.compile(o.event,"image"),e=this.buildContext(o,t),s({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.js new file mode 100644 index 000000000..f89438ba0 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.js @@ -0,0 +1,307 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.4 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}The '{{ od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id }}' {{ od.ctx.isTeam ? 'team' : 'process' }} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id}}${ } }$.", + html: "
The {{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}} {{od.ctx.isTeam ? 'team' : 'process'}} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id }}${ } }$.${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ _.forEach(od.story.changes, function(change) { }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ }); }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ _.forEach(od.story.changes, function(change) { }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ }); }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + }, + "action": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.action.name}}'.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.action.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ } }$
", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution' || _ref1 === 'action') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.min.js new file mode 100644 index 000000000..abf758354 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.4/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.4 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var a;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},a=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}The '{{ od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id }}' {{ od.ctx.isTeam ? 'team' : 'process' }} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id}}${ } }$.",html:"
The {{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}} {{od.ctx.isTeam ? 'team' : 'process'}} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id }}${ } }$.${ if (!!od.story.admin) { }$${ } }$
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ _.forEach(od.story.deferred.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ _.forEach(od.story.deferred.changes, function(change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ _.forEach(od.story.changes, function(change) { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ }); }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ _.forEach(od.story.changes, function(change) { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ }); }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }}); }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ _.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}); }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""},action:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.action.name}}'.${ if (od.story.changes) { }$\n Changes:${ } }$${ _.forEach(od.story.changes, function (change) {if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }}) }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.action.name}}.${ if(od.story.changes) { }$${ }_.forEach(od.story.changes, function(change) {if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old']);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }});if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ } }$
",image:""}},t.prototype.buildContext=function(o,t){var e,a,s,r,d,i,l,c,m,n,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(a=t.context)||"process"===a,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(s=o.event)||"delete"===s||"join"===s||"leave"===s||"kick"===s||"join:request"===s||"join:request:accept"===s||"join:request:reject"===s||"invite"===s||"invite:accept"===s||"invite:reject"===s||"role:change"===s||"role:request"===s||"role:request:accept"===s||"role:request:reject"===s||"role:assign"===s||"progress"===s||"level"===s||"achievement"===s||"resolution"===s||"action"===s)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(m=t.profile)?m.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(n=o.event)||"invite:reject"===n?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,a){var s,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(s=r[a]))throw"The "+a+" template for "+e+" event cannot be found";return o.template(s)},t.prototype.toString=function(o,t){var e,a;if(null==t&&(t={}),null==o)throw"The story is not available";return a=this.compile(o.event,"text"),e=this.buildContext(o,t),a({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,a){var s,r,d,i;if(null==e&&(e={}),null==a&&(a={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),s=this.buildContext(t,e),r=i({story:t,ext:e,ctx:s,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),a.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,a;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return a=this.compile(o.event,"image"),e=this.buildContext(o,t),a({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file diff --git a/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.js b/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.js new file mode 100644 index 000000000..0853233ba --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.js @@ -0,0 +1,307 @@ +/** + * playlyfe-odysseus - Parse and build stories out of Playlyfe Events. + * version: 0.5.5 + * repository: http://github.com/playlyfe/odysseus + * license: MIT + * author: Kumar Harsh (khs@playlyfe.com) +**/ +(function(global, factory) { + if (typeof define === 'function' && define.amd) { + return define(['lodash', 'moment', 'bignumber'], factory); + } else if (typeof exports === 'object') { + return module.exports = factory(require('lodash'), require('moment'), require('bignumber.js')); + } else { + return global['Odysseus'] = factory(global['_'], global['moment'], global['BigNumber']); + } +})(this, function(_, moment, BigNumber) { + var Odysseus; + _.templateSettings.interpolate = /@\{([\s\S]+?)\}@/g; + _.templateSettings.escape = /\{\{([\s\S]+?)\}\}/g; + _.templateSettings.evaluate = /\$\{([\s\S]+?)\}\$/g; + _.templateSettings.variable = 'od'; + _.templateSettings.imports = { + '_': _, + 'moment': moment, + 'ZERO': new BigNumber(0) + }; + Odysseus = (function() { + + /** + * A map of the default markup tags to be inserted into the rendered HTML + * in-case no object is supplied in the constructor + * @type {Object} + */ + Odysseus.default_markup = { + content: "od-content", + image: "od-image", + actor: "od-actor", + target: "od-target", + object: "od-object", + role_list: "od-role-list", + role: "od-role", + lane: "od-lane", + timestamp: "od-ts" + }; + + + /** + * A list of all the available templates + * @type {Object} + */ + + Odysseus.stored_templates = { + + /** + * Activity Templates + */ + "create": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}The '{{ od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id }}' {{ od.ctx.isTeam ? 'team' : 'process' }} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id}}${ } }$.", + html: "
The {{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}} {{od.ctx.isTeam ? 'team' : 'process'}} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id }}${ } }$.${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "delete": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " deleted the {{od.ctx.isTeam ? 'team' : 'process'}} " + "" + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "", + image: '' + }, + "join": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
", + image: "${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$" + }, + "leave": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " left " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "kick": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " kicked " + "" + "{{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}}" + " from " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "", + image: '' + }, + "join:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "join:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "invite:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " accepted " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "invite:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.", + html: "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + " rejected " + "" + "{{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '\u2019s'}}" + " invitation to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "." + "
" + "", + image: '' + }, + "role:request:accept": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "." + "
" + "", + image: '' + }, + "role:request:reject": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " request for a change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}" + "." + "
" + "", + image: '' + }, + "role:change": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "role:assign": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$", + html: "
" + "" + "{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}}" + " roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ have been changed" + "${ if (!od.story.admin) { }$" + " by " + "{{od.ctx.amActor ? 'you' : " + "od.story.actor.alias||od.story.actor.id}}" + "" + "${ } }$." + "." + "${ if (!!od.story.admin) { }$${ } }$" + "
" + "", + image: '' + }, + "join:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request to join " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to join " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request to join " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.ctx.amMetaActor ? 'you' : " + "od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "invite": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your invitation to " + "{{od.story.invitee.alias||od.story.invitee.id}}" + " to join " + "${ } else { }$" + "{{od.story.actor.alias||od.story.actor.id}} " + "invited you to join " + "${ } }$" + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + "" + " withdrew the invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}}" + " {{od.story.accepted_at ? 'accepted' : 'rejected'}} " + "" + "{{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'\u2019s'}}" + "" + " invitation to join " + "the {{od.ctx.isTeam ? 'team' : 'process'}}" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + " as " + "." + "
" + "" + "${ } }$", + image: '' + }, + "role:request": { + text: "${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$", + html: "${ if(od.story.state === 'PENDING') { }$" + "
" + "${ if(od.ctx.amActor) { }$" + "Your request for change of roles in " + "${ } else { }$" + "" + "{{od.story.actor.alias||od.story.actor.id}}" + " wants to change roles in " + "${ } }$" + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$" + "{{ od.ctx.amActor ? ' is pending' : '' }}." + "" + "
" + "" + "${ } else if(od.story.state === 'CANCELLED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " cancelled the request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$." + "
" + "" + "${ } else if(od.story.state === 'ACCEPTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been accepted by " + "" + "{{od.story.accepted_by.alias||od.story.accepted_by.id}}" + "." + "
" + "" + "${ } else if(od.story.state === 'REJECTED') { }$" + "
" + "" + "{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}}" + " request for change of roles in " + "{{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}" + "${ if (!od.ctx.isItem) { }$" + " " + "{{od.story.team ? od.story.team.name || od.story.team.id :" + "od.story.process.name || od.story.process.id}}" + "" + "${ } }$ has been rejected by " + "" + "{{od.story.rejected_by.alias||od.story.rejected_by.id}}" + "." + "
" + "" + "${ } }$", + image: '' + }, + "progress": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }for (i = 0,\n _ref = (od.story.changes || []),\n len = _ref.length; i < _ref.length; i++) {\n change = _ref[i];if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "resolution": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ for (i = 0, _ref = (od.story.deferred.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ for (i = 0, _ref = (od.story.deferred.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }} }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
", + image: '' + }, + "level": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.", + html: "
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '\u2019s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
", + image: '' + }, + "achievement": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n" + " Changes:" + "${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i]; }$" + "\n [>] {{change.metric.name}}" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "\n [*] {{diff}} {{item}}" + "${ }); }$" + "${ } }$", + html: "
" + "{{od.ctx.amActor ? 'Congratulations! ' : ''}}" + "{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}" + "" + " unlocked an achievement." + "" + "${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i]; }$" + "" + "" + "" + "" + "" + "" + "${ _.forEach(change.delta, function(delta, item) {" + "diff = ZERO.plus(delta['new']).minus(delta['old']||'0');" + "diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();" + "}$" + "" + "" + "" + "" + "${ }); }$" + "" + "${ } }$" + "
" + "" + "{{change.metric.name}}" + "" + "
" + "" + "{{item}}" + "" + "" + "" + "{{diff}}" + "" + "
" + "
" + "", + image: '' + }, + "score": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.\n New Scores:${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }} }$", + html: "
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '\u2019s'}} scores were changed.${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }} }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
", + image: '' + }, + "escalation": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$", + html: "
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$", + image: '' + }, + "action": { + text: "[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.action.name}}'.${ if (od.story.changes) { }$\n Changes:${ } }$${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$", + html: "
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.action.name}}.${ if(od.story.changes) { }$${ } }$${ for (i = 0,\n _ref = (od.story.changes || []),\n len = _ref.length; i < _ref.length; i++) {\n change = _ref[i];if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ } }$
", + image: '' + } + }; + + function Odysseus(options) { + options = options || {}; + this.options = _.defaults(options, { + markup: Odysseus.default_markup, + external: {} + }); + } + + Odysseus.prototype.buildContext = function(story, ext) { + var ctx, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + ctx = {}; + ctx.isDummy = ext.env === 'debug'; + ctx.isItem = (_ref = ext.context) === 'team' || _ref === 'process'; + if ((story.team != null) || ext.context === 'team') { + ctx.isTeam = true; + } else if ((story.process != null) || ext.context === 'process') { + ctx.isProcess = true; + } + if ((_ref1 = story.event) === 'create' || _ref1 === 'delete' || _ref1 === 'join' || _ref1 === 'leave' || _ref1 === 'kick' || _ref1 === 'join:request' || _ref1 === 'join:request:accept' || _ref1 === 'join:request:reject' || _ref1 === 'invite' || _ref1 === 'invite:accept' || _ref1 === 'invite:reject' || _ref1 === 'role:change' || _ref1 === 'role:request' || _ref1 === 'role:request:accept' || _ref1 === 'role:request:reject' || _ref1 === 'role:assign' || _ref1 === 'progress' || _ref1 === 'level' || _ref1 === 'achievement' || _ref1 === 'resolution' || _ref1 === 'action') { + if (!((story.actor != null) && ((_ref2 = ext.profile) != null ? _ref2.id : void 0) !== story.actor.id)) { + ctx.amActor = true; + } + } + if ((_ref3 = story.event) === 'kick' || _ref3 === 'join:request:accept' || _ref3 === 'join:request:reject' || _ref3 === 'role:request:accept' || _ref3 === 'role:request:reject' || _ref3 === 'role:assign' || _ref3 === 'score') { + if (!((story.player != null) && ((_ref4 = ext.profile) != null ? _ref4.id : void 0) !== story.player.id)) { + ctx.amPlayer = true; + } + } else if (story.event === 'resolution') { + if (!((story.deferred.actor != null) && ((_ref5 = ext.profile) != null ? _ref5.id : void 0) !== story.deferred.actor.id)) { + ctx.amPlayer = true; + } + } else if ((_ref6 = story.event) === 'invite:accept' || _ref6 === 'invite:reject') { + if (!((story.inviter != null) && ((_ref7 = ext.profile) != null ? _ref7.id : void 0) !== story.inviter.id)) { + ctx.amInviter = true; + } + } else if (story.event === 'invite') { + if (!((story.invitee != null) && ((_ref8 = ext.profile) != null ? _ref8.id : void 0) !== story.invitee.id)) { + ctx.amInvitee = true; + } + } else if (story.event === 'join:request') { + if (story.state === 'ACCEPTED' && ((_ref9 = ext.profile) != null ? _ref9.id : void 0) === story.accepted_by.id || story.state === 'REJECTED' && ((_ref10 = ext.profile) != null ? _ref10.id : void 0) === story.rejected_by.id) { + ctx.amMetaActor = true; + } + } else if (story.event === 'escalation') { + if ((story.completed != null) && ((_ref11 = ext.profile) != null ? _ref11.id : void 0) === story.completed.player.id) { + ctx.amPlayer = true; + } + } + return ctx; + }; + + Odysseus.prototype.compile = function(evt, type) { + var tpl, tpl_collection; + if ((tpl_collection = Odysseus.stored_templates[evt]) == null) { + throw "The " + evt + " event is not supported"; + } + if ((tpl = tpl_collection[type]) == null) { + throw "The " + type + " template for " + evt + " event cannot be found"; + } + return _.template(tpl); + }; + + Odysseus.prototype.toString = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'text'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context + }); + }; + + Odysseus.prototype.toHTML = function(story, external_data, config) { + var context, html, image, template; + if (external_data == null) { + external_data = {}; + } + if (config == null) { + config = {}; + } + if (story == null) { + throw 'The story is not available'; + } + template = this.compile(story.event, 'html'); + context = this.buildContext(story, external_data); + html = template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + if (story.event === 'escalation') { + html = _.unescape(html); + } + if (config.image === true) { + image = "
" + (this.getImage(story, external_data)) + "
"; + html = image + html; + } + return html; + }; + + Odysseus.prototype.getImage = function(story, external_data) { + var context, template; + if (external_data == null) { + external_data = {}; + } + if (story == null) { + throw 'The story is not available'; + } + if (external_data.base_url == null) { + throw 'The base source url is not specified'; + } + template = this.compile(story.event, 'image'); + context = this.buildContext(story, external_data); + return template({ + story: story, + ext: external_data, + ctx: context, + markup: this.options.markup + }); + }; + + return Odysseus; + + })(); + return Odysseus; +}); diff --git a/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.min.js b/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.min.js new file mode 100644 index 000000000..aff5b4ef9 --- /dev/null +++ b/ajax/libs/playlyfe-odysseus/0.5.5/odysseus.min.js @@ -0,0 +1,3 @@ +// playlyfe-odysseus v0.5.5 +!function(o,t){return"function"==typeof define&&define.amd?define(["lodash","moment","bignumber"],t):"object"==typeof exports?module.exports=t(require("lodash"),require("moment"),require("bignumber.js")):o.Odysseus=t(o._,o.moment,o.BigNumber)}(this,function(o,t,e){var a;return o.templateSettings.interpolate=/@\{([\s\S]+?)\}@/g,o.templateSettings.escape=/\{\{([\s\S]+?)\}\}/g,o.templateSettings.evaluate=/\$\{([\s\S]+?)\}\$/g,o.templateSettings.variable="od",o.templateSettings.imports={_:o,moment:t,ZERO:new e(0)},a=function(){function t(e){e=e||{},this.options=o.defaults(e,{markup:t.default_markup,external:{}})}return t.default_markup={content:"od-content",image:"od-image",actor:"od-actor",target:"od-target",object:"od-object",role_list:"od-role-list",role:"od-role",lane:"od-lane",timestamp:"od-ts"},t.stored_templates={create:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}The '{{ od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id }}' {{ od.ctx.isTeam ? 'team' : 'process' }} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id}}${ } }$.",html:"
The {{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}} {{od.ctx.isTeam ? 'team' : 'process'}} was created${ if (!od.story.admin) { }$ by {{ od.ctx.amActor ? 'you' : od.story.actor.alias || od.story.actor.id }}${ } }$.${ if (!!od.story.admin) { }$${ } }$
",image:""},"delete":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} deleted the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
",image:""},join:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} joined {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .${ if (!!od.story.admin) { }$${ } }$
",image:"${ if (od.ctx.isDummy) { }$${ } else { }$${ } }$"},leave:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} left {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},kick:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} kicked {{od.ctx.amPlayer ? 'you' : od.story.player.alias||od.story.player.id}} from {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
",image:""},"join:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"join:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"invite:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} accepted {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"invite:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} rejected {{od.ctx.amInviter ? 'your' : (od.story.inviter.alias||od.story.inviter.id) + '’s'}} invitation to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as .
",image:""},"role:request:accept":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}..
",image:""},"role:request:reject":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} request for a change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}.
",image:""},"role:change":{text:"[{{moment(od.story.timestamp).format('llll')}}] - ${ if (od.story.admin) { }$[Admin Event] {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }${{ !!od.story.admin ? ' have been changed' : ''}}.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
${ if (od.story.admin) { }${{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id)+'’s'}}${ } else { }${{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} {{od.ctx.amActor ? 'have' : 'has'}} changed${ } }$ roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ !!od.story.admin ? ' have been changed' : ''}}..${ if (!!od.story.admin) { }$${ } }$
",image:""},"role:assign":{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$.\n Changes:${ if (od.ctx.isTeam) {_.forEach(od.story.changes, function(diff, role) { }$\n [{{ !diff.old ? '+' : '-'}}] {{role}}${ }); }$${ } else if (od.ctx.isProcess) {_.forEach(od.story.changes, function(diff, lane) {if(!!diff['old'] && !!diff['new']) { }$\n [+] {{diff['new']}} in {{lane}} lane\n [-] {{diff['old']}} in {{lane}} lane${ } else { }$\n [{{ !diff.old ? '+' : '-'}}] {{diff['new'] || diff['old']}} in {{lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane')}}${ }});} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ have been changed${ if (!od.story.admin) { }$ by {{od.ctx.amActor ? 'you' : od.story.actor.alias||od.story.actor.id}}${ } }$..${ if (!!od.story.admin) { }$${ } }$
",image:""},"join:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to join ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.ctx.amMetaActor ? 'you' : od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request to join {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.ctx.amMetaActor ? 'you' : od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},invite:{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'.${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$[{{moment(od.story.accepted_at||od.story.rejected_at).format('llll')}}] - {{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}' as ${ if (od.ctx.isTeam) { }${{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) { }${{_.reduce(od.story.roles, function(list, role, lane) {list.push([role + ' in ' + (lane === '*' ? 'All lanes' : lane === '~' ? 'No lanes' : (lane + ' lane'))]);return list;}, []).join(', ')}}${ } }$.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your invitation to {{od.story.invitee.alias||od.story.invitee.id}} to join ${ } else { }${{od.story.actor.alias||od.story.actor.id}} invited you to join ${ } }$the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as {{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.story.actor.alias||od.story.actor.id}} withdrew the invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}.
${ } else if(od.story.state === 'ACCEPTED' || od.story.state === 'REJECTED') { }$
{{od.ctx.amInvitee ? 'You' : od.story.invitee.alias||od.story.invitee.id}} {{od.story.accepted_at ? 'accepted' : 'rejected'}} {{od.ctx.amActor ? 'your' : (od.story.actor.alias||od.story.actor.id)+'’s'}} invitation to join the {{od.ctx.isTeam ? 'team' : 'process'}} {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}} as .
${ } }$",image:""},"role:request":{text:"${ if(od.story.state === 'PENDING') { }$[{{moment(od.story.timestamp).format('llll')}}] - ${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id : od.story.process.name || od.story.process.id}}'${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.\n New Roles:${ if (od.ctx.isTeam) { }$\n [*] {{_.keys(od.story.roles).join(', ')}}${ } else if (od.ctx.isProcess) {_.forEach(od.story.roles, function(role, lane) { }$\n [*] {{role}} in {{lane === '*' ? 'All' : lane === '~' ? 'No' : lane}} {{lane === '*' || lane === '~' ? 'lanes' : 'lane'}}${ });} }$${ } else if(od.story.state === 'CANCELLED') { }$[{{moment(od.story.cancelled_at).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$.${ } else if(od.story.state === 'ACCEPTED') { }$[{{moment(od.story.accepted_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.${ } else if(od.story.state === 'REJECTED') { }$[{{moment(od.story.rejected_at).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ '{{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}'${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.${ } }$",html:"${ if(od.story.state === 'PENDING') { }$
${ if(od.ctx.amActor) { }$Your request for change of roles in ${ } else { }${{od.story.actor.alias||od.story.actor.id}} wants to change roles in ${ } }${{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }${{ od.ctx.amActor ? ' is pending' : '' }}.
${ } else if(od.story.state === 'CANCELLED') { }$
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} cancelled the request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$.
${ } else if(od.story.state === 'ACCEPTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been accepted by {{od.story.accepted_by.alias||od.story.accepted_by.id}}.
${ } else if(od.story.state === 'REJECTED') { }$
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} request for change of roles in {{od.ctx.isItem ? 'this' : 'the'}} {{od.ctx.isTeam ? 'team' : 'process'}}${ if (!od.ctx.isItem) { }$ {{od.story.team ? od.story.team.name || od.story.team.id :od.story.process.name || od.story.process.id}}${ } }$ has been rejected by {{od.story.rejected_by.alias||od.story.rejected_by.id}}.
${ } }$",image:""},progress:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$.${ if (od.story.changes) { }$\n Changes:${ } }$${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}}.${ if(od.story.changes) { }$${ }for (i = 0,\n _ref = (od.story.changes || []),\n len = _ref.length; i < _ref.length; i++) {\n change = _ref[i];if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ }if(!od.ctx.isItem) { }$${ } }$
",image:""},resolution:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.activity.name}}' in {{od.ctx.isItem ? 'this' : 'the'}} process${ if(!od.ctx.isItem) { }$ '{{od.story.process.name || od.story.process.id}}'${ } }$ and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing '{{od.story.deferred.activity.name}}'.\n Changes:${ for (i = 0, _ref = (od.story.deferred.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString()}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.activity.name}} and credited {{od.ctx.amPlayer ? (od.ctx.amActor ? 'yourself' : 'you') : od.story.deferred.actor.alias||od.story.deferred.actor.id}} for completing {{od.story.deferred.activity.name}}.${ for (i = 0, _ref = (od.story.deferred.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }} }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old']}}
${ if(!od.ctx.isItem) { }$${ } }$
",image:""},level:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }$'{{change.metric.name}}' level changed ${ if (change.delta['old']) { }$from '{{change.delta['old']}}' ${ } }$to '{{change.delta['new']}}'.",html:"
{{od.ctx.amActor ? 'Your' : (od.story.actor.alias||od.story.actor.id) + '’s'}} ${ change = od.story.changes[0]; }${{change.metric.name}} level changed${ if (change.delta['old']) { }$ from {{change.delta['old']}}${ } }$ to {{change.delta['new']}}.
",image:""},achievement:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'Congratulations! You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.\n Changes:${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i]; }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } }$",html:"
{{od.ctx.amActor ? 'Congratulations! ' : ''}}{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} unlocked an achievement.${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i]; }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } }$
{{change.metric.name}}
{{item}}{{diff}}
",image:""},score:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{ od.story.admin ? '[Admin Event] ' : '' }}{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.\n New Scores:${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') { }$\n [*] {{change.delta['new']}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) { }$\n [*] {{delta['new']}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [*] {{change.metric.name}} - {{change.delta['new']}}${ }} }$",html:"
{{od.ctx.amPlayer ? 'Your' : (od.story.player.alias||od.story.player.id) + '’s'}} scores were changed.${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if (change.metric.type === 'point') { }$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) { }$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }} }$
{{change.metric.name}}{{change.delta['new']}}
{{change.metric.name}}
{{item}}{{delta['new']}}
{{change.metric.name}}{{change.delta['new']}}
${ if (!!od.story.admin) { }$${ } }$
",image:""},escalation:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.story.message}}${ if (!!od.story.completed) { var completed = od.story.completed; }$ [*] {{od.ctx.amPlayer ? 'You' : completed.player.alias||completed.player.id}} completed {{completed.trigger.name||completed.trigger.id}}\n [{{moment(od.story.timestamp).format('llll')}}]${ } }$",html:"
{{od.story.message}}
${ if (!!od.story.completed) { var completed = od.story.completed; }$${ } }$",image:""},action:{text:"[{{moment(od.story.timestamp).format('llll')}}] - {{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed '{{od.story.action.name}}'.${ if (od.story.changes) { }$\n Changes:${ } }$${ for (i = 0, _ref = (od.story.changes || []), len = _ref.length; i < _ref.length; i++) { change = _ref[i];if(change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString(); }$\n [*] {{diff}} {{change.metric.name}}${ } else if(change.metric.type === 'set') { }$\n [>] {{change.metric.name}}${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$\n [*] {{diff}} {{item}}${ }); }$${ } else if(change.metric.type === 'state') { }$\n [>] {{change.metric.name}}\n [+] {{change.delta['new']}}\n [-] {{change.delta['old']}}${ }} }$",html:"
{{od.ctx.amActor ? 'You' : od.story.actor.alias||od.story.actor.id}} completed {{od.story.action.name}}.${ if(od.story.changes) { }$${ } }$${ for (i = 0,\n _ref = (od.story.changes || []),\n len = _ref.length; i < _ref.length; i++) {\n change = _ref[i];if (change.metric.type === 'point') {diff = ZERO.plus(change.delta['new']).minus(change.delta['old'] || 0);diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ } else if(change.metric.type === 'set') { }$${ _.forEach(change.delta, function(delta, item) {diff = ZERO.plus(delta['new']).minus(delta['old']||'0');diff = (diff.gt(ZERO) ? '+' : '') + diff.toString();}$${ }); }$${ } else if(change.metric.type === 'state') { }$${ }}if(od.story.changes) { }$
{{change.metric.name}}{{diff}}
{{change.metric.name}}
{{item}}{{diff}}
{{change.metric.name}}
{{change.delta['new']}}{{change.delta['old'] || '--'}}
${ } }$
",image:""}},t.prototype.buildContext=function(o,t){var e,a,s,r,d,i,l,c,n,m,p,y,f; +return e={},e.isDummy="debug"===t.env,e.isItem="team"===(a=t.context)||"process"===a,null!=o.team||"team"===t.context?e.isTeam=!0:(null!=o.process||"process"===t.context)&&(e.isProcess=!0),("create"===(s=o.event)||"delete"===s||"join"===s||"leave"===s||"kick"===s||"join:request"===s||"join:request:accept"===s||"join:request:reject"===s||"invite"===s||"invite:accept"===s||"invite:reject"===s||"role:change"===s||"role:request"===s||"role:request:accept"===s||"role:request:reject"===s||"role:assign"===s||"progress"===s||"level"===s||"achievement"===s||"resolution"===s||"action"===s)&&(null==o.actor||(null!=(i=t.profile)?i.id:void 0)===o.actor.id)&&(e.amActor=!0),"kick"===(l=o.event)||"join:request:accept"===l||"join:request:reject"===l||"role:request:accept"===l||"role:request:reject"===l||"role:assign"===l||"score"===l?(null==o.player||(null!=(c=t.profile)?c.id:void 0)===o.player.id)&&(e.amPlayer=!0):"resolution"===o.event?(null==o.deferred.actor||(null!=(n=t.profile)?n.id:void 0)===o.deferred.actor.id)&&(e.amPlayer=!0):"invite:accept"===(m=o.event)||"invite:reject"===m?(null==o.inviter||(null!=(p=t.profile)?p.id:void 0)===o.inviter.id)&&(e.amInviter=!0):"invite"===o.event?(null==o.invitee||(null!=(y=t.profile)?y.id:void 0)===o.invitee.id)&&(e.amInvitee=!0):"join:request"===o.event?("ACCEPTED"===o.state&&(null!=(f=t.profile)?f.id:void 0)===o.accepted_by.id||"REJECTED"===o.state&&(null!=(r=t.profile)?r.id:void 0)===o.rejected_by.id)&&(e.amMetaActor=!0):"escalation"===o.event&&null!=o.completed&&(null!=(d=t.profile)?d.id:void 0)===o.completed.player.id&&(e.amPlayer=!0),e},t.prototype.compile=function(e,a){var s,r;if(null==(r=t.stored_templates[e]))throw"The "+e+" event is not supported";if(null==(s=r[a]))throw"The "+a+" template for "+e+" event cannot be found";return o.template(s)},t.prototype.toString=function(o,t){var e,a;if(null==t&&(t={}),null==o)throw"The story is not available";return a=this.compile(o.event,"text"),e=this.buildContext(o,t),a({story:o,ext:t,ctx:e})},t.prototype.toHTML=function(t,e,a){var s,r,d,i;if(null==e&&(e={}),null==a&&(a={}),null==t)throw"The story is not available";return i=this.compile(t.event,"html"),s=this.buildContext(t,e),r=i({story:t,ext:e,ctx:s,markup:this.options.markup}),"escalation"===t.event&&(r=o.unescape(r)),a.image===!0&&(d="
"+this.getImage(t,e)+"
",r=d+r),r},t.prototype.getImage=function(o,t){var e,a;if(null==t&&(t={}),null==o)throw"The story is not available";if(null==t.base_url)throw"The base source url is not specified";return a=this.compile(o.event,"image"),e=this.buildContext(o,t),a({story:o,ext:t,ctx:e,markup:this.options.markup})},t}()}); \ No newline at end of file