UNPKG

@tripetto/block-email

Version:

Email block for Tripetto.

2 lines 4.03 kB
/*! Tripetto Email Block 6.0.3 - Copyright (C) 2023 Tripetto B.V. - All Rights Reserved */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("TripettoRunner")):"function"==typeof define&&define.amd?define("TripettoBlockEmail",["TripettoRunner"],e):"object"==typeof exports?exports.TripettoBlockEmail=e(require("TripettoRunner")):t.TripettoBlockEmail=e(t.TripettoRunner)}(this,(function(t){return function(){"use strict";var e={407:function(t,e,r){var o,n=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a};Object.defineProperty(e,"__esModule",{value:!0}),e.EmailCondition=void 0;var a=r(294),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.isMatch=function(){var t=this,e=this.valueOf();if(e){var r=a.Str.lowercase(e.string),o=a.Str.lowercase(function(){if((0,a.isVariable)(t.props.match)){var e=t.variableFor(t.props.match);return e&&e.hasValue?e.string:""}return t.parseVariables(t.props.match||"")}());switch(this.props.mode){case"domain":case"not-domain":return o&&r.substr(r.lastIndexOf("@")+1)===o==("domain"===this.props.mode)||!1;case"address":case"not-address":return r===o==("address"===this.props.mode)||!1;case"defined":return""!==r;case"undefined":return""===r}}return!1},i([a.condition],e.prototype,"isMatch",null),e=i([(0,a.tripetto)({type:"condition",legacyBlock:!0,identifier:"@tripetto/block-email"})],e)}(a.ConditionBlock);e.EmailCondition=c},856:function(t,e,r){var o,n=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a};Object.defineProperty(e,"__esModule",{value:!0}),e.Email=void 0;var a=r(294);r(407);var c=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,s=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.emailSlot=(0,a.assert)(e.valueOf("email")),e.required=e.emailSlot.slot.required||!1,e}return n(e,t),e.prototype.validate=function(){return!this.emailSlot.string||("rfc822"===this.props.validation?c:s).test(this.emailSlot.value)},i([a.validator],e.prototype,"validate",null),e}(a.NodeBlock);e.Email=l},294:function(e){e.exports=t}},r={};var o=function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return e[o].call(i.exports,i,i.exports,t),i.exports}(856);return o}()}));