@nocobase/plugin-workflow-mailer 2.2.0-alpha.1 → 2.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_mailer=self.webpackChunk_nocobase_plugin_workflow_mailer||[]).push([["610"],{649:function(e,t,r){r.d(t,{MailerFieldset:function(){return j}});var n=r(375),l=r(799),a=r(428),o=r(155),i=r.n(o);"u">typeof window&&void 0!==window.document&&window.document.createElement;let c=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[c.Translate.toString(e),c.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}});var u=r(197),m=r(59),s="html",d="text",f=["string"],p=["string"],b=["string"],g=[["string",{type:"password"}]],v=[["number",{min:1,max:65535,step:1}]],E=["boolean"];function y(e,t){var r,n,l=t.collectionManager;if(!e.target||e.isForeignKey)return!1;var a=null==l||null==(r=l.getCollection)?void 0:r.call(l,e.target);return(null==a?void 0:a.template)==="file"||(null==a||null==(n=a.options)?void 0:n.template)==="file"}var h=r(488);function w(e,t,r,n,l,a,o){try{var i=e[a](o),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,l)}var k=i().createContext(null);function S(e){var t,r,l=e.disabled,a=(0,h.kj)(),o=i().useContext(k);return i().createElement(m.Button,(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ref:l||null==o?void 0:o.setActivatorNodeRef,"aria-label":a("Drag sort"),disabled:l,icon:i().createElement(n.MenuOutlined,null),type:"text"},l?{}:null==o?void 0:o.attributes,l?{}:null==o?void 0:o.listeners),r=r={style:{color:"var(--ant-color-text-tertiary)",cursor:l?"not-allowed":"grab"}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}function O(e){var t=e.children,r=e.disabled,n=e.id,l=(0,a.useSortable)({disabled:r,id:n}),o=l.attributes,u=l.isDragging,s=l.listeners,d=l.setActivatorNodeRef,f=l.setNodeRef,p=l.transform,b=l.transition,g=m.theme.useToken().token;return i().createElement(k.Provider,{value:{attributes:o,listeners:s,setActivatorNodeRef:d}},i().createElement(m.Row,{ref:f,gutter:g.marginXS,align:"middle",style:{position:u?"relative":void 0,zIndex:u?1:void 0,transform:c.Transform.toString(p),transition:b}},t))}function C(e){var t=e.name,r=e.label,o=e.required,c=(0,h.kj)(),s=m.Form.useFormInstance(),d=(0,l.useSensors)((0,l.useSensor)(l.PointerSensor)),p=i().useRef(!1),b=function(){p.current=!0,setTimeout(function(){p.current=!1})};return i().createElement(m.Form.Item,{label:r,required:o},i().createElement(m.Form.List,{name:t,rules:[{validator:function(e,t){var r;return(r=function(){return function(e,t){var r,n,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(l=2&u[0]?n.return:u[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,u[1])).done)return l;switch(n=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){a.label=u[1];break}if(6===u[0]&&a.label<l[1]){a.label=l[1],l=u;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(u);break}l[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){if(!o||(null==t?void 0:t.filter(Boolean).length))return[2];if(p.current)return p.current=!1,[2];throw Error(c("Please enter at least one email address"))})},function(){var e=this,t=arguments;return new Promise(function(n,l){var a=r.apply(e,t);function o(e){w(a,n,l,o,i,"next",e)}function i(e){w(a,n,l,o,i,"throw",e)}o(void 0)})})()}}]},function(e,r,o){var p=r.add,g=r.move,v=r.remove,E=o.errors,y=e.map(function(e){return String(e.key)});return i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},i().createElement(l.DndContext,{sensors:d,collisionDetection:l.closestCenter,onDragEnd:function(e){var t=e.active,r=e.over;if(r&&t.id!==r.id){var n=y.indexOf(String(t.id)),l=y.indexOf(String(r.id));n<0||l<0||g(n,l)}}},i().createElement(a.SortableContext,{items:y,strategy:a.verticalListSortingStrategy},i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},e.map(function(t){return i().createElement(O,{key:t.key,id:String(t.key),disabled:e.length<2},i().createElement(m.Col,null,i().createElement(S,{disabled:e.length<2})),i().createElement(m.Col,{flex:"auto"},i().createElement(m.Form.Item,{name:t.name,noStyle:!0},i().createElement(u.WorkflowTypedVariableInput,{types:f,placeholder:c("Email address")}))),i().createElement(m.Col,null,i().createElement(m.Button,{"aria-label":c("Delete"),icon:i().createElement(n.DeleteOutlined,null),onClick:function(){return v(t.name)}})))})))),i().createElement(m.Button,{block:!0,icon:i().createElement(n.PlusOutlined,null),onClick:function(){b(),p(""),s.setFields([{name:t,errors:[]}])}},c("Add email address")),i().createElement(m.Form.ErrorList,{errors:E}))}))}function x(){var e=(0,h.kj)(),t=(0,l.useSensors)((0,l.useSensor)(l.PointerSensor)),r={types:[y]};return i().createElement(m.Form.Item,{label:e("Attachments"),extra:e("Only variables that resolve to file collection records are supported.")},i().createElement(m.Form.List,{name:["config","attachments"]},function(o,c){var s=c.add,d=c.move,f=c.remove,p=o.map(function(e){return String(e.key)});return i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},i().createElement(l.DndContext,{sensors:t,collisionDetection:l.closestCenter,onDragEnd:function(e){var t=e.active,r=e.over;if(r&&t.id!==r.id){var n=p.indexOf(String(t.id)),l=p.indexOf(String(r.id));n<0||l<0||d(n,l)}}},i().createElement(a.SortableContext,{items:p,strategy:a.verticalListSortingStrategy},i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},o.map(function(t){return i().createElement(O,{key:t.key,id:String(t.key),disabled:o.length<2},i().createElement(m.Col,null,i().createElement(S,{disabled:o.length<2})),i().createElement(m.Col,{flex:"auto"},i().createElement(m.Form.Item,{name:t.name,noStyle:!0},i().createElement(u.WorkflowVariableInput,{variableOptions:r,placeholder:e("File record")}))),i().createElement(m.Col,null,i().createElement(m.Button,{"aria-label":e("Delete"),icon:i().createElement(n.DeleteOutlined,null),onClick:function(){return f(t.name)}})))})))),i().createElement(m.Button,{block:!0,icon:i().createElement(n.PlusOutlined,null),onClick:function(){return s(null)}},e("Add attachment")))}))}function F(){var e=(0,h.kj)(),t=m.theme.useToken().token;return i().createElement(i().Fragment,null,i().createElement(m.Row,{gutter:t.marginSM},i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","host"],label:e("SMTP host"),rules:[{required:!0}],initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:p,placeholder:"smtp.example.com"}))),i().createElement(m.Col,{span:6},i().createElement(m.Form.Item,{name:["config","provider","port"],label:e("Port"),rules:[{required:!0}],initialValue:465},i().createElement(u.WorkflowTypedVariableInput,{types:v}))),i().createElement(m.Col,{span:6},i().createElement(m.Form.Item,{name:["config","provider","secure"],label:e("Secure"),extra:e("In most cases, if using port 465, set it to true; otherwise, set it to false."),initialValue:!0},i().createElement(u.WorkflowTypedVariableInput,{types:E})))),i().createElement(m.Row,{gutter:t.marginSM},i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","auth","user"],label:e("User"),initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:b,placeholder:"example@domain.com"}))),i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","auth","pass"],label:e("Password"),initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:g})))))}function I(){var e,t=(0,h.kj)(),r=m.Form.useFormInstance();return(null!=(e=m.Form.useWatch(["config","contentType"],r))?e:s)===d?i().createElement(m.Form.Item,{name:["config","text"],label:t("Content")},i().createElement(u.WorkflowVariableTextArea,{autoSize:{minRows:10},placeholder:"Hi,"})):i().createElement(m.Form.Item,{name:["config","html"],label:t("Content")},i().createElement(u.WorkflowVariableTextArea,{autoSize:{minRows:10},placeholder:"Hi,"}))}function j(){var e=(0,h.kj)();return i().createElement(i().Fragment,null,i().createElement(F,null),i().createElement(m.Form.Item,{name:["config","from"],label:e("From"),rules:[{required:!0}],initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:f,placeholder:"noreply <example@domain.com>"})),i().createElement(C,{name:["config","to"],label:e("To"),required:!0}),i().createElement(C,{name:["config","cc"],label:e("CC")}),i().createElement(C,{name:["config","bcc"],label:e("BCC")}),i().createElement(m.Form.Item,{name:["config","subject"],label:e("Subject")},i().createElement(u.WorkflowVariableInput,null)),i().createElement(m.Form.Item,{name:["config","contentType"],label:e("Content type"),initialValue:s},i().createElement(m.Radio.Group,{options:[{label:"HTML",value:s},{label:e("Plain text"),value:d}]})),i().createElement(I,null),i().createElement(x,null),i().createElement(m.Form.Item,{name:["config","ignoreFail"],valuePropName:"checked"},i().createElement(m.Checkbox,null,e("Ignore failed sending and continue workflow"))))}}}]);
@@ -6,370 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import React from 'react';
10
- import { Instruction, WorkflowVariableInput, WorkflowVariableRawTextArea, WorkflowVariableTextArea } from '@nocobase/plugin-workflow/client';
11
- export default class extends Instruction {
12
- title: string;
13
- type: string;
14
- group: string;
15
- description: string;
16
- icon: React.JSX.Element;
17
- fieldset: {
18
- provider: {
19
- type: string;
20
- properties: {
21
- server: {
22
- type: string;
23
- 'x-decorator': string;
24
- 'x-decorator-props': {
25
- value: {
26
- designable: boolean;
27
- };
28
- };
29
- 'x-component': string;
30
- properties: {
31
- row: {
32
- type: string;
33
- 'x-component': string;
34
- properties: {
35
- host: {
36
- type: string;
37
- 'x-component': string;
38
- 'x-component-props': {
39
- width: number;
40
- };
41
- properties: {
42
- host: {
43
- type: string;
44
- required: boolean;
45
- title: string;
46
- 'x-decorator': string;
47
- 'x-component': string;
48
- 'x-component-props': {
49
- useTypedConstant: (string | {
50
- placeholder: string;
51
- })[][];
52
- };
53
- };
54
- };
55
- };
56
- port: {
57
- type: string;
58
- 'x-component': string;
59
- 'x-component-props': {
60
- width: number;
61
- };
62
- properties: {
63
- port: {
64
- type: string;
65
- required: boolean;
66
- title: string;
67
- 'x-decorator': string;
68
- 'x-component': string;
69
- 'x-component-props': {
70
- useTypedConstant: (string | {
71
- min: number;
72
- max: number;
73
- step: number;
74
- })[][];
75
- };
76
- default: number;
77
- };
78
- };
79
- };
80
- secure: {
81
- type: string;
82
- 'x-component': string;
83
- 'x-component-props': {
84
- width: number;
85
- };
86
- properties: {
87
- secure: {
88
- type: string;
89
- title: string;
90
- description: string;
91
- 'x-decorator': string;
92
- 'x-component': string;
93
- 'x-component-props': {
94
- useTypedConstant: (string | {
95
- style: {
96
- width: string;
97
- };
98
- })[][];
99
- };
100
- default: boolean;
101
- };
102
- };
103
- };
104
- };
105
- };
106
- };
107
- };
108
- auth: {
109
- type: string;
110
- 'x-decorator': string;
111
- 'x-decorator-props': {
112
- value: {
113
- designable: boolean;
114
- };
115
- };
116
- 'x-component': string;
117
- properties: {
118
- row: {
119
- type: string;
120
- 'x-component': string;
121
- properties: {
122
- user: {
123
- type: string;
124
- 'x-component': string;
125
- properties: {
126
- 'auth.user': {
127
- type: string;
128
- title: string;
129
- 'x-decorator': string;
130
- 'x-component': string;
131
- 'x-component-props': {
132
- useTypedConstant: (string | {
133
- placeholder: string;
134
- })[][];
135
- };
136
- };
137
- };
138
- };
139
- pass: {
140
- type: string;
141
- 'x-component': string;
142
- properties: {
143
- 'auth.pass': {
144
- type: string;
145
- title: string;
146
- 'x-decorator': string;
147
- 'x-component': string;
148
- 'x-component-props': {
149
- useTypedConstant: (string | {
150
- type: string;
151
- })[][];
152
- };
153
- };
154
- };
155
- };
156
- };
157
- };
158
- };
159
- };
160
- };
161
- };
162
- from: {
163
- type: string;
164
- required: boolean;
165
- title: string;
166
- 'x-decorator': string;
167
- 'x-component': string;
168
- 'x-component-props': {
169
- useTypedConstant: (string | {
170
- placeholder: string;
171
- })[][];
172
- };
173
- };
174
- to: {
175
- type: string;
176
- required: boolean;
177
- title: string;
178
- 'x-decorator': string;
179
- 'x-component': string;
180
- items: {
181
- type: string;
182
- 'x-component': string;
183
- 'x-component-props': {
184
- className: string;
185
- };
186
- properties: {
187
- sort: {
188
- type: string;
189
- 'x-decorator': string;
190
- 'x-component': string;
191
- };
192
- input: {
193
- type: string;
194
- 'x-decorator': string;
195
- 'x-component': string;
196
- 'x-component-props': {
197
- useTypedConstant: string[];
198
- placeholder: string;
199
- };
200
- };
201
- remove: {
202
- type: string;
203
- 'x-decorator': string;
204
- 'x-component': string;
205
- };
206
- };
207
- };
208
- properties: {
209
- add: {
210
- type: string;
211
- title: string;
212
- 'x-component': string;
213
- };
214
- };
215
- };
216
- cc: {
217
- type: string;
218
- title: string;
219
- 'x-decorator': string;
220
- 'x-component': string;
221
- items: {
222
- type: string;
223
- 'x-component': string;
224
- 'x-component-props': {
225
- className: string;
226
- };
227
- properties: {
228
- sort: {
229
- type: string;
230
- 'x-decorator': string;
231
- 'x-component': string;
232
- };
233
- input: {
234
- type: string;
235
- 'x-decorator': string;
236
- 'x-component': string;
237
- 'x-component-props': {
238
- useTypedConstant: string[];
239
- placeholder: string;
240
- };
241
- };
242
- remove: {
243
- type: string;
244
- 'x-decorator': string;
245
- 'x-component': string;
246
- };
247
- };
248
- };
249
- properties: {
250
- add: {
251
- type: string;
252
- title: string;
253
- 'x-component': string;
254
- };
255
- };
256
- };
257
- bcc: {
258
- type: string;
259
- title: string;
260
- 'x-decorator': string;
261
- 'x-component': string;
262
- items: {
263
- type: string;
264
- 'x-component': string;
265
- 'x-component-props': {
266
- className: string;
267
- };
268
- properties: {
269
- sort: {
270
- type: string;
271
- 'x-decorator': string;
272
- 'x-component': string;
273
- };
274
- input: {
275
- type: string;
276
- 'x-decorator': string;
277
- 'x-component': string;
278
- 'x-component-props': {
279
- useTypedConstant: string[];
280
- placeholder: string;
281
- };
282
- };
283
- remove: {
284
- type: string;
285
- 'x-decorator': string;
286
- 'x-component': string;
287
- };
288
- };
289
- };
290
- properties: {
291
- add: {
292
- type: string;
293
- title: string;
294
- 'x-component': string;
295
- };
296
- };
297
- };
298
- subject: {
299
- type: string;
300
- title: string;
301
- 'x-decorator': string;
302
- 'x-component': string;
303
- };
304
- contentType: {
305
- type: string;
306
- title: string;
307
- 'x-decorator': string;
308
- 'x-component': string;
309
- enum: {
310
- label: string;
311
- value: string;
312
- }[];
313
- default: string;
314
- };
315
- html: {
316
- type: string;
317
- title: string;
318
- 'x-decorator': string;
319
- 'x-decorator-props': {};
320
- 'x-component': string;
321
- 'x-component-props': {
322
- placeholder: string;
323
- autoSize: {
324
- minRows: number;
325
- };
326
- };
327
- 'x-reactions': {
328
- dependencies: string[];
329
- fulfill: {
330
- state: {
331
- visible: string;
332
- };
333
- };
334
- }[];
335
- };
336
- text: {
337
- type: string;
338
- title: string;
339
- 'x-decorator': string;
340
- 'x-decorator-props': {};
341
- 'x-component': string;
342
- 'x-component-props': {
343
- placeholder: string;
344
- autoSize: {
345
- minRows: number;
346
- };
347
- };
348
- 'x-reactions': {
349
- dependencies: string[];
350
- fulfill: {
351
- state: {
352
- visible: string;
353
- };
354
- };
355
- }[];
356
- };
357
- ignoreFail: {
358
- type: string;
359
- 'x-content': string;
360
- 'x-decorator': string;
361
- 'x-component': string;
362
- };
363
- };
364
- components: {
365
- ArrayItems: import("@formily/reactive-react").ReactFC<React.HTMLAttributes<HTMLDivElement>> & import("@formily/antd-v5").ArrayBaseMixins & {
366
- Item: import("@formily/reactive-react").ReactFC<React.HTMLAttributes<HTMLDivElement> & {
367
- type?: "card" | "divide";
368
- }>;
369
- };
370
- SchemaComponentContext: React.Context<import("@nocobase/client").ISchemaComponentContext>;
371
- WorkflowVariableInput: typeof WorkflowVariableInput;
372
- WorkflowVariableTextArea: typeof WorkflowVariableTextArea;
373
- WorkflowVariableRawTextArea: typeof WorkflowVariableRawTextArea;
374
- };
9
+ import V2MailerInstruction from '../client-v2/MailerInstruction';
10
+ export default class extends V2MailerInstruction {
375
11
  }
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-i18next"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-mailer",["react","react-i18next","@nocobase/client","@ant-design/icons","@nocobase/plugin-workflow/client","@formily/antd-v5"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-mailer"]=t(require("react"),require("react-i18next"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5")):e["@nocobase/plugin-workflow-mailer"]=t(e.react,e["react-i18next"],e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e["@formily/antd-v5"])}(self,function(e,t,o,r,n,i){return function(){"use strict";var c={375:function(e){e.exports=r},418:function(e){e.exports=i},342:function(e){e.exports=o},990:function(e){e.exports=n},155:function(t){t.exports=e},953:function(e){e.exports=t}},a={};function p(e){var t=a[e];if(void 0!==t)return t.exports;var o=a[e]={exports:{}};return c[e](o,o.exports,p),o.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var o in t)p.o(t,o)&&!p.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(l=p.g.location+"");var l,s=p.g.document;if(!l&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(l=s.currentScript.src),!l)){var u=s.getElementsByTagName("script");if(u.length)for(var f=u.length-1;f>-1&&(!l||!/^http(s?):/.test(l));)l=u[f--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");p.p=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),e=o+"static/plugins/@nocobase/plugin-workflow-mailer/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",n="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(n);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-mailer/dist/client/"}p.p=e}(),!function(){p.r(d),p.d(d,{default:function(){return k}});var e=p(342),t=p(375),o=p(418),r=p(155),n=p.n(r),i=p(990);p(953);var c="workflow-mailer";function a(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function f(){var e,t,o=(e=["\n width: 100%;\n\n .ant-space-item:nth-child(2) {\n flex-grow: 1;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return o},o}var m=(0,e.css)(f()),y=function(r){if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function p(){var r,s,f;if(!(this instanceof p))throw TypeError("Cannot call a class as a function");return s=p,f=arguments,s=l(s),a(r=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(s,f||[],l(this).constructor):s.apply(this,f)),"title",'{{t("Mailer", { ns: "'.concat(c,'" })}}')),a(r,"type","mailer"),a(r,"group","extended"),a(r,"description",'{{t("Send email. You can use the variables in the upstream nodes as receivers, subject and content of the email.", { ns: "'.concat(c,'" })}}')),a(r,"icon",n().createElement(t.MailOutlined,{style:{}})),a(r,"fieldset",{provider:{type:"object",properties:{server:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{host:{type:"void","x-component":"Grid.Col","x-component-props":{width:50},properties:{host:{type:"string",required:!0,title:'{{t("SMTP host", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["string",{placeholder:"smtp.example.com"}]]}}}},port:{type:"void","x-component":"Grid.Col","x-component-props":{width:25},properties:{port:{type:"number",required:!0,title:'{{t("Port", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["number",{min:1,max:65535,step:1}]]},default:465}}},secure:{type:"void","x-component":"Grid.Col","x-component-props":{width:25},properties:{secure:{type:"boolean",title:'{{t("Secure", { ns: "'.concat(c,'" })}}'),description:'{{t("In most cases, if using port 465, set it to true; otherwise, set it to false.", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["boolean",{style:{width:"100%"}}]]},default:!0}}}}}}},auth:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{user:{type:"void","x-component":"Grid.Col",properties:{"auth.user":{type:"string",title:'{{t("User", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["string",{placeholder:"example@domain.com"}]]}}}},pass:{type:"void","x-component":"Grid.Col",properties:{"auth.pass":{type:"string",title:'{{t("Password", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["string",{type:"password"}]]}}}}}}}}}},from:{type:"string",required:!0,title:'{{t("From", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:[["string",{placeholder:"noreply <example@domain.com>"}]]}},to:{type:"array",required:!0,title:'{{t("To", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"void","x-component":"Space","x-component-props":{className:m},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["string"],placeholder:'{{t("Email address")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:'{{t("Add email address", { ns: "'.concat(c,'" })}}'),"x-component":"ArrayItems.Addition"}}},cc:{type:"array",title:'{{t("CC", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"void","x-component":"Space","x-component-props":{className:m},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["string"],placeholder:'{{t("Email address")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:'{{t("Add email address", { ns: "'.concat(c,'" })}}'),"x-component":"ArrayItems.Addition"}}},bcc:{type:"array",title:'{{t("BCC", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"void","x-component":"Space","x-component-props":{className:m},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["string"],placeholder:'{{t("Email address")}}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:'{{t("Add email address", { ns: "'.concat(c,'" })}}'),"x-component":"ArrayItems.Addition"}}},subject:{type:"string",title:'{{t("Subject", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea"},contentType:{type:"string",title:'{{t("Content type", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"HTML",value:"html"},{label:'{{t("Plain text", { ns: "'.concat(c,'" })}}'),value:"text"}],default:"html"},html:{type:"string",title:'{{t("Content", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableRawTextArea","x-component-props":{placeholder:"Hi,",autoSize:{minRows:10}},"x-reactions":[{dependencies:["contentType"],fulfill:{state:{visible:'{{$deps[0] === "html"}}'}}}]},text:{type:"string",title:'{{t("Content", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"WorkflowVariableRawTextArea","x-component-props":{placeholder:"Hi,",autoSize:{minRows:10}},"x-reactions":[{dependencies:["contentType"],fulfill:{state:{visible:'{{$deps[0] === "text"}}'}}}]},ignoreFail:{type:"boolean","x-content":'{{t("Ignore failed sending and continue workflow", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox"}}),a(r,"components",{ArrayItems:o.ArrayItems,SchemaComponentContext:e.SchemaComponentContext,WorkflowVariableInput:i.WorkflowVariableInput,WorkflowVariableTextArea:i.WorkflowVariableTextArea,WorkflowVariableRawTextArea:i.WorkflowVariableRawTextArea}),r}return p.prototype=Object.create(r&&r.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),r&&s(p,r),p}(i.Instruction);function b(e,t,o,r,n,i,c){try{var a=e[i](c),p=a.value}catch(e){o(e);return}a.done?t(p):Promise.resolve(p).then(r,n)}function x(e){return function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){b(i,r,n,c,a,"next",e)}function a(e){b(i,r,n,c,a,"throw",e)}c(void 0)})}}function v(e,t,o){return(v=I()?Reflect.construct:function(e,t,o){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return o&&w(n,o.prototype),n}).apply(null,arguments)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t="function"==typeof Map?new Map:void 0;return(g=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return v(e,arguments,h(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),w(o,e)})(e)}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}function _(e,t){var o,r,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:p(0)}),a(c,"throw",{value:p(1)}),a(c,"return",{value:p(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function p(a){return function(p){var l=[a,p];if(o)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(o=1,r&&(n=2&l[0]?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(6===l[0]&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{o=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var k=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var e,t;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,t=arguments,e=h(e),function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,I()?Reflect.construct(e,t||[],h(this).constructor):e.apply(this,t))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&w(o,e),t=[{key:"afterAdd",value:function(){return x(function(){return _(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return x(function(){return _(this,function(e){return[2]})})()}},{key:"load",value:function(){return x(function(){return _(this,function(e){return this.app.pm.get("workflow").registerInstruction("mailer",y),[2]})}).call(this)}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(o.prototype,t),o}(g(e.Plugin))}(),d}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dnd-kit/sortable"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@dnd-kit/core"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-mailer",["@dnd-kit/sortable","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","@dnd-kit/core","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-mailer"]=t(require("@dnd-kit/sortable"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@dnd-kit/core"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-mailer"]=t(e["@dnd-kit/sortable"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["@dnd-kit/core"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u,c){return function(){"use strict";var a,l,f,s={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="workflow-mailer";function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"],nsMode:"fallback"},n))}}function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"],nsMode:"fallback"},t))}},375:function(e){e.exports=u},799:function(e){e.exports=i},428:function(t){t.exports=e},342:function(e){e.exports=o},694:function(e){e.exports=c},197:function(e){e.exports=r},59:function(e){e.exports=n},155:function(e){e.exports=t}},p={};function b(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return s[e](n,n.exports,b),n.exports}b.m=s,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+".e6ad06c52afc1ab1.js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},b.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-workflow-mailer:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-mailer:"+n),o.src=e),d[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var d,y,h=b.g.document;if(!y&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(y=h.currentScript.src),!y)){var v=h.getElementsByTagName("script");if(v.length)for(var w=v.length-1;w>-1&&(!y||!/^http(s?):/.test(y));)y=v[w--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a={889:0},b.f.j=function(e,t){var n=b.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},l=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);u&&u(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(f=self.webpackChunk_nocobase_plugin_workflow_mailer=self.webpackChunk_nocobase_plugin_workflow_mailer||[]).forEach(l.bind(null,0)),f.push=l.bind(null,f.push.bind(f));var g={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-mailer/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-mailer/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-mailer/dist/client/"}b.p=e}(),!function(){b.r(g),b.d(g,{default:function(){return j}});var e=b(342),t=b(375),n=b(197),r=b(155),o=b.n(r),i=b(488);function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var d=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,n=arguments,e=f(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(e,n||[],f(this).constructor):e.apply(this,n))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e),t}(function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,a=arguments,r=c(r),u(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,l()?Reflect.construct(r,a||[],c(this).constructor):r.apply(this,a)),"type","mailer"),u(e,"title",(0,i.MZ)("Mailer")),u(e,"group","extended"),u(e,"description",(0,i.MZ)("Send email. You can use the variables in the upstream nodes as receivers, subject and content of the email.")),u(e,"icon",o().createElement(t.MailOutlined,null)),u(e,"FieldsetLoader",function(){return b.e("610").then(b.bind(b,649)).then(function(e){return{default:e.MailerFieldset}})}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&a(n,e),n}(n.Instruction));function y(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){y(i,r,o,u,c,"next",e)}function c(e){y(i,r,o,u,c,"throw",e)}u(void 0)})}}function v(e,t,n){return(v=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return v(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function k(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var j=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=w(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&m(n,e),t=[{key:"afterAdd",value:function(){return h(function(){return k(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return h(function(){return k(this,function(e){return[2]})})()}},{key:"load",value:function(){return h(function(){return k(this,function(e){return this.app.pm.get("workflow").registerInstruction("mailer",d),[2]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(_(e.Plugin))}(),g}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_workflow_mailer_client_v2=self.webpackChunk_nocobase_plugin_workflow_mailer_client_v2||[]).push([["610"],{649:function(e,t,r){r.d(t,{MailerFieldset:function(){return j}});var n=r(375),l=r(799),a=r(428),o=r(155),i=r.n(o);"u">typeof window&&void 0!==window.document&&window.document.createElement;let c=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[c.Translate.toString(e),c.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}});var u=r(197),m=r(59),s="html",d="text",f=["string"],p=["string"],b=["string"],v=[["string",{type:"password"}]],g=[["number",{min:1,max:65535,step:1}]],E=["boolean"];function y(e,t){var r,n,l=t.collectionManager;if(!e.target||e.isForeignKey)return!1;var a=null==l||null==(r=l.getCollection)?void 0:r.call(l,e.target);return(null==a?void 0:a.template)==="file"||(null==a||null==(n=a.options)?void 0:n.template)==="file"}var h=r(488);function w(e,t,r,n,l,a,o){try{var i=e[a](o),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,l)}var k=i().createContext(null);function S(e){var t,r,l=e.disabled,a=(0,h.kj)(),o=i().useContext(k);return i().createElement(m.Button,(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ref:l||null==o?void 0:o.setActivatorNodeRef,"aria-label":a("Drag sort"),disabled:l,icon:i().createElement(n.MenuOutlined,null),type:"text"},l?{}:null==o?void 0:o.attributes,l?{}:null==o?void 0:o.listeners),r=r={style:{color:"var(--ant-color-text-tertiary)",cursor:l?"not-allowed":"grab"}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}function O(e){var t=e.children,r=e.disabled,n=e.id,l=(0,a.useSortable)({disabled:r,id:n}),o=l.attributes,u=l.isDragging,s=l.listeners,d=l.setActivatorNodeRef,f=l.setNodeRef,p=l.transform,b=l.transition,v=m.theme.useToken().token;return i().createElement(k.Provider,{value:{attributes:o,listeners:s,setActivatorNodeRef:d}},i().createElement(m.Row,{ref:f,gutter:v.marginXS,align:"middle",style:{position:u?"relative":void 0,zIndex:u?1:void 0,transform:c.Transform.toString(p),transition:b}},t))}function C(e){var t=e.name,r=e.label,o=e.required,c=(0,h.kj)(),s=m.Form.useFormInstance(),d=(0,l.useSensors)((0,l.useSensor)(l.PointerSensor)),p=i().useRef(!1),b=function(){p.current=!0,setTimeout(function(){p.current=!1})};return i().createElement(m.Form.Item,{label:r,required:o},i().createElement(m.Form.List,{name:t,rules:[{validator:function(e,t){var r;return(r=function(){return function(e,t){var r,n,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(l=2&u[0]?n.return:u[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,u[1])).done)return l;switch(n=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){a.label=u[1];break}if(6===u[0]&&a.label<l[1]){a.label=l[1],l=u;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(u);break}l[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){if(!o||(null==t?void 0:t.filter(Boolean).length))return[2];if(p.current)return p.current=!1,[2];throw Error(c("Please enter at least one email address"))})},function(){var e=this,t=arguments;return new Promise(function(n,l){var a=r.apply(e,t);function o(e){w(a,n,l,o,i,"next",e)}function i(e){w(a,n,l,o,i,"throw",e)}o(void 0)})})()}}]},function(e,r,o){var p=r.add,v=r.move,g=r.remove,E=o.errors,y=e.map(function(e){return String(e.key)});return i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},i().createElement(l.DndContext,{sensors:d,collisionDetection:l.closestCenter,onDragEnd:function(e){var t=e.active,r=e.over;if(r&&t.id!==r.id){var n=y.indexOf(String(t.id)),l=y.indexOf(String(r.id));n<0||l<0||v(n,l)}}},i().createElement(a.SortableContext,{items:y,strategy:a.verticalListSortingStrategy},i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},e.map(function(t){return i().createElement(O,{key:t.key,id:String(t.key),disabled:e.length<2},i().createElement(m.Col,null,i().createElement(S,{disabled:e.length<2})),i().createElement(m.Col,{flex:"auto"},i().createElement(m.Form.Item,{name:t.name,noStyle:!0},i().createElement(u.WorkflowTypedVariableInput,{types:f,placeholder:c("Email address")}))),i().createElement(m.Col,null,i().createElement(m.Button,{"aria-label":c("Delete"),icon:i().createElement(n.DeleteOutlined,null),onClick:function(){return g(t.name)}})))})))),i().createElement(m.Button,{block:!0,icon:i().createElement(n.PlusOutlined,null),onClick:function(){b(),p(""),s.setFields([{name:t,errors:[]}])}},c("Add email address")),i().createElement(m.Form.ErrorList,{errors:E}))}))}function x(){var e=(0,h.kj)(),t=(0,l.useSensors)((0,l.useSensor)(l.PointerSensor)),r={types:[y]};return i().createElement(m.Form.Item,{label:e("Attachments"),extra:e("Only variables that resolve to file collection records are supported.")},i().createElement(m.Form.List,{name:["config","attachments"]},function(o,c){var s=c.add,d=c.move,f=c.remove,p=o.map(function(e){return String(e.key)});return i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},i().createElement(l.DndContext,{sensors:t,collisionDetection:l.closestCenter,onDragEnd:function(e){var t=e.active,r=e.over;if(r&&t.id!==r.id){var n=p.indexOf(String(t.id)),l=p.indexOf(String(r.id));n<0||l<0||d(n,l)}}},i().createElement(a.SortableContext,{items:p,strategy:a.verticalListSortingStrategy},i().createElement(m.Space,{direction:"vertical",style:{width:"100%"}},o.map(function(t){return i().createElement(O,{key:t.key,id:String(t.key),disabled:o.length<2},i().createElement(m.Col,null,i().createElement(S,{disabled:o.length<2})),i().createElement(m.Col,{flex:"auto"},i().createElement(m.Form.Item,{name:t.name,noStyle:!0},i().createElement(u.WorkflowVariableInput,{variableOptions:r,placeholder:e("File record")}))),i().createElement(m.Col,null,i().createElement(m.Button,{"aria-label":e("Delete"),icon:i().createElement(n.DeleteOutlined,null),onClick:function(){return f(t.name)}})))})))),i().createElement(m.Button,{block:!0,icon:i().createElement(n.PlusOutlined,null),onClick:function(){return s(null)}},e("Add attachment")))}))}function F(){var e=(0,h.kj)(),t=m.theme.useToken().token;return i().createElement(i().Fragment,null,i().createElement(m.Row,{gutter:t.marginSM},i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","host"],label:e("SMTP host"),rules:[{required:!0}],initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:p,placeholder:"smtp.example.com"}))),i().createElement(m.Col,{span:6},i().createElement(m.Form.Item,{name:["config","provider","port"],label:e("Port"),rules:[{required:!0}],initialValue:465},i().createElement(u.WorkflowTypedVariableInput,{types:g}))),i().createElement(m.Col,{span:6},i().createElement(m.Form.Item,{name:["config","provider","secure"],label:e("Secure"),extra:e("In most cases, if using port 465, set it to true; otherwise, set it to false."),initialValue:!0},i().createElement(u.WorkflowTypedVariableInput,{types:E})))),i().createElement(m.Row,{gutter:t.marginSM},i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","auth","user"],label:e("User"),initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:b,placeholder:"example@domain.com"}))),i().createElement(m.Col,{span:12},i().createElement(m.Form.Item,{name:["config","provider","auth","pass"],label:e("Password"),initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:v})))))}function I(){var e,t=(0,h.kj)(),r=m.Form.useFormInstance();return(null!=(e=m.Form.useWatch(["config","contentType"],r))?e:s)===d?i().createElement(m.Form.Item,{name:["config","text"],label:t("Content")},i().createElement(u.WorkflowVariableTextArea,{autoSize:{minRows:10},placeholder:"Hi,"})):i().createElement(m.Form.Item,{name:["config","html"],label:t("Content")},i().createElement(u.WorkflowVariableTextArea,{autoSize:{minRows:10},placeholder:"Hi,"}))}function j(){var e=(0,h.kj)();return i().createElement(i().Fragment,null,i().createElement(F,null),i().createElement(m.Form.Item,{name:["config","from"],label:e("From"),rules:[{required:!0}],initialValue:""},i().createElement(u.WorkflowTypedVariableInput,{types:f,placeholder:"noreply <example@domain.com>"})),i().createElement(C,{name:["config","to"],label:e("To"),required:!0}),i().createElement(C,{name:["config","cc"],label:e("CC")}),i().createElement(C,{name:["config","bcc"],label:e("BCC")}),i().createElement(m.Form.Item,{name:["config","subject"],label:e("Subject")},i().createElement(u.WorkflowVariableInput,null)),i().createElement(m.Form.Item,{name:["config","contentType"],label:e("Content type"),initialValue:s},i().createElement(m.Radio.Group,{options:[{label:"HTML",value:s},{label:e("Plain text"),value:d}]})),i().createElement(I,null),i().createElement(x,null),i().createElement(m.Form.Item,{name:["config","ignoreFail"],valuePropName:"checked"},i().createElement(m.Checkbox,null,e("Ignore failed sending and continue workflow"))))}}}]);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Instruction } from '@nocobase/plugin-workflow/client-v2';
10
+ import React from 'react';
11
+ export default class MailerInstruction extends Instruction {
12
+ type: string;
13
+ title: string;
14
+ group: string;
15
+ description: string;
16
+ icon: React.JSX.Element;
17
+ FieldsetLoader: () => Promise<{
18
+ default: typeof import("./components/MailerFieldset").MailerFieldset;
19
+ }>;
20
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare function MailerFieldset(): React.JSX.Element;
11
+ export default MailerFieldset;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { TypedConstantSpec } from '@nocobase/client-v2';
10
+ export declare const CONTENT_TYPE_HTML = "html";
11
+ export declare const CONTENT_TYPE_TEXT = "text";
12
+ export declare const EMAIL_VALUE_TYPES: TypedConstantSpec[];
13
+ export declare const SMTP_HOST_VALUE_TYPES: TypedConstantSpec[];
14
+ export declare const SMTP_USER_VALUE_TYPES: TypedConstantSpec[];
15
+ export declare const SMTP_PASSWORD_VALUE_TYPES: TypedConstantSpec[];
16
+ export declare const SMTP_PORT_VALUE_TYPES: TypedConstantSpec[];
17
+ export declare const SMTP_SECURE_VALUE_TYPES: TypedConstantSpec[];
18
+ type CollectionLike = {
19
+ template?: string;
20
+ options?: {
21
+ template?: string;
22
+ };
23
+ };
24
+ type CollectionManagerLike = {
25
+ getCollection?: (name: string) => CollectionLike | undefined;
26
+ };
27
+ type WorkflowFieldLike = {
28
+ target?: string;
29
+ isForeignKey?: boolean;
30
+ };
31
+ export declare function isFileRecordVariableMatch(field: WorkflowFieldLike, { collectionManager }: {
32
+ collectionManager?: CollectionManagerLike;
33
+ }): boolean;
34
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { default } from './plugin';
10
+ export * from './plugin';
11
+ export { default as MailerInstruction } from './MailerInstruction';