UNPKG

@tripetto/block-email

Version:

Email block for Tripetto.

2 lines 9.59 kB
/*! Tripetto Email Block 6.0.3 - Copyright (C) 2023 Tripetto B.V. - All Rights Reserved */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Tripetto")):"function"==typeof define&&define.amd?define("TripettoBlockEmailBuilder",["Tripetto"],t):"object"==typeof exports?exports.TripettoBlockEmailBuilder=t(require("Tripetto")):e.TripettoBlockEmailBuilder=t(e.Tripetto)}(self,(function(e){return function(){"use strict";var t={583:function(e,t,o){var i,n=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),a=this&&this.__decorate||function(e,t,o,i){var n,a=arguments.length,l=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(l=(a<3?n(l):a>3?n(t,o,l):n(t,o))||l);return a>3&&l&&Object.defineProperty(t,o,l),l};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailCondition=void 0;var l=o(210),r=o(617),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allowMarkdown=!0,t.mode="address",t}return n(t,e),Object.defineProperty(t.prototype,"label",{get:function(){return""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){var e,t,o=this;if(this.slot instanceof l.Slots.String){var i=((0,l.isVariable)(this.match)?(null===(e=(0,l.lookupVariable)(this,this.match))||void 0===e?void 0:e.label)&&"@".concat(this.match):this.match&&((t=(0,l.makeMarkdownSafe)(this.match))&&("domain"===o.mode||"not-domain"===o.mode)&&"_@".concat(t,"_")||t))||"\\_\\_";switch(this.mode){case"domain":return"@".concat(this.slot.id," ").concat((0,l.pgettext)("block:email","from domain")," ").concat(i);case"not-domain":return"@".concat(this.slot.id," ").concat((0,l.pgettext)("block:email","not from domain")," ").concat(i);case"address":return"@".concat(this.slot.id," = ").concat(i);case"not-address":return"@".concat(this.slot.id," ≠ ").concat(i);case"defined":return"@".concat(this.slot.id," ").concat((0,l.pgettext)("block:email","not empty"));case"undefined":return"@".concat(this.slot.id," ").concat((0,l.pgettext)("block:email","empty"))}}return this.type.label},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){var e;return null===(e=this.node)||void 0===e?void 0:e.label},enumerable:!1,configurable:!0}),t.prototype.defineEditor=function(){var e,t=this;this.editor.form({title:(0,l.pgettext)("block:email","Compare mode"),controls:[new l.Forms.Radiobutton([{label:(0,l.pgettext)("block:email","Email address matches"),value:"address"},{label:(0,l.pgettext)("block:email","Email address does not match"),value:"not-address"},{label:(0,l.pgettext)("block:email","Email address matches domain"),value:"domain"},{label:(0,l.pgettext)("block:email","Email address does not match domain"),value:"not-domain"},{label:(0,l.pgettext)("block:email","Email address is not empty"),value:"defined"},{label:(0,l.pgettext)("block:email","Email address is empty"),value:"undefined"}],l.Forms.Radiobutton.bind(this,"mode","address")).on((function(e){switch(r.visible("defined"!==e.value&&"undefined"!==e.value),e.value){case"address":r.title=(0,l.pgettext)("block:email","If email address matches");break;case"not-address":r.title=(0,l.pgettext)("block:email","If email address does not match");break;case"domain":r.title=(0,l.pgettext)("block:email","If email address matches domain");break;case"not-domain":r.title=(0,l.pgettext)("block:email","If email address does not match domain")}n.isInteractable&&n.focus()}))]});var o=this.match&&(0,l.isVariable)(this.match)||!1,i=(0,l.populateVariables)(this,(function(e){return e instanceof l.Slots.String||e instanceof l.Slots.Text}),o?this.match:void 0,!1,null===(e=this.slot)||void 0===e?void 0:e.id),n=new l.Forms.Text("singleline",o?"":this.match).label((0,l.pgettext)("block:email","Use fixed text")).action("@",(0,l.insertVariable)(this,"exclude")).autoFocus().enter(this.editor.close).escape(this.editor.close).on((function(e){e.isFormVisible&&e.isObservable&&(t.match=e.value)})),a=new l.Forms.Dropdown(i,o?this.match:"").label((0,l.pgettext)("block:email","Use value of")).width("full").on((function(e){e.isFormVisible&&e.isObservable&&(t.match=e.value||void 0)})),r=this.editor.form({title:(0,l.pgettext)("block:email","If email address matches"),controls:[new l.Forms.Radiobutton([{label:(0,l.pgettext)("block:email","Text"),value:"text"},{label:(0,l.pgettext)("block:email","Value"),value:"variable",disabled:0===i.length}],o?"variable":"text").on((function(e){n.visible("text"===e.value),a.visible("variable"===e.value),n.isInteractable&&n.focus()})),n,a]}).visible("defined"!==this.mode&&"undefined"!==this.mode)},a([l.definition,(0,l.affects)("#name")],t.prototype,"mode",void 0),a([l.definition,(0,l.affects)("#name")],t.prototype,"match",void 0),a([l.editor],t.prototype,"defineEditor",null),t=a([(0,l.tripetto)({type:"condition",legacyBlock:!0,context:"@tripetto/block-email",identifier:"@tripetto/block-email",version:"6.0.3",icon:r.default,get label(){return(0,l.pgettext)("block:email","Match email address")}})],t)}(l.ConditionBlock);t.EmailCondition=s},110:function(e,t,o){var i,n=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),a=this&&this.__decorate||function(e,t,o,i){var n,a=arguments.length,l=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(l=(a<3?n(l):a>3?n(t,o,l):n(t,o))||l);return a>3&&l&&Object.defineProperty(t,o,l),l};Object.defineProperty(t,"__esModule",{value:!0}),t.Email=void 0;var l=o(210),r=o(583),s=o(617),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}var o;return n(t,e),o=t,t.prototype.defineSlot=function(){this.emailSlot=this.slots.static({type:l.Slots.String,reference:"email",label:o.label,exchange:["required","alias","exportable"]})},t.prototype.defineEditor=function(){this.editor.name(),this.editor.description(),this.editor.placeholder(),this.editor.explanation(),this.editor.groups.options(),this.editor.required(this.emailSlot),this.editor.visibility(),this.editor.alias(this.emailSlot),this.editor.exportable(this.emailSlot)},t.prototype.defineCondition=function(){var e=this;(0,l.each)([{mode:"address",label:(0,l.pgettext)("block:email","Email address match")},{mode:"not-address",label:(0,l.pgettext)("block:email","Email address mismatch")},{mode:"domain",label:(0,l.pgettext)("block:email","Email address on domain")},{mode:"not-domain",label:(0,l.pgettext)("block:email","Email address not on domain")},{mode:"defined",label:(0,l.pgettext)("block:email","Email address is not empty")},{mode:"undefined",label:(0,l.pgettext)("block:email","Email address is empty")}],(function(t){e.conditions.template({condition:r.EmailCondition,label:t.label,autoOpen:"defined"!==t.mode&&"undefined"!==t.mode,props:{slot:e.emailSlot,mode:t.mode}})}))},a([l.slots],t.prototype,"defineSlot",null),a([l.editor],t.prototype,"defineEditor",null),a([l.conditions],t.prototype,"defineCondition",null),t=o=a([(0,l.tripetto)({type:"node",legacyBlock:!0,identifier:"@tripetto/block-email",version:"6.0.3",icon:s.default,get label(){return(0,l.pgettext)("block:email","Email address")}})],t)}(l.NodeBlock);t.Email=c},617:function(e,t,o){o.r(t),t.default="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PHBhdGggZD0iTTE3LjA3MSAyLjkyOUMxNS4xODIgMS4wNCAxMi42NzEgMCAxMCAwUzQuODE4IDEuMDQgMi45MjkgMi45MjlDMS4wNCA0LjgxOCAwIDcuMzI5IDAgMTBzMS4wNCA1LjE4MiAyLjkyOSA3LjA3MUE5LjkzNCA5LjkzNCAwIDAgMCAxMCAyMGE5Ljg5NCA5Ljg5NCAwIDAgMCA0LjQ2NS0xLjA1IDEwLjA4MyAxMC4wODMgMCAwIDAgMy40My0yLjgxMi41LjUgMCAxIDAtLjc4OS0uNjE1QTguOTUgOC45NSAwIDAgMSAxMCAxOC45OTljLTQuOTYzIDAtOS00LjAzNy05LTlzNC4wMzctOSA5LTkgOSA0LjAzNyA5IDljMCAxLjc2Ni0xLjAyOCAzLTIuNSAzYTIuNTAzIDIuNTAzIDAgMCAxLTIuNS0yLjV2LTRhLjUuNSAwIDAgMC0xIDB2Ljg1N2EzLjk5IDMuOTkgMCAwIDAtMy0xLjM1N2MtMi4yMDYgMC00IDEuNzk0LTQgNHMxLjc5NCA0IDQgNGMxLjQzIDAgMi42ODctLjc1NSAzLjM5NS0xLjg4N2EzLjUwNCAzLjUwNCAwIDAgMCAzLjEwNSAxLjg4N2MuOTY4IDAgMS44NTMtLjM5MyAyLjQ5NC0xLjEwNy42NTgtLjczNCAxLjAwNi0xLjczNCAxLjAwNi0yLjg5M2E5LjkzNCA5LjkzNCAwIDAgMC0yLjkyOS03LjA3MXpNMTAgMTNjLTEuNjU0IDAtMy0xLjM0Ni0zLTNzMS4zNDYtMyAzLTMgMyAxLjM0NiAzIDMtMS4zNDYgMy0zIDN6IiBjbGFzcz0idHJpcGV0dG8tZmlsbCIvPjwvc3ZnPg=="},210:function(t){t.exports=e}},o={};function i(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return t[e].call(a.exports,a,a.exports,i),a.exports}return i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(110)}()}));