UNPKG

@nocobase/plugin-workflow-notification

Version:
10 lines (9 loc) 7.86 kB
/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("@nocobase/plugin-notification-manager/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-notification",["react","@nocobase/plugin-notification-manager/client","@nocobase/client","@ant-design/icons","@nocobase/plugin-workflow/client","react-i18next"],e):"object"==typeof exports?exports["@nocobase/plugin-workflow-notification"]=e(require("react"),require("@nocobase/plugin-notification-manager/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):t["@nocobase/plugin-workflow-notification"]=e(t.react,t["@nocobase/plugin-notification-manager/client"],t["@nocobase/client"],t["@ant-design/icons"],t["@nocobase/plugin-workflow/client"],t["react-i18next"])}(self,function(t,e,n,o,r,i){return function(){"use strict";var c={482:function(t){t.exports=o},772:function(t){t.exports=n},786:function(t){t.exports=e},433:function(t){t.exports=r},156:function(e){e.exports=t},238:function(t){t.exports=i}},u={};function a(t){var e=u[t];if(void 0!==e)return e.exports;var n=u[t]={exports:{}};return c[t](n,n.exports,a),n.exports}a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,{a:e}),e},a.d=function(t,e){for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var f={};return!function(){a.r(f),a.d(f,{default:function(){return j}});var t=a(772),e=a(156),n=a.n(e),o=a(482),r=a(433),i=a(786);a(238);var c="workflow-notification";function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(p=function(){return!!t})()}var b=function(){var t=(0,r.useWorkflowVariableOptions)();return n().createElement(i.MessageConfigForm,{variableOptions:t})},y=function(t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function e(){var t,r,i;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");return r=e,i=arguments,r=l(r),u(t=function(t,e){var n;if(e&&("object"==((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,p()?Reflect.construct(r,i||[],l(this).constructor):r.apply(this,i)),"title",'{{t("Notification", { ns: "'.concat(c,'" })}}')),u(t,"type","notification"),u(t,"group","extended"),u(t,"description",'{{t("Send notification. You can use the variables in the upstream nodes as content and ohter config.", { ns: "'.concat(c,'" })}}')),u(t,"icon",n().createElement(o.NotificationOutlined,null)),u(t,"fieldset",{message:{type:"void","x-component":"LocalProvider"},ignoreFail:{type:"boolean","x-content":'{{t("Ignore failure and continue workflow", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox"}}),u(t,"components",{LocalProvider:b}),u(t,"testable",!0),t}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t),e}(r.Instruction);function d(t,e,n,o,r,i,c){try{var u=t[i](c),a=u.value}catch(t){n(t);return}u.done?e(a):Promise.resolve(a).then(o,r)}function v(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function c(t){d(i,o,r,c,u,"next",t)}function u(t){d(i,o,r,c,u,"throw",t)}c(void 0)})}}function h(t,e,n){return(h=x()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&w(r,n.prototype),r}).apply(null,arguments)}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function m(t){var e="function"==typeof Map?new Map:void 0;return(m=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return h(t,arguments,g(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,t)})(t)}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(x=function(){return!!t})()}function O(t,e){var n,o,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var a=[i,u];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,o=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){c.label=a[1];break}if(6===a[0]&&c.label<r[1]){c.label=r[1],r=a;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(a);break}r[2]&&c.ops.pop(),c.trys.pop();continue}a=e.call(t,c)}catch(t){a=[6,t],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var j=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,e;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,e=arguments,t=g(t),function(t,e){var n;if(e&&("object"==((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,x()?Reflect.construct(t,e||[],g(this).constructor):t.apply(this,e))}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&w(n,t),e=[{key:"afterAdd",value:function(){return v(function(){return O(this,function(t){return[2]})})()}},{key:"beforeLoad",value:function(){return v(function(){return O(this,function(t){return[2]})})()}},{key:"load",value:function(){var t=this;return v(function(){return O(this,function(e){return t.app.pm.get("workflow").registerInstruction("notification",y),[2]})})()}}],function(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(n.prototype,e),n}(m(t.Plugin))}(),f}()});