>>=3){case 16:for(i=3+W(e,t),t+=2,p=g[g.length-1];i-- >0;)g.push(p);break;case 17:for(i=3+H(e,t),t+=3;i-- >0;)g.push(0);break;case 18:for(i=11+V(e,t),t+=7;i-- >0;)g.push(0);break;default:g.push(p),l>>0,c=0,f=0;!(1&n);)if(n=H(e,r),r+=3,n>>>1!=0)for(n>>1==1?(c=9,f=5):(r=pe(e,r),c=he,f=ue);;){!t&&o>>1==1?ne[h]:le[h];if(r+=15&u,(u>>>=4)>>>8&255){if(256==u)break;var p=(u-=257)<8?0:u-4>>2;p>5&&(p=0);var d=i+P[u];p>0&&(d+=G(e,r,p),r+=p),h=G(e,r,f),r+=15&(u=n>>>1==1?ae[h]:ce[h]);var m=(u>>>=4)<4?0:u-2>>1,g=R[u];for(m>0&&(g+=G(e,r,m),r+=m),!t&&o>>3]|e[1+(r>>>3)]<<8;if(r+=32,v>0)for(!t&&o0;)a[i++]=e[r>>>3],r+=8}return t?[a,r+7>>>3]:[a.slice(0,i),r+7>>>3]}(e.slice(e.l||0),t);return e.l+=r[1],r[0]}function me(e,t){if(!e)throw new Error(t);"undefined"!=typeof console&&console.error(t)}function ge(e,t){var r=e;Tt(r,0);var n={FileIndex:[],FullPaths:[]};C(n,{root:t.root});for(var a=r.length-4;(80!=r[a]||75!=r[a+1]||5!=r[a+2]||6!=r[a+3])&&a>=0;)--a;r.l=a+4,r.l+=4;var i=r.read_shift(2);r.l+=6;var o=r.read_shift(4);for(r.l=o,a=0;a>>=5);r>>>=4,n.setMilliseconds(0),n.setFullYear(r+1980),n.setMonth(i-1),n.setDate(a);var o=31&t,s=63&(t>>>=5);return t>>>=6,n.setHours(t),n.setMinutes(s),n.setSeconds(o<<1),n}(e);if(8257&i)throw new Error("Unsupported ZIP encryption");e.read_shift(4);for(var l=e.read_shift(4),c=e.read_shift(4),f=e.read_shift(2),h=e.read_shift(2),u="",p=0;p>2,s=(3&n)<<4|(a=e[f++])>>4,l=(15&a)<<2|(i=e[f++])>>6,c=63&i,isNaN(a)?l=c=64:isNaN(i)&&(c=64),r+=t.charAt(o)+t.charAt(s)+t.charAt(l)+t.charAt(c);return r}(new Uint8Array(ne(a)));return chrome.downloads.download({url:l,filename:e,saveAs:!0})}}if("undefined"!=typeof $&&"undefined"!=typeof File&&"undefined"!=typeof Folder)try{var c=File(e);return c.open("w"),c.encoding="binary",Array.isArray(r)&&(r=function(e){if(Array.isArray(e))return e.map((function(e){return String.fromCharCode(e)})).join("");for(var t=[],r=0;r=60&&e<61)return e;var t=new Date;return t.setTime(24*(e>60?e:e+1)*60*60*1e3+se),t}var ue=/^(\d+):(\d+)(:\d+)?(\.\d+)?$/,pe=/^(\d+)-(\d+)-(\d+)$/,de=/^(\d+)-(\d+)-(\d+)[T ](\d+):(\d+)(:\d+)?(\.\d+)?$/;function me(e,t){if(e instanceof Date)return e;var r=e.match(ue);return r?new Date((t?ce:le)+1e3*(60*(60*parseInt(r[1],10)+parseInt(r[2],10))+(r[3]?parseInt(r[3].slice(1),10):0))+(r[4]?parseInt((r[4]+"000").slice(1,4),10):0)):(r=e.match(pe))?new Date(Date.UTC(+r[1],+r[2]-1,+r[3],0,0,0,0)):(r=e.match(de))?new Date(Date.UTC(+r[1],+r[2]-1,+r[3],+r[4],+r[5],r[6]&&parseInt(r[6].slice(1),10)||0,r[7]&&parseInt((r[7]+"0000").slice(1,4),10)||0)):new Date(e)}function ge(e){if("undefined"!=typeof JSON&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if("object"!=typeof e||null==e)return e;if(e instanceof Date)return new Date(e.getTime());var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=ge(e[r]));return t}function ve(e,t){for(var r="";r.length3&&-1==Se.indexOf(t))return i}else if(t.replace(/[ap]m?/,"").match(/[a-z]/))return i;return o<0||o>8099||e.match(/[^-0-9:,\/\\\ ]/)?i:a}function _e(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}function Ae(e,t,r){if(e.FullPaths){var n;if(Array.isArray(r)&&"string"==typeof r[0]&&(r=r.join("")),"string"==typeof r)return n=a?i(r):function(e){for(var t=[],r=0,n=e.length+250,a=s(e.length+255),i=0;i>6&31,a[r++]=128|63&o;else if(o>=55296&&o<57344){o=64+(1023&o);var l=1023&e.charCodeAt(++i);a[r++]=240|o>>8&7,a[r++]=128|o>>2&63,a[r++]=128|l>>6&15|(3&o)<<4,a[r++]=128|63&l}else a[r++]=224|o>>12&15,a[r++]=128|o>>6&63,a[r++]=128|63&o;r>n&&(t.push(a.slice(0,r)),r=0,a=s(65535),n=65530)}return t.push(a.slice(0,r)),h(t)}(r),re.utils.cfb_add(e,t,n);re.utils.cfb_add(e,t,r)}else e.file(t,r)}var Te='\r\n',De=oe({""":'"',"'":"'",">":">","<":"<","&":"&"}),Oe=/[&<>'"]/g,Fe=/[\u0000-\u0008\u000b-\u001f\uFFFE-\uFFFF]/g;function Ee(e){return(e+"").replace(Oe,(function(e){return De[e]})).replace(Fe,(function(e){return"_x"+("000"+e.charCodeAt(0).toString(16)).slice(-4)+"_"}))}var Me=/[\u0000-\u001f]/g;function Ne(e){return(e+"").replace(Oe,(function(e){return De[e]})).replace(/\n/g,"
").replace(Me,(function(e){return""+("000"+e.charCodeAt(0).toString(16)).slice(-4)+";"}))}function Ie(e){for(var t="",r=0,n=0,a=0,i=0,o=0,s=0;r191&&n<224?(o=(31&n)<<6,o|=63&a,t+=String.fromCharCode(o)):(i=e.charCodeAt(r++),n<240?t+=String.fromCharCode((15&n)<<12|(63&a)<<6|63&i):(s=((7&n)<<18|(63&a)<<12|(63&i)<<6|63&(o=e.charCodeAt(r++)))-65536,t+=String.fromCharCode(55296+(s>>>10&1023)),t+=String.fromCharCode(56320+(1023&s)))));return t}function Pe(e){var t,r,n,a=s(2*e.length),i=1,o=0,l=0;for(r=0;r>>10&1023),t=56320+(1023&t)),0!==l&&(a[o++]=255&l,a[o++]=l>>>8,l=0),a[o++]=t%256,a[o++]=t>>>8;return a.slice(0,o).toString("ucs2")}function Re(e){return i(e,"binary").toString("utf8")}var Le="foo bar bazâð£",Ue=a&&(Re(Le)==Ie(Le)&&Re||Pe(Le)==Ie(Le)&&Pe)||Ie,$e=a?function(e){return i(e,"utf8").toString("binary")}:function(e){for(var t=[],r=0,n=0,a=0;r>6))),t.push(String.fromCharCode(128+(63&n)));break;case n>=55296&&n<57344:n-=55296,a=e.charCodeAt(r++)-56320+(n<<10),t.push(String.fromCharCode(240+(a>>18&7))),t.push(String.fromCharCode(144+(a>>12&63))),t.push(String.fromCharCode(128+(a>>6&63))),t.push(String.fromCharCode(128+(63&a)));break;default:t.push(String.fromCharCode(224+(n>>12))),t.push(String.fromCharCode(128+(n>>6&63))),t.push(String.fromCharCode(128+(63&n)))}return t.join("")},ze=function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map((function(e){return[new RegExp("&"+e[0]+";","ig"),e[1]]}));return function(t){for(var r=t.replace(/^[\t\n\r ]+/,"").replace(/(^|[^\t\n\r ])[\t\n\r ]+$/,"$1").replace(/>\s+/g,">").replace(/\b\s+/g,"\n").replace(/<[^<>]*>/g,""),n=0;n"+t+""+e+">"}function We(e){return ie(e).map((function(t){return" "+t+'="'+e[t]+'"'})).join("")}function He(e,t,r){return"<"+e+(null!=r?We(r):"")+(null!=t?(t.match(je)?' xml:space="preserve"':"")+">"+t+""+e:"/")+">"}function Xe(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(e){if(t)throw e}return""}var Ve={CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",CT:"http://schemas.openxmlformats.org/package/2006/content-types",RELS:"http://schemas.openxmlformats.org/package/2006/relationships",TCMNT:"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",mx:"http://schemas.microsoft.com/office/mac/excel/2008/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",sjs:"http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"},Ge=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"],Je={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};var qe=function(e){for(var t=[],r=0;r0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map((function(e){return Buffer.isBuffer(e)?e:i(e)}))):qe(e)}:qe,Ze=function(e,t,r){for(var n=[],a=t;a0?rt(e,t+4,t+4+r-1):""},at=nt,it=function(e,t){var r=bt(e,t);return r>0?rt(e,t+4,t+4+r-1):""},ot=it,st=function(e,t){var r=2*bt(e,t);return r>0?rt(e,t+4,t+4+r-1):""},lt=st,ct=function(e,t){var r=bt(e,t);return r>0?Ke(e,t+4,t+4+r):""},ft=ct,ht=function(e,t){var r=bt(e,t);return r>0?rt(e,t+4,t+4+r):""},ut=ht,pt=function(e,t){return function(e,t){for(var r=1-2*(e[t+7]>>>7),n=((127&e[t+7])<<4)+(e[t+6]>>>4&15),a=15&e[t+6],i=5;i>=0;--i)a=256*a+e[t+i];return 2047==n?0==a?r*(1/0):NaN:(0==n?n=-1022:(n-=1023,a+=Math.pow(2,52)),r*Math.pow(2,n-52)*a)}(e,t)},dt=pt;a&&(at=function(e,t){if(!Buffer.isBuffer(e))return nt(e,t);var r=e.readUInt32LE(t);return r>0?e.toString("utf8",t+4,t+4+r-1):""},ot=function(e,t){if(!Buffer.isBuffer(e))return it(e,t);var r=e.readUInt32LE(t);return r>0?e.toString("utf8",t+4,t+4+r-1):""},lt=function(e,t){if(!Buffer.isBuffer(e)||!o)return st(e,t);var r=2*e.readUInt32LE(t);return e.toString("utf16le",t+4,t+4+r-1)},ft=function(e,t){if(!Buffer.isBuffer(e)||!o)return ct(e,t);var r=e.readUInt32LE(t);return e.toString("utf16le",t+4,t+4+r)},ut=function(e,t){if(!Buffer.isBuffer(e))return ht(e,t);var r=e.readUInt32LE(t);return e.toString("utf8",t+4,t+4+r)},dt=function(e,t){return Buffer.isBuffer(e)?e.readDoubleLE(t):pt(e,t)});var mt=function(e,t){return e[t]},gt=function(e,t){return 256*e[t+1]+e[t]},vt=function(e,t){var r=256*e[t+1]+e[t];return r<32768?r:-1*(65535-r+1)},bt=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},xt=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},wt=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function yt(t,r){var n,i,s,l,c,f,h="",u=[];switch(r){case"dbcs":if(f=this.l,a&&Buffer.isBuffer(this)&&o)h=this.slice(this.l,this.l+2*t).toString("utf16le");else for(c=0;c0?xt:wt)(this,this.l),this.l+=4,n);case 8:case-8:if("f"===r)return i=8==t?dt(this,this.l):dt([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,i;t=8;case 16:h=et(this,this.l,t)}}return this.l+=t,h}var Ct=function(e,t,r){e[r]=255&t,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24&255},St=function(e,t,r){e[r]=255&t,e[r+1]=t>>8&255,e[r+2]=t>>16&255,e[r+3]=t>>24&255},kt=function(e,t,r){e[r]=255&t,e[r+1]=t>>>8&255};function _t(e,t,r){var n=0,a=0;if("dbcs"===r){for(a=0;a!=t.length;++a)kt(this,t.charCodeAt(a),this.l+2*a);n=2*t.length}else if("sbcs"===r||"cpstr"==r){for(t=t.replace(/[^\x00-\x7F]/g,"_"),a=0;a!=t.length;++a)this[this.l+a]=255&t.charCodeAt(a);n=t.length}else{if("hex"===r){for(;a>8}for(;this.l>>=8,this[this.l+1]=255&t;break;case 3:n=3,this[this.l]=255&t,t>>>=8,this[this.l+1]=255&t,t>>>=8,this[this.l+2]=255&t;break;case 4:n=4,Ct(this,t,this.l);break;case 8:if(n=8,"f"===r){!function(e,t,r){var n=(t<0||1/t==-1/0?1:0)<<7,a=0,i=0,o=n?-t:t;isFinite(o)?0==o?a=i=0:(a=Math.floor(Math.log(o)/Math.LN2),i=o*Math.pow(2,52-a),a<=-1023&&(!isFinite(i)||i>4|n}(this,t,this.l);break}case 16:break;case-4:n=4,St(this,t,this.l)}}return this.l+=n,this}function At(e,t){var r=et(this,this.l,e.length>>1);if(r!==e)throw new Error(t+"Expected "+e+" saw "+r);this.l+=e.length>>1}function Tt(e,t){e.l=t,e.read_shift=yt,e.chk=At,e.write_shift=_t}function Dt(e){var t=s(e);return Tt(t,0),t}function Ot(e){return""+(e+1)}function Ft(e){if(e<0)throw new Error("invalid column "+e);var t="";for(++e;e;e=Math.floor((e-1)/26))t=String.fromCharCode((e-1)%26+65)+t;return t}function Et(e){for(var t=0,r=0,n=0;n=48&&a<=57?t=10*t+(a-48):a>=65&&a<=90&&(r=26*r+(a-64))}return{c:r-1,r:t-1}}function Mt(e){for(var t=e.c+1,r="";t;t=(t-1)/26|0)r=String.fromCharCode((t-1)%26+65)+r;return r+(e.r+1)}function Nt(e){var t=e.indexOf(":");return-1==t?{s:Et(e),e:Et(e)}:{s:Et(e.slice(0,t)),e:Et(e.slice(t+1))}}function It(e,t){return void 0===t||"number"==typeof t?It(e.s,e.e):("string"!=typeof e&&(e=Mt(e)),"string"!=typeof t&&(t=Mt(t)),e==t?e:e+":"+t)}function Pt(e){var t=Nt(e);return"$"+Ft(t.s.c)+"$"+Ot(t.s.r)+":$"+Ft(t.e.c)+"$"+Ot(t.e.r)}function Rt(e,t){if(!(e||t&&t.biff<=5&&t.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e.replace(/'/g,"''")+"'":e}function Lt(e){var t={s:{c:0,r:0},e:{c:0,r:0}},r=0,n=0,a=0,i=e.length;for(r=0;n26);++n)r=26*r+a;for(t.s.c=--r,r=0;n9);++n)r=10*r+a;if(t.s.r=--r,n===i||10!=a)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++n,r=0;n!=i&&!((a=e.charCodeAt(n)-64)<1||a>26);++n)r=26*r+a;for(t.e.c=--r,r=0;n!=i&&!((a=e.charCodeAt(n)-48)<0||a>9);++n)r=10*r+a;return t.e.r=--r,t}function Ut(e,t){var r="d"==e.t&&t instanceof Date;if(null!=e.z)try{return e.w=K(e.z,r?fe(t):t)}catch(e){}try{return e.w=K((e.XF||{}).numFmtId||(r?14:0),r?fe(t):t)}catch(e){return""+t}}function $t(e,t,r){return null==e||null==e.t||"z"==e.t?"":void 0!==e.w?e.w:("d"==e.t&&!e.z&&r&&r.dateNF&&(e.z=r.dateNF),"e"==e.t?jt[e.v]||e.v:Ut(e,null==t?e.v:t))}function zt(e,t,r){var n=r||{},a=e?null!=e["!data"]:n.dense,i=e||(a?{"!data":[]}:{});a&&!i["!data"]&&(i["!data"]=[]);var o=0,s=0;if(i&&null!=n.origin)if("number"==typeof n.origin)o=n.origin;else{var l="string"==typeof n.origin?Et(n.origin):n.origin;o=l.r,s=l.c}var c={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(i["!ref"]){var f=Lt(i["!ref"]);c.s.c=f.s.c,c.s.r=f.s.r,c.e.c=Math.max(c.e.c,f.e.c),c.e.r=Math.max(c.e.r,f.e.r),-1==o&&(c.e.r=o=i["!ref"]?f.e.r+1:0)}else c.s.c=c.e.c=c.s.r=c.e.r=0;for(var h=[],u=!1,p=0;p!=t.length;++p)if(t[p]){if(!Array.isArray(t[p]))throw new Error("aoa_to_sheet expects an array of arrays");var d=o+p;a&&(i["!data"][d]||(i["!data"][d]=[]),h=i["!data"][d]);for(var m=t[p],g=0;g!=m.length;++g)if(void 0!==m[g]){var v={v:m[g],t:""},b=s+g;if(c.s.r>d&&(c.s.r=d),c.s.c>b&&(c.s.c=b),c.e.r0&&(n=e[r][0],i[i.length]=He("Override",null,{PartName:("/"==n[0]?"":"/")+n,ContentType:Ht[r][t.bookType]||Ht[r].xlsx}))},s=function(r){(e[r]||[]).forEach((function(e){i[i.length]=He("Override",null,{PartName:("/"==e[0]?"":"/")+e,ContentType:Ht[r][t.bookType]||Ht[r].xlsx})}))},l=function(t){(e[t]||[]).forEach((function(e){i[i.length]=He("Override",null,{PartName:("/"==e[0]?"":"/")+e,ContentType:a[t][0]})}))};return o("workbooks"),s("sheets"),s("charts"),l("themes"),["strs","styles"].forEach(o),["coreprops","extprops","custprops"].forEach(l),l("vba"),l("comments"),l("threadedcomments"),l("drawings"),s("metadata"),l("people"),!r&&i.length>2&&(i[i.length]="",i[1]=i[1].replace("/>",">")),i.join("")}var Vt={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",XMISS:"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",XLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",CXML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",CXMLP:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",CMNT:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",SST:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",STY:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",THEME:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",CHART:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",CHARTEX:"http://schemas.microsoft.com/office/2014/relationships/chartEx",CS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",MS:"http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet",IMG:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",DRAW:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",XLMETA:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",TCMNT:"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",PEOPLE:"http://schemas.microsoft.com/office/2017/10/relationships/person",CONN:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function Gt(e){var t=[Te,He("Relationships",null,{xmlns:Ve.RELS})];return ie(e["!id"]).forEach((function(r){t[t.length]=He("Relationship",null,e["!id"][r])})),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}function Jt(e,t,r,n,a,i){if(a||(a={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),t<0)for(t=e["!idx"];e["!id"]["rId"+t];++t);if(e["!idx"]=t+1,a.Id="rId"+t,a.Type=n,a.Target=r,i?a.TargetMode=i:[Vt.HLINK,Vt.XPATH,Vt.XMISS].indexOf(a.Type)>-1&&(a.TargetMode="External"),e["!id"][a.Id])throw new Error("Cannot rewrite rId "+t);return e["!id"][a.Id]=a,e[("/"+a.Target).replace("//","/")]=a,t}var qt=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];function Yt(e,t,r,n,a){null==a[e]&&null!=t&&""!==t&&(a[e]=t,t=Ee(t),n[n.length]=r?He(e,t,r):Be(e,t))}var Zt=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]];function Kt(e){var t=[Te,He("Properties",null,{xmlns:Ve.CUST_PROPS,"xmlns:vt":Ve.vt})];if(!e)return t.join("");var r=1;return ie(e).forEach((function(n){++r,t[t.length]=He("property",function(e,t){switch(typeof e){case"string":var r=He("vt:lpwstr",Ee(e));return t&&(r=r.replace(/"/g,"_x0022_")),r;case"number":return He((0|e)==e?"vt:i4":"vt:r8",Ee(String(e)));case"boolean":return He("vt:bool",e?"true":"false")}if(e instanceof Date)return He("vt:filetime",Xe(e));throw new Error("Unable to serialize "+e)}(e[n],!0),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:r,name:Ee(n)})})),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}var Qt=/^\s|\s$|[\t\n\r]/;var er=6;var tr=96;function rr(e){return 96*e/tr}function nr(e,t){var r,n=[Te,He("styleSheet",null,{xmlns:Ge[0],"xmlns:vt":Ve.vt})];return e.SSF&&null!=(r=function(e){var t=[""];return[[5,8],[23,26],[41,44],[50,392]].forEach((function(r){for(var n=r[0];n<=r[1];++n)null!=e[n]&&(t[t.length]=He("numFmt",null,{numFmtId:n,formatCode:Ee(e[n])}))})),1===t.length?"":(t[t.length]="",t[0]=He("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}(e.SSF))&&(n[n.length]=r),n[n.length]='',n[n.length]='',n[n.length]='',n[n.length]='',(r=function(e){var t=[];return t[t.length]=He("cellXfs",null),e.forEach((function(e){t[t.length]=He("xf",null,e)})),t[t.length]="",2===t.length?"":(t[0]=He("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}(t.cellXfs))&&(n[n.length]=r),n[n.length]='',n[n.length]='',n[n.length]='',n.length>2&&(n[n.length]="",n[1]=n[1].replace("/>",">")),n.join("")}function ar(e,t,r){var n=[21600,21600],a=["m0,0l0",n[1],n[0],n[1],n[0],"0xe"].join(","),i=[He("xml",null,{"xmlns:v":Je.v,"xmlns:o":Je.o,"xmlns:x":Je.x,"xmlns:mv":Je.mv}).replace(/\/>/,">"),He("o:shapelayout",He("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"})],o=65536*e,s=t||[];return s.length>0&&i.push(He("v:shapetype",[He("v:stroke",null,{joinstyle:"miter"}),He("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202",coordsize:n.join(","),"o:spt":202,path:a})),s.forEach((function(e){++o,i.push(function(e,t,r){var n=Et(e[0]),a={color2:"#BEFF82",type:"gradient"};"gradient"==a.type&&(a.angle="-180");var i="gradient"==a.type?He("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,o=He("v:fill",i,a),s={on:"t",obscured:"t"};return["",o,He("v:shadow",null,s),He("v:path",null,{"o:connecttype":"none"}),'','',"","",Be("x:Anchor",[n.c+1,0,n.r+1,0,n.c+3,20,n.r+5,20].join(",")),Be("x:AutoFill","False"),Be("x:Row",String(n.r)),Be("x:Column",String(n.c)),e[1].hidden?"":"","",""].join("")}(e,o))})),i.push(""),i.join("")}function ir(e){var t=[Te,He("comments",null,{xmlns:Ge[0]})],r=[];return t.push(""),e.forEach((function(e){e[1].forEach((function(e){var n=Ee(e.a);-1==r.indexOf(n)&&(r.push(n),t.push(""+n+"")),e.T&&e.ID&&-1==r.indexOf("tc="+e.ID)&&(r.push("tc="+e.ID),t.push("tc="+e.ID+""))}))})),0==r.length&&(r.push("SheetJ5"),t.push("SheetJ5")),t.push(""),t.push(""),e.forEach((function(e){var n=0,a=[],i=0;if(e[1][0]&&e[1][0].T&&e[1][0].ID&&(n=r.indexOf("tc="+e[1][0].ID)),e[1].forEach((function(e){e.a&&(n=r.indexOf(Ee(e.a))),e.T&&++i,a.push(null==e.t?"":Ee(e.t))})),0===i)e[1].forEach((function(n){t.push(''),t.push(Be("t",null==n.t?"":Ee(n.t))),t.push("")}));else{e[1][0]&&e[1][0].T&&e[1][0].ID&&(n=r.indexOf("tc="+e[1][0].ID)),t.push('');for(var o="Comment:\n "+a[0]+"\n",s=1;s")}})),t.push(""),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}function or(e,t,r){var n=[Te,He("ThreadedComments",null,{xmlns:Ve.TCMNT}).replace(/[\/]>/,">")];return e.forEach((function(e){var a="";(e[1]||[]).forEach((function(i,o){if(i.T){i.a&&-1==t.indexOf(i.a)&&t.push(i.a);var s={ref:e[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+r.tcid++).slice(-12)+"}"};0==o?a=s.id:s.parentId=a,i.ID=s.id,i.a&&(s.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(i.a)).slice(-12)+"}"),n.push(He("threadedComment",Be("text",i.t||""),s))}else delete i.ID}))})),n.push(""),n.join("")}var sr=["xlsb","xlsm","xlam","biff8","xla"];try{/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g}catch(e){}var lr="undefined"!=typeof Map;function cr(e,t){var r,n,a={min:e+1,max:e+1},i=-1;return t.MDW&&(er=t.MDW),null!=t.width?a.customWidth=1:null!=t.wpx?(r=t.wpx,i=Math.floor((r-5)/er*100+.5)/100):null!=t.wch&&(i=t.wch),i>-1?(a.width=(n=i,Math.round((n*er+5)/er*256)/256),a.customWidth=1):null!=t.width&&(a.width=t.width),t.hidden&&(a.hidden=!0),null!=t.level&&(a.outlineLevel=a.level=t.level),a}function fr(e,t,r){var n,a,i=r.revssf[null!=t.z?t.z:"General"],o=60,s=e.length;if(null==i&&r.ssf)for(;o<392;++o)if(null==r.ssf[o]){n=t.z,a=o,Q(ee[n]||n,a),r.ssf[o]=t.z,r.revssf[t.z]=i=o;break}for(o=0;o!=s;++o)if(e[o].numFmtId===i)return o;return e[s]={numFmtId:i,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},s}function hr(e,t,r){if(e&&e["!ref"]){var n=Lt(e["!ref"]);if(n.e.c=0;--r)n=((16384&n?1:0)|n<<1&32767)^t[r];return 52811^n}(e.password).toString(16).toUpperCase()),He("sheetProtection",null,t)}function mr(e,t,r,n,a,i,o){if(e.c&&r["!comments"].push([t,e.c]),(void 0===e.v||"z"===e.t&&!(n||{}).sheetStubs)&&"string"!=typeof e.f&&void 0===e.z)return"";var s="",l=e.t,c=e.v;if("z"!==e.t)switch(e.t){case"b":s=e.v?"1":"0";break;case"n":isNaN(e.v)?(e.t="e",s=jt[e.v=36]):isFinite(e.v)?s=""+e.v:(e.t="e",s=jt[e.v=7]);break;case"e":s=jt[e.v];break;case"d":if(n&&n.cellDates){var f=me(e.v,o);s=f.toISOString(),f.getUTCFullYear()<1900&&(s=s.slice(s.indexOf("T")+1).replace("Z",""))}else(e=ge(e)).t="n",s=""+(e.v=fe(me(e.v,o),o));void 0===e.z&&(e.z=S[14]);break;default:s=e.v}var h="z"==e.t||null==e.v?"":Be("v",Ee(s)),u={r:t},p=fr(n.cellXfs,e,n);switch(0!==p&&(u.s=p),e.t){case"n":case"z":break;case"d":u.t="d";break;case"b":u.t="b";break;case"e":u.t="e";break;default:if(null==e.v){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(n&&n.bookSST){h=Be("v",""+function(e,t,r){var n=0,a=e.length;if(r){if(lr?r.has(t):Object.prototype.hasOwnProperty.call(r,t))for(var i=lr?r.get(t):r[t];n16383||f.e.r>1048575){if(t.WTF)throw new Error("Range "+c+" exceeds format limit A1:XFD1048576");f.e.c=Math.min(f.e.c,16383),f.e.r=Math.min(f.e.c,1048575),c=It(f)}n||(n={}),l["!comments"]=[];var h=[];!function(e,t,r,n,a){var i=!1,o={},s=null;if("xlsx"!==n.bookType&&t.vbaraw){var l=t.SheetNames[r];try{t.Workbook&&(l=t.Workbook.Sheets[r].CodeName||l)}catch(e){}i=!0,o.codeName=$e(Ee(l))}if(e&&e["!outline"]){var c={summaryBelow:1,summaryRight:1};e["!outline"].above&&(c.summaryBelow=0),e["!outline"].left&&(c.summaryRight=0),s=(s||"")+He("outlinePr",null,c)}(i||s)&&(a[a.length]=He("sheetPr",s,o))}(l,r,e,t,i),i[i.length]=He("dimension",null,{ref:c}),i[i.length]=function(e,t,r,n){var a={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(a.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),He("sheetViews",He("sheetView",null,a),{})}(0,0,0,r),t.sheetFormat&&(i[i.length]=He("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),null!=l["!cols"]&&l["!cols"].length>0&&(i[i.length]=function(e,t){for(var r,n=[""],a=0;a!=t.length;++a)(r=t[a])&&(n[n.length]=He("col",null,cr(a,r)));return n[n.length]="",n.join("")}(0,l["!cols"])),i[a=i.length]="",l["!links"]=[],null!=l["!ref"]&&(s=function(e,t,r,n){var a,i,o=[],s=[],l=Lt(e["!ref"]),c="",f="",h=[],u=0,p=0,d=e["!rows"],m=null!=e["!data"],g=m?e["!data"]:[],v={r:f},b=-1,x=(((n||{}).Workbook||{}).WBProps||{}).date1904;for(p=l.s.c;p<=l.e.c;++p)h[p]=Ft(p);for(u=l.s.r;u<=l.e.r;++u){s=[],f=Ot(u);var w=m?g[u]:[];for(p=l.s.c;p<=l.e.c;++p){a=h[p]+f;var y=m?w[p]:e[a];void 0!==y&&null!=(c=mr(y,a,e,t,0,0,x))&&s.push(c)}(s.length>0||d&&d[u])&&(v={r:f},d&&d[u]&&((i=d[u]).hidden&&(v.hidden=1),b=-1,i.hpx?b=rr(i.hpx):i.hpt&&(b=i.hpt),b>-1&&(v.ht=b,v.customHeight=1),i.level&&(v.outlineLevel=i.level)),o[o.length]=He("row",s.join(""),v))}if(d)for(;u-1&&(v.ht=b,v.customHeight=1),i.level&&(v.outlineLevel=i.level),o[o.length]=He("row","",v));return o.join("")}(l,t,0,r),s.length>0&&(i[i.length]=s)),i.length>a+1&&(i[i.length]="",i[a]=i[a].replace("/>",">")),l["!protect"]&&(i[i.length]=dr(l["!protect"])),null!=l["!autofilter"]&&(i[i.length]=function(e,t,r,n){var a="string"==typeof e.ref?e.ref:It(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var i=r.Workbook.Names,o=Nt(a);o.s.r==o.e.r&&(o.e.r=Nt(t["!ref"]).e.r,a=It(o));for(var s=0;s0&&(i[i.length]=function(e){if(0===e.length)return"";for(var t='',r=0;r!=e.length;++r)t+='';return t+""}(l["!merges"]));var u,p,d=-1,m=-1;return l["!links"].length>0&&(i[i.length]="",l["!links"].forEach((function(e){e[1].Target&&(u={ref:e[0]},"#"!=e[1].Target.charAt(0)&&(m=Jt(n,-1,Ee(e[1].Target).replace(/#[\s\S]*$/,""),Vt.HLINK),u["r:id"]="rId"+m),(d=e[1].Target.indexOf("#"))>-1&&(u.location=Ee(e[1].Target.slice(d+1))),e[1].Tooltip&&(u.tooltip=Ee(e[1].Tooltip)),u.display=e[1].display,i[i.length]=He("hyperlink",null,u))})),i[i.length]=""),delete l["!links"],null!=l["!margins"]&&(i[i.length]=(function(e,t){if(e){var r=[.7,.7,.75,.75,.3,.3];null==e.left&&(e.left=r[0]),null==e.right&&(e.right=r[1]),null==e.top&&(e.top=r[2]),null==e.bottom&&(e.bottom=r[3]),null==e.header&&(e.header=r[4]),null==e.footer&&(e.footer=r[5])}}(p=l["!margins"]),He("pageMargins",null,p))),t&&!t.ignoreEC&&null!=t.ignoreEC||(i[i.length]=Be("ignoredErrors",He("ignoredError",null,{numberStoredAsText:1,sqref:c}))),h.length>0&&(m=Jt(n,-1,"../drawings/drawing"+(e+1)+".xml",Vt.DRAW),i[i.length]=He("drawing",null,{"r:id":"rId"+m}),l["!drawing"]=h),l["!comments"].length>0&&(m=Jt(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",Vt.VML),i[i.length]=He("legacyDrawing",null,{"r:id":"rId"+m}),l["!legacy"]=m),i.length>1&&(i[i.length]="",i[1]=i[1].replace("/>",">")),i.join("")}var vr=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]],br=":][*?/\\".split("");function xr(e,t){try{if(""==e)throw new Error("Sheet name cannot be blank");if(e.length>31)throw new Error("Sheet name cannot exceed 31 chars");if(39==e.charCodeAt(0)||39==e.charCodeAt(e.length-1))throw new Error("Sheet name cannot start or end with apostrophe (')");if("history"==e.toLowerCase())throw new Error("Sheet name cannot be 'History'");br.forEach((function(t){if(-1!=e.indexOf(t))throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}))}catch(e){if(t)return!1;throw e}return!0}function wr(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var t,r,n,a=e.Workbook&&e.Workbook.Sheets||[];t=e.SheetNames,r=a,n=!!e.vbaraw,t.forEach((function(e,a){xr(e);for(var i=0;i22)throw new Error("Bad Code Name: Worksheet"+o)}}));for(var i=0;ir||a[h].s.c>l||a[h].e.r1&&(o.rowspan=c),f>1&&(o.colspan=f),n.editable?d=''+d+"":p&&(o["data-t"]=p&&p.t||"z",null!=p.v&&(o["data-v"]=Ne(p.v instanceof Date?p.v.toISOString():p.v)),null!=p.z&&(o["data-z"]=p.z),p.l&&"#"!=(p.l.Target||"#").charAt(0)&&(d=''+d+"")),o.id=(n.id||"sjs")+"-"+u,i.push(He("td",d,o))}}return""+i.join("")+"
"}function Cr(e,t,r){var n=t.rows;if(!n)throw"Unsupported origin when "+t.tagName+" is not a TABLE";var a=r||{},i=null!=e["!data"],o=0,s=0;if(null!=a.origin)if("number"==typeof a.origin)o=a.origin;else{var l="string"==typeof a.origin?Et(a.origin):a.origin;o=l.r,s=l.c}var c=Math.min(a.sheetRows||1e7,n.length),f={s:{r:0,c:0},e:{r:o,c:s}};if(e["!ref"]){var h=Nt(e["!ref"]);f.s.r=Math.min(f.s.r,h.s.r),f.s.c=Math.min(f.s.c,h.s.c),f.e.r=Math.max(f.e.r,h.e.r),f.e.c=Math.max(f.e.c,h.e.c),-1==o&&(f.e.r=o=h.e.r+1)}var u=[],p=0,d=e["!rows"]||(e["!rows"]=[]),m=0,g=0,v=0,b=0,x=0,w=0;for(e["!cols"]||(e["!cols"]=[]);m1||w>1)&&u.push({s:{r:g+o,c:b+s},e:{r:g+o+(x||1)-1,c:b+s+(w||1)-1}});var D={t:"s",v:_},O=k.getAttribute("data-t")||k.getAttribute("t")||"";null!=_&&(0==_.length?D.t=O||"z":a.raw||0==_.trim().length||"s"==O||("e"==O&&jt[+_]?D={t:"e",v:+_,w:jt[+_]}:"TRUE"===_?D={t:"b",v:!0}:"FALSE"===_?D={t:"b",v:!1}:isNaN(be(_))?isNaN(ke(_).getDate())?35==_.charCodeAt(0)&&null!=Bt[_]&&(D={t:"e",v:Bt[_],w:_}):(D={t:"d",v:me(_)},a.UTC&&(D.v=_e(D.v)),a.cellDates||(D={t:"n",v:fe(D.v)}),D.z=a.dateNF||S[14]):D={t:"n",v:be(_)})),void 0===D.z&&null!=A&&(D.z=A);var F="",E=k.getElementsByTagName("A");if(E&&E.length)for(var M=0;M=c&&(e["!fullref"]=It((f.e.r=n.length-m+g-1+o,f))),e}function Sr(e,t){var r={};return(t||{}).dense&&(r["!data"]=[]),Cr(r,e,t)}function kr(e){var t="",r=function(e){return e.ownerDocument.defaultView&&"function"==typeof e.ownerDocument.defaultView.getComputedStyle?e.ownerDocument.defaultView.getComputedStyle:"function"==typeof getComputedStyle?getComputedStyle:null}
+/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),"none"===t}function _r(e){var t;(t=[["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]],function(e){for(var r=0;r!=t.length;++r){var n=t[r];void 0===e[n[0]]&&(e[n[0]]=n[1]),"n"===n[2]&&(e[n[0]]=Number(e[n[0]]))}})(e)}function Ar(e,t){var r;e&&!e.SSF&&(e.SSF=ge(S)),e&&e.SSF&&(r||(r={}),r[0]="General",r[1]="0",r[2]="0.00",r[3]="#,##0",r[4]="#,##0.00",r[9]="0%",r[10]="0.00%",r[11]="0.00E+00",r[12]="# ?/?",r[13]="# ??/??",r[14]="m/d/yy",r[15]="d-mmm-yy",r[16]="d-mmm",r[17]="mmm-yy",r[18]="h:mm AM/PM",r[19]="h:mm:ss AM/PM",r[20]="h:mm",r[21]="h:mm:ss",r[22]="m/d/yy h:mm",r[37]="#,##0 ;(#,##0)",r[38]="#,##0 ;[Red](#,##0)",r[39]="#,##0.00;(#,##0.00)",r[40]="#,##0.00;[Red](#,##0.00)",r[45]="mm:ss",r[46]="[h]:mm:ss",r[47]="mmss.0",r[48]="##0.0E+0",r[49]="@",r[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',S=r,function(e){for(var t=0;392!=t;++t)void 0!==e[t]&&Q(e[t],t)}(e.SSF),t.revssf=function(e){for(var t=[],r=ie(e),n=0;n!==r.length;++n)t[e[r[n]]]=parseInt(r[n],10);return t}(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,lr?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var n="xml",a=sr.indexOf(t.bookType)>-1,i={workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""};_r(t=t||{});var o,s,l,c=re.utils.cfb_new(),f="",h=0;if(t.cellXfs=[],fr(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),Ae(c,f="docProps/core.xml",function(e,t){var r=t||{},n=[Te,He("cp:coreProperties",null,{"xmlns:cp":Ve.CORE_PROPS,"xmlns:dc":Ve.dc,"xmlns:dcterms":Ve.dcterms,"xmlns:dcmitype":Ve.dcmitype,"xmlns:xsi":Ve.xsi})],a={};if(!e&&!r.Props)return n.join("");e&&(null!=e.CreatedDate&&Yt("dcterms:created","string"==typeof e.CreatedDate?e.CreatedDate:Xe(e.CreatedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a),null!=e.ModifiedDate&&Yt("dcterms:modified","string"==typeof e.ModifiedDate?e.ModifiedDate:Xe(e.ModifiedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a));for(var i=0;i!=qt.length;++i){var o=qt[i],s=r.Props&&null!=r.Props[o[1]]?r.Props[o[1]]:e?e[o[1]]:null;!0===s?s="1":!1===s?s="0":"number"==typeof s&&(s=String(s)),null!=s&&Yt(o[0],s,null,n,a)}return n.length>2&&(n[n.length]="",n[1]=n[1].replace("/>",">")),n.join("")}(e.Props,t)),i.coreprops.push(f),Jt(t.rels,2,f,Vt.CORE_PROPS),f="docProps/app.xml",e.Props&&e.Props.SheetNames);else if(e.Workbook&&e.Workbook.Sheets){for(var u=[],p=0;pWorksheets")+l("vt:variant",l("vt:i4",String(o.Worksheets))),{size:2,baseType:"variant"})),s[s.length]=l("TitlesOfParts",l("vt:vector",o.SheetNames.map((function(e){return""+Ee(e)+""})).join(""),{size:o.Worksheets,baseType:"lpstr"})),s.length>2&&(s[s.length]="",s[1]=s[1].replace("/>",">")),s.join(""))),i.extprops.push(f),Jt(t.rels,3,f,Vt.EXT_PROPS),e.Custprops!==e.Props&&ie(e.Custprops||{}).length>0&&(Ae(c,f="docProps/custom.xml",Kt(e.Custprops)),i.custprops.push(f),Jt(t.rels,4,f,Vt.CUST_PROPS));var d,m,g=["SheetJ5"];for(t.tcid=0,h=1;h<=e.SheetNames.length;++h){var v={"!id":{}},b=e.Sheets[e.SheetNames[h-1]];(b||{})["!type"];if(Ae(c,f="xl/worksheets/sheet"+h+"."+n,gr(h-1,t,e,v)),i.sheets.push(f),Jt(t.wbrels,-1,"worksheets/sheet"+h+"."+n,Vt.WS[0]),b){var x=b["!comments"],w=!1,y="";if(x&&x.length>0){var C=!1;x.forEach((function(e){e[1].forEach((function(e){1==e.T&&(C=!0)}))})),C&&(Ae(c,y="xl/threadedComments/threadedComment"+h+".xml",or(x,g,t)),i.threadedcomments.push(y),Jt(v,-1,"../threadedComments/threadedComment"+h+".xml",Vt.TCMNT)),Ae(c,y="xl/comments"+h+"."+n,ir(x)),i.comments.push(y),Jt(v,-1,"../comments"+h+"."+n,Vt.CMNT),w=!0}b["!legacy"]&&w&&Ae(c,"xl/drawings/vmlDrawing"+h+".vml",ar(h,b["!comments"])),delete b["!comments"],delete b["!legacy"]}v["!id"].rId1&&Ae(c,(m=void 0,m=(d=f).lastIndexOf("/"),d.slice(0,m+1)+"_rels/"+d.slice(m+1)+".rels"),Gt(v))}return null!=t.Strings&&t.Strings.length>0&&(Ae(c,f="xl/sharedStrings."+n,function(e,t){if(!t.bookSST)return"";var r=[Te];r[r.length]=He("sst",null,{xmlns:Ge[0],count:e.Count,uniqueCount:e.Unique});for(var n=0;n!=e.length;++n)if(null!=e[n]){var a=e[n],i="";a.r?i+=a.r:(i+=""+Ee(a.t)+""),i+="",r[r.length]=i}return r.length>2&&(r[r.length]="",r[1]=r[1].replace("/>",">")),r.join("")}(t.Strings,t)),i.strs.push(f),Jt(t.wbrels,-1,"sharedStrings."+n,Vt.SST)),Ae(c,f="xl/workbook."+n,function(e){var t=[Te];t[t.length]=He("workbook",null,{xmlns:Ge[0],"xmlns:r":Ve.r});var r=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(vr.forEach((function(t){null!=e.Workbook.WBProps[t[0]]&&e.Workbook.WBProps[t[0]]!=t[1]&&(n[t[0]]=e.Workbook.WBProps[t[0]])})),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),t[t.length]=He("workbookPr",null,n);var a=e.Workbook&&e.Workbook.Sheets||[],i=0;if(a&&a[0]&&a[0].Hidden){for(t[t.length]="",i=0;i!=e.SheetNames.length&&a[i]&&a[i].Hidden;++i);i==e.SheetNames.length&&(i=0),t[t.length]='',t[t.length]=""}for(t[t.length]="",i=0;i!=e.SheetNames.length;++i){var o={name:Ee(e.SheetNames[i].slice(0,31))};if(o.sheetId=""+(i+1),o["r:id"]="rId"+(i+1),a[i])switch(a[i].Hidden){case 1:o.state="hidden";break;case 2:o.state="veryHidden"}t[t.length]=He("sheet",null,o)}return t[t.length]="",r&&(t[t.length]="",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach((function(e){var r={name:e.Name};e.Comment&&(r.comment=e.Comment),null!=e.Sheet&&(r.localSheetId=""+e.Sheet),e.Hidden&&(r.hidden="1"),e.Ref&&(t[t.length]=He("definedName",Ee(e.Ref),r))})),t[t.length]=""),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}(e)),i.workbooks.push(f),Jt(t.rels,1,f,Vt.WB),Ae(c,f="xl/theme/theme1.xml",function(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&"string"==typeof e.raw)return e.raw;var r=[Te];return r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]='',r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]='',r[r.length]="",r[r.length]="",r[r.length]="",r[r.length]="",r.join("")}(e.Themes,t)),i.themes.push(f),Jt(t.wbrels,-1,"theme/theme1.xml",Vt.THEME),Ae(c,f="xl/styles."+n,nr(e,t)),i.styles.push(f),Jt(t.wbrels,-1,"styles."+n,Vt.STY),e.vbaraw&&a&&(Ae(c,f="xl/vbaProject.bin",e.vbaraw),i.vba.push(f),Jt(t.wbrels,-1,"vbaProject.bin",Vt.VBA)),Ae(c,f="xl/metadata."+n,function(){var e=[Te];return e.push('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n'),e.join("")}()),i.metadata.push(f),Jt(t.wbrels,-1,"metadata."+n,Vt.XLMETA),g.length>1&&(Ae(c,f="xl/persons/person.xml",function(e){var t=[Te,He("personList",null,{xmlns:Ve.TCMNT,"xmlns:x":Ge[0]}).replace(/[\/]>/,">")];return e.forEach((function(e,r){t.push(He("person",null,{displayName:e,id:"{54EE7950-7262-4200-6969-"+("000000000000"+r).slice(-12)+"}",userId:e,providerId:"None"}))})),t.push(""),t.join("")}(g)),i.people.push(f),Jt(t.wbrels,-1,"persons/person.xml",Vt.PEOPLE)),Ae(c,"[Content_Types].xml",Xt(i,t)),Ae(c,"_rels/.rels",Gt(t.rels)),Ae(c,"xl/_rels/workbook.xml.rels",Gt(t.wbrels)),delete t.revssf,delete t.ssf,c}function Tr(e,t){var r=ge(t||{});return function(e,t){var r={},n=a?"nodebuffer":"undefined"!=typeof Uint8Array?"array":"string";t.compression&&(r.compression="DEFLATE");if(t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?re.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if("undefined"!=typeof Deno&&"string"==typeof i){if("binary"==t.type||"base64"==t.type)return i;i=new Uint8Array(f(i))}return t.password&&"undefined"!=typeof encrypt_agile?function(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return ae(t.file,re.write(e,{type:a?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return re.write(e,t)}(encrypt_agile(i,t.password),t):"file"===t.type?ae(t.file,i):"string"==t.type?Ue(i):i}(Ar(e,r),r)}function Dr(e,t){wr(e);var r=ge(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),"array"==r.type){r.type="binary";var n=Dr(e,r);return r.type="array",f(n)}return Tr(e,r)}function Or(e,t,r){var n=r||{};return n.type="file",n.file=t,function(e){if(!e.bookType){var t=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();t.match(/^\.[a-z]+$/)&&(e.bookType=t.slice(1)),e.bookType={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"}[e.bookType]||e.bookType}}(n),Dr(e,n)}function Fr(e,t,r,n,a,i,o){var s,l=Ot(r),c=o.defval,f=o.raw||!Object.prototype.hasOwnProperty.call(o,"raw"),h=!0,u=null!=e["!data"],p=1===a?[]:{};if(1!==a)if(Object.defineProperty)try{Object.defineProperty(p,"__rowNum__",{value:r,enumerable:!1})}catch(e){p.__rowNum__=r}else p.__rowNum__=r;if(!u||e["!data"][r])for(var d=t.s.c;d<=t.e.c;++d){var m=u?(e["!data"][r]||[])[d]:e[n[d]+l];if(null!=m&&void 0!==m.t){var g=m.v;switch(m.t){case"z":if(null==g)break;continue;case"e":g=0==g?null:void 0;break;case"s":case"b":case"n":if(!m.z||!J(m.z))break;if("number"==typeof(g=he(g)))break;case"d":o&&(o.UTC||!1===o.raw)||(s=new Date(g),g=new Date(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()));break;default:throw new Error("unrecognized type "+m.t)}if(null!=i[d]){if(null==g)if("e"==m.t&&null===g)p[i[d]]=null;else if(void 0!==c)p[i[d]]=c;else{if(!f||null!==g)continue;p[i[d]]=null}else p[i[d]]=("n"===m.t&&"boolean"==typeof o.rawNumbers?o.rawNumbers:f)?g:$t(m,g,o);null!=g&&(h=!1)}}else{if(void 0===c)continue;null!=i[d]&&(p[i[d]]=c)}}return{row:p,isempty:h}}function Er(e,t){if(null==e||null==e["!ref"])return[];var r={t:"n",v:0},n=0,a=1,i=[],o=0,s="",l={s:{r:0,c:0},e:{r:0,c:0}},c=t||{},f=null!=c.range?c.range:e["!ref"];switch(1===c.header?n=1:"A"===c.header?n=2:Array.isArray(c.header)?n=3:null==c.header&&(n=0),typeof f){case"string":l=Lt(f);break;case"number":(l=Lt(e["!ref"])).s.r=f;break;default:l=f}n>0&&(a=0);var h=Ot(l.s.r),u=[],p=[],d=0,m=0,g=null!=e["!data"],v=l.s.r,b=0,x={};g&&!e["!data"][v]&&(e["!data"][v]=[]);var w=c.skipHidden&&e["!cols"]||[],y=c.skipHidden&&e["!rows"]||[];for(b=l.s.c;b<=l.e.c;++b)if(!(w[b]||{}).hidden)switch(u[b]=Ft(b),r=g?e["!data"][v][b]:e[u[b]+h],n){case 1:i[b]=b-l.s.c;break;case 2:i[b]=u[b];break;case 3:i[b]=c.header[b-l.s.c];break;default:if(null==r&&(r={w:"__EMPTY",t:"s"}),s=o=$t(r,null,c),m=x[o]||0){do{s=o+"_"+m++}while(x[s]);x[o]=m,x[s]=1}else x[o]=1;i[b]=s}for(v=l.s.r+a;v<=l.e.r;++v)if(!(y[v]||{}).hidden){var C=Fr(e,l,v,u,n,i,c);(!1===C.isempty||(1===n?!1!==c.blankrows:c.blankrows))&&(p[d++]=C.row)}return p.length=d,p}!function(){try{return"undefined"==typeof Uint8Array||void 0===Uint8Array.prototype.subarray?"slice":"undefined"!=typeof Buffer?void 0===Buffer.prototype.subarray?"slice":("function"==typeof Buffer.from?Buffer.from([72,62]):new Buffer([72,62]))instanceof Uint8Array?"subarray":"slice":"subarray"}catch(e){return"slice"}}();var Mr=/"/g;function Nr(e,t,r,n,a,i,o,s,l){for(var c=!0,f=[],h="",u=Ot(r),p=null!=e["!data"],d=p&&e["!data"][r]||[],m=t.s.c;m<=t.e.c;++m)if(n[m]){var g=p?d[m]:e[n[m]+u];if(null==g)h="";else if(null!=g.v){c=!1,h=""+(l.rawNumbers&&"n"==g.t?g.v:$t(g,null,l));for(var v=0,b=0;v!==h.length;++v)if((b=h.charCodeAt(v))===a||b===i||34===b||l.forceQuotes){h='"'+h.replace(Mr,'""')+'"';break}"ID"==h&&0==s&&0==f.length&&(h='"ID"')}else null==g.f||g.F?h="":(c=!1,(h="="+g.f).indexOf(",")>=0&&(h='"'+h.replace(Mr,'""')+'"'));f.push(h)}if(l.strip)for(;""===f[f.length-1];)--f.length;return!1===l.blankrows&&c?null:f.join(o)}function Ir(e,t){var r=[],n=null==t?{}:t;if(null==e||null==e["!ref"])return"";for(var a=Lt(e["!ref"]),i=void 0!==n.FS?n.FS:",",o=i.charCodeAt(0),s=void 0!==n.RS?n.RS:"\n",l=s.charCodeAt(0),c="",f=[],h=n.skipHidden&&e["!cols"]||[],u=n.skipHidden&&e["!rows"]||[],p=a.s.c;p<=a.e.c;++p)(h[p]||{}).hidden||(f[p]=Ft(p));for(var d=0,m=a.s.r;m<=a.e.r;++m)(u[m]||{}).hidden||null!=(c=Nr(e,a,m,f,o,l,i,d,n))&&(c||!1!==n.blankrows)&&r.push((d++?s:"")+c);return r.join("")}function Pr(e,t,r){var n=r||{},a=e?null!=e["!data"]:n.dense,i=+!n.skipHeader,o=e||{};!e&&a&&(o["!data"]=[]);var s=0,l=0;if(o&&null!=n.origin)if("number"==typeof n.origin)s=n.origin;else{var c="string"==typeof n.origin?Et(n.origin):n.origin;s=c.r,l=c.c}var f={s:{c:0,r:0},e:{c:l,r:s+t.length-1+i}};if(o["!ref"]){var h=Lt(o["!ref"]);f.e.c=Math.max(f.e.c,h.e.c),f.e.r=Math.max(f.e.r,h.e.r),-1==s&&(s=h.e.r+1,f.e.r=s+t.length-1+i)}else-1==s&&(s=0,f.e.r=t.length-1+i);var u=n.header||[],p=0,d=[];t.forEach((function(e,t){a&&!o["!data"][s+t+i]&&(o["!data"][s+t+i]=[]),a&&(d=o["!data"][s+t+i]),ie(e).forEach((function(r){-1==(p=u.indexOf(r))&&(u[p=u.length]=r);var c=e[r],f="z",h="",m=a?"":Ft(l+p)+Ot(s+t+i),g=a?d[l+p]:o[m];!c||"object"!=typeof c||c instanceof Date?("number"==typeof c?f="n":"boolean"==typeof c?f="b":"string"==typeof c?f="s":c instanceof Date?(f="d",n.UTC||(c=_e(c)),n.cellDates||(f="n",c=fe(c)),h=null!=g&&g.z&&J(g.z)?g.z:n.dateNF||S[14]):null===c&&n.nullError&&(f="e",c=0),g?(g.t=f,g.v=c,delete g.w,delete g.R,h&&(g.z=h)):a?d[l+p]=g={t:f,v:c}:o[m]=g={t:f,v:c},h&&(g.z=h)):a?d[l+p]=c:o[m]=c}))})),f.e.c=Math.max(f.e.c,l+u.length-1);var m=Ot(s);if(a&&!o["!data"][s]&&(o["!data"][s]=[]),i)for(p=0;p=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0&&r.length<32){var i=r.match(/\d+$/);a=i&&+i[0]||0;var o=i&&r.slice(0,i.index)||r;for(++a;a<=65535&&-1!=e.SheetNames.indexOf(r=o+a);++a);}if(xr(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function Ur(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}var $r={encode_col:Ft,encode_row:Ot,encode_cell:Mt,encode_range:It,decode_col:function(e){for(var t=e.replace(/^\$([A-Z])/,"$1"),r=0,n=0;n!==t.length;++n)r=26*r+t.charCodeAt(n)-64;return r-1},decode_row:function(e){return parseInt(e.replace(/\$(\d+)$/,"$1"),10)-1},split_cell:function(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")},decode_cell:Et,decode_range:Nt,format_cell:$t,sheet_new:function(e){var t={};return(e||{}).dense&&(t["!data"]=[]),t},sheet_add_aoa:zt,sheet_add_json:Pr,sheet_add_dom:Cr,aoa_to_sheet:function(e,t){return zt(null,e,t)},json_to_sheet:function(e,t){return Pr(null,e,t)},table_to_sheet:Sr,table_to_book:function(e,t){return function(e,t){var r=t&&t.sheet?t.sheet:"Sheet1",n={};return n[r]=e,{SheetNames:[r],Sheets:n}}(Sr(e,t),t)},sheet_to_csv:Ir,sheet_to_txt:function(e,t){return t||(t={}),t.FS="\t",t.RS="\n",Ir(e,t)},sheet_to_json:Er,sheet_to_html:function(e,t){var r=t||{},n=null!=r.header?r.header:'SheetJS Table Export',a=null!=r.footer?r.footer:"",i=[n],o=Nt(e["!ref"]||"A1");if(i.push(function(e,t,r){return[].join("")+""}(0,0,r)),e["!ref"])for(var s=o.s.r;s<=o.e.r;++s)i.push(yr(e,o,s,r));return i.push("
"+a),i.join("")},sheet_to_formulae:function(e,t){var r,n="",a="";if(null==e||null==e["!ref"])return[];var i,o=Lt(e["!ref"]),s="",l=[],c=[],f=null!=e["!data"];for(i=o.s.c;i<=o.e.c;++i)l[i]=Ft(i);for(var h=o.s.r;h<=o.e.r;++h)for(s=Ot(h),i=o.s.c;i<=o.e.c;++i)if(n=l[i]+s,a="",void 0!==(r=f?(e["!data"][h]||[])[i]:e[n])){if(null!=r.F){if(n=r.F,!r.f)continue;a=r.f,-1==n.indexOf(":")&&(n=n+":"+n)}if(null!=r.f)a=r.f;else{if(t&&!1===t.values)continue;if("z"==r.t)continue;if("n"==r.t&&null!=r.v)a=""+r.v;else if("b"==r.t)a=r.v?"TRUE":"FALSE";else if(void 0!==r.w)a="'"+r.w;else{if(void 0===r.v)continue;a="s"==r.t?"'"+r.v:""+r.v}}c[c.length]=n+"="+a}return c},sheet_to_row_object_array:Er,sheet_get_cell:Rr,book_new:function(e,t){var r={SheetNames:[],Sheets:{}};return e&&Lr(r,e,t||"Sheet1"),r},book_append_sheet:Lr,book_set_sheet_visibility:function(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=function(e,t){if("number"==typeof t){if(t>=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}if("string"==typeof t){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}throw new Error("Cannot find sheet |"+t+"|")}(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r},cell_set_number_format:function(e,t){return e.z=t,e},cell_set_hyperlink:Ur,cell_set_internal_link:function(e,t,r){return Ur(e,"#"+t,r)},cell_add_comment:function(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})},sheet_set_array_formula:function(e,t,r,n){for(var a="string"!=typeof t?t:Lt(t),i="string"==typeof t?t:It(t),o=a.s.r;o<=a.e.r;++o)for(var s=a.s.c;s<=a.e.c;++s){var l=Rr(e,o,s);l.t="n",l.F=i,delete l.v,o==a.s.r&&s==a.s.c&&(l.f=r,n&&(l.D=!0))}var c=Nt(e["!ref"]);return c.s.r>a.s.r&&(c.s.r=a.s.r),c.s.c>a.s.c&&(c.s.c=a.s.c),c.e.r}
+ */
+export async function JS_OpenSignInPage(url) {
+ // BEGIN USER CODE
+ window.location.href = url;
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/GetStorageItemObject.js b/javascriptsource/feedbackmodule/actions/GetStorageItemObject.js
new file mode 100644
index 0000000..7f73a5b
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/GetStorageItemObject.js
@@ -0,0 +1,104 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript action do?
+ *
+ * Get locally stored JSON object stored in clients internet browser. Identified by a unique key. Can be accessed by the GetStorageItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {string} entity - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetStorageItemObject(key, entity) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!entity) {
+ return Promise.reject(new Error("Input parameter 'Entity' is required"));
+ }
+ return getItem(key).then(result => {
+ if (result === null) {
+ return Promise.reject(new Error(`Storage item '${key}' does not exist`));
+ }
+ const value = JSON.parse(result);
+ return getOrCreateMxObject(entity, value).then(newObject => {
+ const newValue = serializeMxObject(newObject);
+ return setItem(key, JSON.stringify(newValue)).then(() => newObject);
+ });
+ });
+ function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ const value = window.localStorage.getItem(key);
+ return Promise.resolve(value);
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function getOrCreateMxObject(entity, value) {
+ return getMxObject(value.guid).then(existingObject => {
+ if (existingObject) {
+ return existingObject;
+ }
+ else {
+ return createMxObject(entity, value);
+ }
+ });
+ }
+ function getMxObject(guid) {
+ return new Promise((resolve, reject) => {
+ mx.data.get({
+ guid,
+ callback: mxObject => resolve(mxObject),
+ error: error => reject(error)
+ });
+ });
+ }
+ function createMxObject(entity, value) {
+ return new Promise((resolve, reject) => {
+ mx.data.create({
+ entity,
+ callback: mxObject => {
+ Object.keys(value)
+ .filter(attribute => attribute !== "guid")
+ .forEach(attributeName => {
+ const attributeValue = value[attributeName];
+ mxObject.set(attributeName, attributeValue);
+ });
+ resolve(mxObject);
+ },
+ error: () => reject(new Error(`Could not create '${entity}' object`))
+ });
+ });
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_PopulateFeedbackMetadata.js b/javascriptsource/feedbackmodule/actions/JS_PopulateFeedbackMetadata.js
new file mode 100644
index 0000000..79ff1f2
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_PopulateFeedbackMetadata.js
@@ -0,0 +1,72 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+ const handleUserRoles = async () => {
+ if(!mx) return undefined;
+ try {
+ return await mx.session.getUserRoleNames();
+ } catch (error){
+ console.error("Error getting user role names", error);
+ return undefined;
+ }
+ };
+ const handlePagePath = async () => {
+ if(!mx) return undefined;
+ try {
+ const mendixVersion = mx.version
+ const mendixMajorVersion = mendixVersion.split('.')[0];
+ switch(mendixMajorVersion) {
+ case '9':
+ case '10':
+ return mx.ui.getContentForm().path.toString();
+ default:
+ return undefined;
+ };
+ } catch {
+ console.error("Error getting page path", error);
+ return undefined
+ }
+ };
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript action do?
+ *
+ * Returns meta data from the clients internet browser.
+ *
+ * This includes;
+ *
+ * ActiveUserRoles
+ * PageName
+ * EnvironmentURL
+ * Browser
+ * ScreenWidth
+ * ScreenHeight
+ * @param {MxObject} feedback
+ * @returns {Promise.}
+ */
+export async function JS_PopulateFeedbackMetadata(feedback) {
+ // BEGIN USER CODE
+ try {
+ const userRoles = await handleUserRoles();
+ const pagePath = await handlePagePath();
+ feedback.set("ActiveUserRoles", userRoles);
+ feedback.set("PageName", pagePath);
+ feedback.set("EnvironmentURL", window.location.href);
+ feedback.set("Browser", navigator.userAgent);
+ feedback.set("ScreenWidth", window.screen.width);
+ feedback.set("ScreenHeight", window.screen.height);
+ return feedback;
+ } catch (error) {
+ console.error("Error setting meta data", error);
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_Recalculate_MendixModal_Error_PopUp_Zindex.js b/javascriptsource/feedbackmodule/actions/JS_Recalculate_MendixModal_Error_PopUp_Zindex.js
new file mode 100644
index 0000000..eadee7d
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_Recalculate_MendixModal_Error_PopUp_Zindex.js
@@ -0,0 +1,40 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @returns {Promise.}
+ */
+export async function JS_Recalculate_MendixModal_Error_PopUp_Zindex() {
+ // BEGIN USER CODE
+
+ function setModalZindex(cssSelector, zIndexValue) {
+ try {
+ const htmlElement = document.querySelectorAll(cssSelector);
+
+ if(!htmlElement.length) {
+ return;
+ }
+
+ htmlElement.forEach(item => item.style.zIndex = zIndexValue);
+
+ } catch(error) {
+ console.warn("Feedback Module JS_Recalculate_Modal_Zindex could not execute correctly", error);
+ }
+ };
+
+ setTimeout(() => {
+ setModalZindex(".mx-dialog-info, mx-dialog-warning, .mx-dialog-error", "90");
+ setModalZindex(".mx-underlay", "80");
+ },500);
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_RevokeUploadedFileFromMemory.js b/javascriptsource/feedbackmodule/actions/JS_RevokeUploadedFileFromMemory.js
new file mode 100644
index 0000000..6791c87
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_RevokeUploadedFileFromMemory.js
@@ -0,0 +1,50 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript action do?
+ *
+ * After you have uploaded an image it removes locally stored image from memory. This is a custom build action.
+ *
+ * Dependency Note:
+ * This JavaScript action should be used only when you have inserted the Image Upload JavaScript Action called 'JS_UploadAndConvertToFileBlobURL' into your nanoflow.
+ *
+ * More detailed explanation: Memory management.
+ *
+ * To upload a image we use a custom build Javascript action called 'JS_UploadAndConvertToFileBlobURL'.
+ * Inside this action we use a JavaScript method called createObjectURL() to upload and store files in local memory. We can access and cosume this in memory image resource via the URL path that is returned from the createObjectURL() method.
+ *
+ * However, each time you call createObjectURL(), a new object is created in memory, even if you've already created one for the same object.
+ * So each of these must be released by calling this action called 'JS_RevokeUploadedFileFromMemory' when you no longer need them.
+ *
+ * Browsers will release object URLs automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so with the JavaScriptAction called 'JS_RevokeUploadedFileFromMemory'.
+ * @param {string} fileBlobURL - You have to pass the fileBlobURL that was created using the URL.createObjectURL() in the JS Action called 'JS_UploadAndConvertToFileBlobURL'
+ * @returns {Promise.}
+ */
+export async function JS_RevokeUploadedFileFromMemory(fileBlobURL) {
+ // BEGIN USER CODE
+ /* We use the URL.createObjectURL() static method which creates a string containing a URL representing the
+ image uploaded.
+ The image blob is stored in the clients browser and takes up memory whilst the session is active. So here we
+ revoke the image when the user deletes the image. Note that the image is automaticlly revoked when the browser refreshes
+ or closes.
+
+ You have to pass the fileBlobURL that was created using the URL.createObjectURL() in the JS Action called 'JS_UploadAndConvertToFileBlobURL'
+ */
+ if(fileBlobURL && typeof fileBlobURL === "string"){
+ URL.revokeObjectURL(fileBlobURL);
+ } else {
+ throw new Error("Image was not removed from browser memory");
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackAnnotateWidget.js b/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackAnnotateWidget.js
new file mode 100644
index 0000000..35382f2
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackAnnotateWidget.js
@@ -0,0 +1,74 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// messageActionTypes are to identify the postMessage types between the JS Action & Feedback Widget.
+const messageAction_toggleAnnotateMode = "mxFeedbackWidget_toggleAnnotateMode"; // The Feedback widget reads this to trigger a specific screenshot mode stage.
+const messageAction_isBase64 = "mxFeedbackWidget_convertedToBase64"; // We expect this string from the widget when screenshot mode in enabled.
+const messageAction_actionCancelled = "mxFeedbackWidget_actionCancelled" // The Feedback widget will send this back if screenshot/annotation actions are cancelled by the user.
+
+const parseJSON = (event) => {
+ try {
+ return JSON.parse(event);
+ } catch {
+ return undefined;
+ }
+};
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript action do?
+ *
+ * When you upload a screenshot manually the image can be annotatated.
+ *
+ * More detailed explanation:
+ * The Mendix Feedback Widget handles annotation and also renders a default styled button on your page.
+ *
+ * In order to trigger the annotation mode you have to use this JavaScript action to send the widget the correct image payload.
+ *
+ * Return Type:
+ * Will return base 64 image string
+ * @param {string} fileBlobURL
+ * @returns {Promise.}
+ */
+export async function JS_ToggleFeedbackAnnotateWidget(fileBlobURL) {
+ // BEGIN USER CODE
+ /*
+ The widget and JS action communicate with the following postMessage object structure:
+ messageObject = {messageActionType: string;messageData: string;}
+ */
+ const messageObject = {
+ "messageActionType": messageAction_toggleAnnotateMode, // The widget reads this to trigger the Annotate Mode.
+ "messageData": fileBlobURL // The widget uses this URL reference to get access to the locally stored image blob.
+ };
+
+ postMessage(JSON.stringify(messageObject), window.origin); // Send the serialized message object to Feedback Wiget to trigger annotate mode.
+
+ return new Promise(resolve => {
+ function handleEvent(event) {
+ const parsedData = parseJSON(event.data); // Convert the received string to an object.
+
+ if(event.origin === window.origin) {
+ if (parsedData && parsedData.messageActionType === messageAction_isBase64) {
+ window.removeEventListener("message", handleEvent);
+ resolve(parsedData.messageData); // Resolve & return the base64 image to the nanoflow.
+ };
+ if(parsedData && parsedData.messageActionType === messageAction_actionCancelled) {
+ resolve();
+ }
+ }
+
+ };
+
+ window.addEventListener("message", handleEvent); // Listen and wait for the Feedback Widget to send the base64 image.
+
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackScreenshotWidget.js b/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackScreenshotWidget.js
new file mode 100644
index 0000000..fafc71c
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_ToggleFeedbackScreenshotWidget.js
@@ -0,0 +1,73 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// messageActionTypes are to identify the postMessage types between the JS Action & Feedback Widget.
+const messageAction_toggleAnnotateMode = "mxFeedbackWidget_toggleScreenshotMode"; // The Feedback widget reads this to trigger a specific screenshot mode stage.
+const messageAction_isBase64 = "mxFeedbackWidget_convertedToBase64"; // We expect this string from the widget when screenshot mode in enabled.
+const messageAction_actionCancelled = "mxFeedbackWidget_actionCancelled" // The Feedback widget will send this back if screenshot/annotation actions are cancelled by the user.
+
+/*
+ The widget and JS action communicate with the following postMessage object structure:
+ messageObject = {messageActionType: string;messageData: string;}
+*/
+const messageObject = {
+ "messageActionType": messageAction_toggleAnnotateMode //The Feedback widget reads this to trigger a specific Mode.
+};
+
+const parseJson = (event) => {
+ try {
+ return JSON.parse(event);
+ } catch {
+ return undefined;
+ }
+};
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript action do?
+ *
+ * Lets to take a screenshot of the current visible page
+ *
+ * More detailed explanation:
+ * The Mendix Feedback Widget handles annotation, screenshot and also renders a default styled button on your page.
+ *
+ * Usage:
+ * You should use this JavaScript action to trigger the screenshot functionality.
+ *
+ * Return Type:
+ * Will return a image base64 string
+ *
+ * @returns {Promise.}
+ */
+export async function JS_ToggleFeedbackScreenshotWidget() {
+ // BEGIN USER CODE
+ postMessage(JSON.stringify(messageObject), window.origin); // Send a message to the Feedback Wiget to trigger screenshot mode.
+
+ return new Promise(resolve => {
+
+ function handleEvent(event){
+ const parsedData = parseJson(event.data);
+ if(parsedData && event.origin === window.origin) {
+ if (parsedData.messageActionType === messageAction_isBase64) {
+ window.removeEventListener("message", handleEvent);
+ resolve(parsedData.messageData); // Resolve & return the base64 image to the nanoflow.
+ };
+ if(parsedData.messageActionType === messageAction_actionCancelled){
+ resolve("uploadCancelled");
+ }
+ }
+ };
+
+ window.addEventListener("message", handleEvent); // Listen and wait for the Feedback Widget to send back the edited screenshot as base64.
+
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/JS_UploadAndConvertToFileBlobURL.js b/javascriptsource/feedbackmodule/actions/JS_UploadAndConvertToFileBlobURL.js
new file mode 100644
index 0000000..2e50fe3
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/JS_UploadAndConvertToFileBlobURL.js
@@ -0,0 +1,113 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import "mx-global";
+
+// BEGIN EXTRA CODE
+ var isUploading = false;
+
+ async function storeFileAndGetResourceUrl(file) {
+ return URL.createObjectURL(file); // Saves the file to locally memory and returns a URL path to the Blob object.
+ };
+
+ function removeDomElements({fileInput, progressId}) {
+ if(progressId) mx.ui.hideProgress(progressId);
+ if(fileInput) document.body.removeChild(fileInput);
+ isUploading = false;
+ }
+
+ function validateFileTypes ({acceptedTypes, fileType}) {
+ if(!acceptedTypes && !fileType) return false;
+ const accepted = acceptedTypes.split(",");
+ return accepted.some(type => new RegExp(type).test(fileType));
+ }
+
+ function validateFileSize ({uploadedFile, maxSize}) {
+ if(!uploadedFile && !maxSize) return false;
+ const uploadedSize = uploadedFile.size / 1024 / 1024; // Convert to MB
+ return uploadedSize < (maxSize.c[0] + 0.1); // 0.1 MB extra tolerance
+ }
+// END EXTRA CODE
+
+/**
+ * What does this JavaScript Action do?
+ *
+ * This is a custom build JavaScript Action that triggers the file upload dialog box to open in your internet browser.
+ *
+ * Dependency Note:
+ * This JavaScript action should be used with the JavaScript Action called 'JS_RevokeUploadedFileFromMemory' so that the image uploaded is removed from local memory :)
+ *
+ * Explanation of this JavaScript Action & Memory management.
+ *
+ * We use createObjectURL() to upload and store files in local memory. We can access and cosume this in memory image resource via the URL path that is returned from the createObjectURL() method.
+ *
+ * However, each time you call createObjectURL(), a new object is created in memory, even if you've already created one for the same object.
+ * So each of these must be released by calling the JS Action called 'JS_RevokeUploadedFileFromMemory' when you no longer need them.
+ *
+ * Browsers will release object URLs automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so with the JavaScriptAction called 'JS_RevokeUploadedFileFromMemory'.
+ * @param {string} userDefined_mimeTypes
+ * @param {Big} userDefined_fileUploadSize
+ * @returns {Promise.}
+ */
+export async function JS_UploadAndConvertToFileBlobURL(userDefined_mimeTypes, userDefined_fileUploadSize) {
+ // BEGIN USER CODE
+ return new Promise((resolve, reject) => {
+ try {
+ // Create and append the HTML input element to the body
+ const fileInput = document.createElement("input");
+ fileInput.style.position = "absolute";
+ fileInput.style.left = "-9999px";
+ fileInput.name = "fileupload";
+ fileInput.id = "fileupload";
+ fileInput.type = "file";
+ if(userDefined_mimeTypes){
+ fileInput.accept = userDefined_mimeTypes;
+ }
+ fileInput.multiple = false;
+ fileInput.onchange = handleFileUpload;
+ document.body.appendChild(fileInput);
+ fileInput.addEventListener("cancel", () => resolve("uploadCancelled"));
+ fileInput.click();
+
+ // A function used to validate & store the uploaded file to local memory.
+ function handleFileUpload(event) {
+ isUploading = true;
+
+ const newFile = event.target.files[0];
+ const progressId = mx.ui.showProgress(null, true);
+
+ // Check if the uploaded file type matches the user defined accepted types.
+ if (!validateFileTypes({acceptedTypes: fileInput.accept, fileType: newFile.type})) {
+ removeDomElements({fileInput, progressId});
+ resolve("fileTypeNotAccepted");
+ return;
+ }
+ // Check if the uploaded file matches the user defined upload size.
+ if (!validateFileSize({uploadedFile: newFile, maxSize: userDefined_fileUploadSize})) {
+ removeDomElements({fileInput, progressId});
+ resolve("fileSizeNotAccepted");
+ return;
+ }
+ // Store file locally on users device and return path to resource.
+ storeFileAndGetResourceUrl(newFile).then((fileBlobURL) => {
+ if(fileBlobURL && typeof fileBlobURL === "string") {
+ removeDomElements({fileInput, progressId});
+ resolve(fileBlobURL);
+ } else {
+ removeDomElements({fileInput, progressId});
+ resolve("fileNotConverted");
+ }
+ })
+ return;
+ };
+ } catch (error) {
+ reject(error);
+ }
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/feedbackmodule/actions/SetStorageItemObject.js b/javascriptsource/feedbackmodule/actions/SetStorageItemObject.js
new file mode 100644
index 0000000..f4ecff9
--- /dev/null
+++ b/javascriptsource/feedbackmodule/actions/SetStorageItemObject.js
@@ -0,0 +1,47 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Store a Mendix object in device storage, identified by a unique key. Can be accesed by the GetStargeItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {MxObject} value - This field is required.
+ * @returns {Promise.}
+ */
+export async function SetStorageItemObject(key, value) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!value) {
+ return Promise.reject(new Error("Input parameter 'Value' is required"));
+ }
+ const serializedObject = serializeMxObject(value);
+ return setItem(key, JSON.stringify(serializedObject));
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Base64Decode.js b/javascriptsource/nanoflowcommons/actions/Base64Decode.js
new file mode 100644
index 0000000..7079518
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Base64Decode.js
@@ -0,0 +1,22 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import { Base64 } from 'js-base64';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {string} base64
+ * @returns {Promise.}
+ */
+export async function Base64Decode(base64) {
+ // BEGIN USER CODE
+ return Base64.decode(base64);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Base64DecodeToImage.js b/javascriptsource/nanoflowcommons/actions/Base64DecodeToImage.js
new file mode 100644
index 0000000..055f7fc
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Base64DecodeToImage.js
@@ -0,0 +1,32 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import { Base64 } from 'js-base64';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {string} base64
+ * @param {MxObject} image
+ * @returns {Promise.}
+ */
+export async function Base64DecodeToImage(base64, image) {
+ // BEGIN USER CODE
+ if (!base64) {
+ throw new Error("base64 String should not be empty");
+ }
+ if (!image) {
+ throw new Error("image should not be null");
+ }
+ const blob = new Blob([Base64.toUint8Array(base64)], { type: "image/png" });
+ return new Promise((resolve, reject) => {
+ mx.data.saveDocument(image.getGuid(), "camera image", {}, blob, () => resolve(true), reject);
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Base64Encode.js b/javascriptsource/nanoflowcommons/actions/Base64Encode.js
new file mode 100644
index 0000000..643579f
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Base64Encode.js
@@ -0,0 +1,23 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import "mx-global";
+import { Big } from "big.js";
+import { Base64 } from 'js-base64';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {string} string
+ * @returns {Promise.}
+ */
+export async function Base64Encode(string) {
+ // BEGIN USER CODE
+ return Base64.encode(base64);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/CallPhoneNumber.js b/javascriptsource/nanoflowcommons/actions/CallPhoneNumber.js
new file mode 100644
index 0000000..7639e64
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/CallPhoneNumber.js
@@ -0,0 +1,46 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * This action can be used to launch a phone app on the devices and initiate dialing of the specified phone number. The user has to confirm to initate the actual call.
+ * @param {string} phoneNumber - This field is required.
+ * @returns {Promise.}
+ */
+export async function CallPhoneNumber(phoneNumber) {
+ // BEGIN USER CODE
+ if (!phoneNumber) {
+ return Promise.reject(new Error("Input parameter 'Phone number' is required"));
+ }
+ const url = `tel:${encodeURI(phoneNumber)}`;
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ return Promise.resolve(true);
+ }
+ // Web platform
+ if (window) {
+ window.location.href = url;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ClearCachedSessionData.js b/javascriptsource/nanoflowcommons/actions/ClearCachedSessionData.js
new file mode 100644
index 0000000..5c4b97f
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ClearCachedSessionData.js
@@ -0,0 +1,24 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Clears saved session data from the local storage for offline native and PWAs.
+ * @returns {Promise.}
+ */
+export async function ClearCachedSessionData() {
+ // BEGIN USER CODE
+ if (mx.session && mx.session.clearCachedSessionData === undefined) {
+ return Promise.reject(new Error("JS action 'Clear cached session data' is not supported prior to Mendix client v9.14"));
+ }
+ await mx.session.clearCachedSessionData();
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ClearLocalStorage.js b/javascriptsource/nanoflowcommons/actions/ClearLocalStorage.js
new file mode 100644
index 0000000..67e6067
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ClearLocalStorage.js
@@ -0,0 +1,27 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @returns {Promise.}
+ */
+export async function ClearLocalStorage() {
+ // BEGIN USER CODE
+ try {
+ localStorage.clear();
+ return true;
+ }
+ catch (e) {
+ console.error(e);
+ return false;
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/DraftEmail.js b/javascriptsource/nanoflowcommons/actions/DraftEmail.js
new file mode 100644
index 0000000..99ed516
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/DraftEmail.js
@@ -0,0 +1,64 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Start drafting an email in the platform specified email client. This might work differently for each user depending on their platform and local configuration.
+ * @param {string} recipient - The recipient, or recipients, separated by comma's.
+ * @param {string} cc - The Carbon Copy recipient, or recipients, separated by comma's.
+ * @param {string} bcc - The Blind Carbon Copy recipient, or recipients, separated by comma's.
+ * @param {string} subject
+ * @param {string} body
+ * @returns {Promise.}
+ */
+export async function DraftEmail(recipient, cc, bcc, subject, body) {
+ // BEGIN USER CODE
+ let url = "mailto:";
+ if (recipient) {
+ url += `${encodeURI(recipient)}?`;
+ }
+ if (cc) {
+ url += `cc=${encodeURIComponent(cc)}&`;
+ }
+ if (bcc) {
+ url += `bcc=${encodeURIComponent(bcc)}&`;
+ }
+ if (subject) {
+ url += `subject=${encodeURIComponent(subject)}&`;
+ }
+ if (body) {
+ url += `body=${encodeURIComponent(body)}&`;
+ }
+ // Remove the last '?' or '&'
+ url = url.slice(0, -1);
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ return Promise.resolve(true);
+ }
+ // Web platform
+ if (window) {
+ window.location.href = url;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/FindObjectWithGUID.js b/javascriptsource/nanoflowcommons/actions/FindObjectWithGUID.js
new file mode 100644
index 0000000..e6b22a0
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/FindObjectWithGUID.js
@@ -0,0 +1,22 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {MxObject[]} list
+ * @param {string} objectGUID
+ * @returns {Promise.}
+ */
+export async function FindObjectWithGUID(list, objectGUID) {
+ // BEGIN USER CODE
+ return list.find(element => element.getGuid() === objectGUID);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.js b/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.js
new file mode 100644
index 0000000..e6a6f77
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.js
@@ -0,0 +1,62 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+const COUNTER_STORE = "idCounter";
+let locked = false;
+let currentCounter;
+function sleep(time) {
+ return new Promise(resolve => setTimeout(resolve, time));
+}
+async function initializeCounter() {
+ currentCounter = JSON.parse((await getItem(COUNTER_STORE)) || "-1");
+}
+async function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ const AsyncStorage = (await import('@react-native-community/async-storage')).default;
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ return window.localStorage.getItem(key);
+ }
+ throw new Error("No storage API available");
+}
+async function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ const AsyncStorage = (await import('@react-native-community/async-storage')).default;
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ return window.localStorage.setItem(key, value);
+ }
+ throw new Error("No storage API available");
+}
+// END EXTRA CODE
+
+/**
+ * Generates a unique ID based on the current session.
+ * @returns {Promise.}
+ */
+export async function GenerateUniqueID() {
+ // BEGIN USER CODE
+ const sessionId = mx.session.getConfig("sessionObjectId");
+ const rnd = Math.round(Math.random() * 10000);
+ // eslint-disable-next-line no-unmodified-loop-condition
+ while (locked) {
+ await sleep(10);
+ }
+ locked = true;
+ if (typeof currentCounter === "undefined") {
+ await initializeCounter();
+ }
+ await setItem(COUNTER_STORE, JSON.stringify(++currentCounter));
+ locked = false;
+ return `${sessionId}:${currentCounter}:${rnd}`;
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.json b/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Geocode.js b/javascriptsource/nanoflowcommons/actions/Geocode.js
new file mode 100644
index 0000000..818ed57
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Geocode.js
@@ -0,0 +1,119 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import Geodecoder from 'react-native-geocoder';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Geocoding is the process of converting addresses (like a street address) into geographic coordinates (latitude and longitude), which you can use to place markers on a map, or position the map.
+ * @param {string} address - This field is required.
+ * @param {"NanoflowCommons.GeocodingProvider.Google"|"NanoflowCommons.GeocodingProvider.Geocodio"|"NanoflowCommons.GeocodingProvider.LocationIQ"|"NanoflowCommons.GeocodingProvider.MapQuest"} geocodingProvider - This field is required for use on web.
+ * @param {string} providerApiKey - This field is required for use on web. Note that the keys are accessible by the end users and should be protected in other ways; for example restricted domain name.
+ * @returns {Promise.}
+ */
+export async function Geocode(address, geocodingProvider, providerApiKey) {
+ // BEGIN USER CODE
+ /**
+ * Documentation:
+ * - Native: https://github.com/devfd/react-native-geocoder
+ * - Google: https://developers.google.com/maps/documentation/geocoding/intro#GeocodingRequests
+ * - Geocodio: https://www.geocod.io/docs/#geocoding
+ * - LocationIQ: https://locationiq.com/docs-html/index.html#search-forward-geocoding
+ * - MapQuest: https://developer.mapquest.com/documentation/open/geocoding-api/address/get/
+ */
+ if (!address) {
+ return Promise.reject(new Error("Input parameter 'Address' is required"));
+ }
+ if (navigator && navigator.product === "ReactNative") {
+ return Geodecoder.geocodeAddress(address).then(results => {
+ if (results.length === 0) {
+ return Promise.reject(new Error("No results found"));
+ }
+ return createMxObject(String(results[0].position.lat), String(results[0].position.lng));
+ });
+ }
+ if (!geocodingProvider) {
+ return Promise.reject(new Error("Input parameter 'Geocoding provider' is required for use on web"));
+ }
+ if (!providerApiKey) {
+ return Promise.reject(new Error("Input parameter 'Provider api key' is required for use on web"));
+ }
+ const url = getApiUrl(geocodingProvider, address, providerApiKey);
+ return fetch(url)
+ .then(response => response.json().catch(() => response.text().then(text => {
+ return Promise.reject(new Error(text));
+ })))
+ .then(response => getLatLong(geocodingProvider, response))
+ .then(latLong => createMxObject(latLong[0], latLong[1]))
+ .catch(error => Promise.reject(error));
+ function getApiUrl(provider, query, key) {
+ query = encodeURIComponent(query);
+ key = encodeURIComponent(key);
+ switch (provider) {
+ case "Google":
+ return `https://maps.googleapis.com/maps/api/geocode/json?address=${query}&key=${key}`;
+ case "Geocodio":
+ return `https://api.geocod.io/v1.3/geocode?q=${query}&api_key=${key}`;
+ case "LocationIQ":
+ return `https://eu1.locationiq.com/v1/search.php?format=json&q=${query}&key=${key}`;
+ case "MapQuest":
+ return `https://open.mapquestapi.com/geocoding/v1/address?location=${query}&key=${key}`;
+ }
+ }
+ function getLatLong(provider, response) {
+ switch (provider) {
+ case "Google":
+ if (response.status !== "OK") {
+ throw new Error(response.error_message);
+ }
+ return [response.results[0].geometry.location.lat, response.results[0].geometry.location.lng];
+ case "Geocodio":
+ if (response.error) {
+ throw new Error(response.error);
+ }
+ if (response.results.length === 0) {
+ throw new Error("No results found");
+ }
+ return [response.results[0].location.lat, response.results[0].location.lng];
+ case "LocationIQ":
+ if (response.error) {
+ throw new Error(response.error);
+ }
+ if (response.length === 0) {
+ throw new Error("No results found");
+ }
+ return [response[0].lat, response[0].lon];
+ case "MapQuest":
+ if (response.info.statuscode !== 0) {
+ throw new Error(response.info.messages.join(", "));
+ }
+ if (response.results.length === 0) {
+ throw new Error("No results found");
+ }
+ return [response.results[0].locations[0].latLng.lat, response.results[0].locations[0].latLng.lng];
+ }
+ }
+ function createMxObject(lat, long) {
+ return new Promise((resolve, reject) => {
+ mx.data.create({
+ entity: "NanoflowCommons.Position",
+ callback: mxObject => {
+ mxObject.set("Latitude", lat);
+ mxObject.set("Longitude", long);
+ resolve(mxObject);
+ },
+ error: () => {
+ reject(new Error("Could not create 'NanoflowCommons.Position' object to store coordinates"));
+ }
+ });
+ });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Geocode.json b/javascriptsource/nanoflowcommons/actions/Geocode.json
new file mode 100644
index 0000000..aa3b0e5
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Geocode.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "react-native-geocoder": "0.5.0"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.js b/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.js
new file mode 100644
index 0000000..fd6fa3d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.js
@@ -0,0 +1,110 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import Geolocation from '@react-native-community/geolocation';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * This action retrieves the current geographical position of a user/device.
+ *
+ * Since this can compromise privacy, the position is not available unless the user approves it. The web browser will request the permission at the first time the location is requested. When denied by the user it will not prompt a second time.
+ *
+ * On hybrid and native platforms the permission can be requested with the `RequestLocationPermission` action.
+ *
+ * Best practices:
+ * https://developers.google.com/web/fundamentals/native-hardware/user-location/
+ * @param {Big} timeout - The maximum length of time (in milliseconds) the device is allowed to take in order to return a location. If set as empty, default value will be 30 second timeout.
+ * @param {Big} maximumAge - The maximum age (in milliseconds) of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. By default the device will always return a cached position regardless of its age.
+ * @param {boolean} highAccuracy - Use a higher accuracy method to determine the current location. Setting this to false saves battery life.
+ * @returns {Promise.}
+ */
+export async function GetCurrentLocation(timeout, maximumAge, highAccuracy) {
+ // BEGIN USER CODE
+ let reactNativeModule;
+ let geolocationModule;
+ if (navigator && navigator.product === "ReactNative") {
+ reactNativeModule = require("react-native");
+ if (!reactNativeModule) {
+ return Promise.reject(new Error("React Native module could not be found"));
+ }
+ if (reactNativeModule.NativeModules.RNFusedLocation) {
+ geolocationModule = (await import('react-native-geolocation-service')).default;
+ }
+ else if (reactNativeModule.NativeModules.RNCGeolocation) {
+ geolocationModule = Geolocation;
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ }
+ else if (navigator && navigator.geolocation) {
+ geolocationModule = navigator.geolocation;
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ return new Promise((resolve, reject) => {
+ const options = getOptions();
+ geolocationModule === null || geolocationModule === void 0 ? void 0 : geolocationModule.getCurrentPosition(onSuccess, onError, options);
+ function onSuccess(position) {
+ mx.data.create({
+ entity: "NanoflowCommons.Geolocation",
+ callback: mxObject => {
+ const geolocation = mapPositionToMxObject(mxObject, position);
+ resolve(geolocation);
+ },
+ error: () => reject(new Error("Could not create 'NanoflowCommons.Geolocation' object to store location"))
+ });
+ }
+ function onError(error) {
+ return reject(new Error(error.message));
+ }
+ function getOptions() {
+ let timeoutNumber = timeout && Number(timeout.toString());
+ const maximumAgeNumber = maximumAge && Number(maximumAge.toString());
+ // If the timeout is 0 or undefined (empty), it causes a crash on iOS.
+ // If the timeout is undefined (empty); we set timeout to 30 sec (default timeout)
+ // If the timeout is 0; we set timeout to 1 hour (no timeout)
+ if ((reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform.OS) === "ios") {
+ if (timeoutNumber === undefined) {
+ timeoutNumber = 30000;
+ }
+ else if (timeoutNumber === 0) {
+ timeoutNumber = 3600000;
+ }
+ }
+ return {
+ timeout: timeoutNumber,
+ maximumAge: maximumAgeNumber,
+ enableHighAccuracy: highAccuracy
+ };
+ }
+ function mapPositionToMxObject(mxObject, position) {
+ mxObject.set("Timestamp", new Date(position.timestamp));
+ mxObject.set("Latitude", new Big(position.coords.latitude.toFixed(8)));
+ mxObject.set("Longitude", new Big(position.coords.longitude.toFixed(8)));
+ mxObject.set("Accuracy", new Big(position.coords.accuracy.toFixed(8)));
+ if (position.coords.altitude != null) {
+ mxObject.set("Altitude", new Big(position.coords.altitude.toFixed(8)));
+ }
+ if (position.coords.altitudeAccuracy != null && position.coords.altitudeAccuracy !== -1) {
+ mxObject.set("AltitudeAccuracy", new Big(position.coords.altitudeAccuracy.toFixed(8)));
+ }
+ if (position.coords.heading != null && position.coords.heading !== -1) {
+ mxObject.set("Heading", new Big(position.coords.heading.toFixed(8)));
+ }
+ if (position.coords.speed != null && position.coords.speed !== -1) {
+ mxObject.set("Speed", new Big(position.coords.speed.toFixed(8)));
+ }
+ return mxObject;
+ }
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.json b/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.json
new file mode 100644
index 0000000..9fd572c
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetCurrentLocation.json
@@ -0,0 +1,6 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/geolocation": "2.0.2",
+ "react-native-geolocation-service": "5.2.0"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.js b/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.js
new file mode 100644
index 0000000..4252667
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.js
@@ -0,0 +1,143 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import Geolocation from '@react-native-community/geolocation';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * This action retrieves the current geographical position of a user/device with a minimum accuracy as parameter. If a position is not acquired with minimum accuracy within a specific timeout it will retrieve the last most precise location.
+ *
+ * Since this can compromise privacy, the position is not available unless the user approves it. The web browser will request the permission at the first time the location is requested. When denied by the user it will not prompt a second time.
+ *
+ * On hybrid and native platforms the permission can be requested with the `RequestLocationPermission` action.
+ *
+ * Best practices:
+ * https://developers.google.com/web/fundamentals/native-hardware/user-location/
+ * @param {Big} timeout - The maximum length of time (in milliseconds) the device is allowed to take in order to return a location. If set as empty, default value will be 30 second timeout.
+ * @param {Big} maximumAge - The maximum age (in milliseconds) of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. By default the device will always return a cached position regardless of its age.
+ * @param {boolean} highAccuracy - Use a higher accuracy method to determine the current location. Setting this to false saves battery life.
+ * @param {Big} minimumAccuracy - The minimum accuracy to be received in meters. Less amount of meters, more precise is the location.
+ * @returns {Promise.}
+ */
+export async function GetCurrentLocationMinimumAccuracy(timeout, maximumAge, highAccuracy, minimumAccuracy) {
+ // BEGIN USER CODE
+ let reactNativeModule;
+ let geolocationModule;
+ if (navigator && navigator.product === "ReactNative") {
+ reactNativeModule = require("react-native");
+ if (!reactNativeModule) {
+ return Promise.reject(new Error("React Native module could not be found"));
+ }
+ if (reactNativeModule.NativeModules.RNFusedLocation) {
+ geolocationModule = (await import('react-native-geolocation-service')).default;
+ }
+ else if (reactNativeModule.NativeModules.RNCGeolocation) {
+ geolocationModule = Geolocation;
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ }
+ else if (navigator && navigator.geolocation) {
+ geolocationModule = navigator.geolocation;
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ return new Promise((resolve, reject) => {
+ if (!geolocationModule) {
+ return reject(new Error("Geolocation module could not be found"));
+ }
+ const options = getOptions();
+ // This action is only required while running in PWA or hybrid.
+ if (navigator && (!navigator.product || navigator.product !== "ReactNative")) {
+ // This ensures the browser will not ignore the maximumAge https://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt/31916631#31916631
+ geolocationModule.getCurrentPosition(
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ () => { },
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ () => { }, {});
+ }
+ const timeoutId = setTimeout(onTimeout, Number(timeout));
+ const watchId = geolocationModule.watchPosition(onSuccess, onError, options);
+ let lastAccruedPosition;
+ function createGeolocationObject(position) {
+ mx.data.create({
+ entity: "NanoflowCommons.Geolocation",
+ callback: mxObject => resolve(mapPositionToMxObject(mxObject, position)),
+ error: () => reject(new Error("Could not create 'NanoflowCommons.Geolocation' object to store location"))
+ });
+ }
+ function onTimeout() {
+ geolocationModule === null || geolocationModule === void 0 ? void 0 : geolocationModule.clearWatch(watchId);
+ if (lastAccruedPosition) {
+ createGeolocationObject(lastAccruedPosition);
+ }
+ else {
+ reject(new Error("Timeout expired"));
+ }
+ }
+ function onSuccess(position) {
+ if (!minimumAccuracy || Number(minimumAccuracy) >= position.coords.accuracy) {
+ clearTimeout(timeoutId);
+ geolocationModule === null || geolocationModule === void 0 ? void 0 : geolocationModule.clearWatch(watchId);
+ createGeolocationObject(position);
+ }
+ else {
+ if (!lastAccruedPosition || position.coords.accuracy < lastAccruedPosition.coords.accuracy) {
+ lastAccruedPosition = position;
+ }
+ }
+ }
+ function onError(error) {
+ return reject(new Error(error.message));
+ }
+ function getOptions() {
+ let timeoutNumber = timeout && Number(timeout.toString());
+ const maximumAgeNumber = maximumAge && Number(maximumAge.toString());
+ // If the timeout is 0 or undefined (empty), it causes a crash on iOS.
+ // If the timeout is undefined (empty); we set timeout to 30 sec (default timeout)
+ // If the timeout is 0; we set timeout to 1 hour (no timeout)
+ if ((reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform.OS) === "ios") {
+ if (timeoutNumber === undefined) {
+ timeoutNumber = 30000;
+ }
+ else if (timeoutNumber === 0) {
+ timeoutNumber = 3600000;
+ }
+ }
+ return {
+ timeout: timeoutNumber,
+ maximumAge: maximumAgeNumber,
+ enableHighAccuracy: highAccuracy
+ };
+ }
+ function mapPositionToMxObject(mxObject, position) {
+ mxObject.set("Timestamp", new Date(position.timestamp));
+ mxObject.set("Latitude", new Big(position.coords.latitude.toFixed(8)));
+ mxObject.set("Longitude", new Big(position.coords.longitude.toFixed(8)));
+ mxObject.set("Accuracy", new Big(position.coords.accuracy.toFixed(8)));
+ if (position.coords.altitude != null) {
+ mxObject.set("Altitude", new Big(position.coords.altitude.toFixed(8)));
+ }
+ if (position.coords.altitudeAccuracy != null && position.coords.altitudeAccuracy !== -1) {
+ mxObject.set("AltitudeAccuracy", new Big(position.coords.altitudeAccuracy.toFixed(8)));
+ }
+ if (position.coords.heading != null && position.coords.heading !== -1) {
+ mxObject.set("Heading", new Big(position.coords.heading.toFixed(8)));
+ }
+ if (position.coords.speed != null && position.coords.speed !== -1) {
+ mxObject.set("Speed", new Big(position.coords.speed.toFixed(8)));
+ }
+ return mxObject;
+ }
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.json b/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.json
new file mode 100644
index 0000000..9fd572c
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetCurrentLocationMinimumAccuracy.json
@@ -0,0 +1,6 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/geolocation": "2.0.2",
+ "react-native-geolocation-service": "5.2.0"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetGuid.js b/javascriptsource/nanoflowcommons/actions/GetGuid.js
new file mode 100644
index 0000000..195ae99
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetGuid.js
@@ -0,0 +1,25 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Get the Mendix Object GUID.
+ * @param {MxObject} entityObject - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetGuid(entityObject) {
+ // BEGIN USER CODE
+ if (!entityObject) {
+ return Promise.reject(new Error("Input parameter 'Entity object' is required."));
+ }
+ return Promise.resolve(entityObject.getGuid());
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetObjectByGuid.js b/javascriptsource/nanoflowcommons/actions/GetObjectByGuid.js
new file mode 100644
index 0000000..8843428
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetObjectByGuid.js
@@ -0,0 +1,41 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Get a Mendix object by its GUID.
+ * @param {string} entity - This field is required.
+ * @param {string} objectGuid - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetObjectByGuid(entity, objectGuid) {
+ // BEGIN USER CODE
+ if (!entity) {
+ return Promise.reject(new Error("Input parameter 'Entity' is required."));
+ }
+ if (!objectGuid) {
+ return Promise.reject(new Error("Input parameter 'Object guid' is required."));
+ }
+ return new Promise((resolve, reject) => {
+ mx.data.get({
+ guid: objectGuid,
+ callback: object => {
+ if (object) {
+ resolve(object);
+ }
+ else {
+ reject(new Error("'Object guid' not found"));
+ }
+ }
+ });
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetPlatform.js b/javascriptsource/nanoflowcommons/actions/GetPlatform.js
new file mode 100644
index 0000000..b65bffe
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetPlatform.js
@@ -0,0 +1,29 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Get the client platform (NanoflowCommons.Platform) where the action is running.
+ * @returns {Promise.<"NanoflowCommons.Platform.Web"|"NanoflowCommons.Platform.Native_mobile"|"NanoflowCommons.Platform.Hybrid_mobile">}
+ */
+export async function GetPlatform() {
+ // BEGIN USER CODE
+ if (window && window.cordova) {
+ return Promise.resolve("Hybrid_mobile");
+ }
+ else if (navigator && navigator.product === "ReactNative") {
+ return Promise.resolve("Native_mobile");
+ }
+ else {
+ return Promise.resolve("Web");
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetRemoteUrl.js b/javascriptsource/nanoflowcommons/actions/GetRemoteUrl.js
new file mode 100644
index 0000000..cd950b0
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetRemoteUrl.js
@@ -0,0 +1,20 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @returns {Promise.}
+ */
+export async function GetRemoteUrl() {
+ // BEGIN USER CODE
+ return mx.remoteUrl;
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.js b/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.js
new file mode 100644
index 0000000..77a84f4
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.js
@@ -0,0 +1,101 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Store a Mendix object in device storage, identified by a unique key. Can be accessed by the GetStorageItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {string} entity - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetStorageItemObject(key, entity) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!entity) {
+ return Promise.reject(new Error("Input parameter 'Entity' is required"));
+ }
+ return getItem(key).then(result => {
+ if (result === null) {
+ return Promise.reject(new Error(`Storage item '${key}' does not exist`));
+ }
+ const value = JSON.parse(result);
+ return getOrCreateMxObject(entity, value).then(newObject => {
+ const newValue = serializeMxObject(newObject);
+ return setItem(key, JSON.stringify(newValue)).then(() => newObject);
+ });
+ });
+ function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ const value = window.localStorage.getItem(key);
+ return Promise.resolve(value);
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function getOrCreateMxObject(entity, value) {
+ return getMxObject(value.guid).then(existingObject => {
+ if (existingObject) {
+ return existingObject;
+ }
+ else {
+ return createMxObject(entity, value);
+ }
+ });
+ }
+ function getMxObject(guid) {
+ return new Promise((resolve, reject) => {
+ mx.data.get({
+ guid,
+ callback: mxObject => resolve(mxObject),
+ error: error => reject(error)
+ });
+ });
+ }
+ function createMxObject(entity, value) {
+ return new Promise((resolve, reject) => {
+ mx.data.create({
+ entity,
+ callback: mxObject => {
+ Object.keys(value)
+ .filter(attribute => attribute !== "guid")
+ .forEach(attributeName => {
+ const attributeValue = value[attributeName];
+ mxObject.set(attributeName, attributeValue);
+ });
+ resolve(mxObject);
+ },
+ error: () => reject(new Error(`Could not create '${entity}' object`))
+ });
+ });
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.json b/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemObject.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.js b/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.js
new file mode 100644
index 0000000..05e4aba
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.js
@@ -0,0 +1,101 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Retrieve a local stored list of Mendix objects identified by a unique key. When objects are the client state it will be returned, if not they will be re-created. Note: when re-creating the local Mendix object the Mendix Object ID will never be the same.
+ * @param {string} key - This field is required.
+ * @param {string} entity - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetStorageItemObjectList(key, entity) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!entity) {
+ return Promise.reject(new Error("Input parameter 'Entity' is required"));
+ }
+ return getItem(key).then(result => {
+ if (result === null) {
+ return Promise.reject(new Error(`Storage item '${key}' does not exist`));
+ }
+ const values = JSON.parse(result);
+ return Promise.all(values.map(value => getOrCreateMxObject(entity, value))).then(newObjects => {
+ const newValues = newObjects.map(newObject => serializeMxObject(newObject));
+ return setItem(key, JSON.stringify(newValues)).then(() => newObjects);
+ });
+ });
+ function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ const value = window.localStorage.getItem(key);
+ return Promise.resolve(value);
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function getOrCreateMxObject(entity, value) {
+ return getMxObject(value.guid).then(existingObject => {
+ if (existingObject) {
+ return existingObject;
+ }
+ else {
+ return createMxObject(entity, value);
+ }
+ });
+ }
+ function getMxObject(guid) {
+ return new Promise((resolve, reject) => {
+ mx.data.get({
+ guid,
+ callback: mxObject => resolve(mxObject),
+ error: error => reject(error)
+ });
+ });
+ }
+ function createMxObject(entity, value) {
+ return new Promise((resolve, reject) => {
+ mx.data.create({
+ entity,
+ callback: mxObject => {
+ Object.keys(value)
+ .filter(attribute => attribute !== "guid")
+ .forEach(attributeName => {
+ const attributeValue = value[attributeName];
+ mxObject.set(attributeName, attributeValue);
+ });
+ resolve(mxObject);
+ },
+ error: () => reject(new Error(`Could not create '${entity}' object`))
+ });
+ });
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.json b/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemObjectList.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemString.js b/javascriptsource/nanoflowcommons/actions/GetStorageItemString.js
new file mode 100644
index 0000000..8c0d212
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemString.js
@@ -0,0 +1,42 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Retrieve a local stored string value identified by a unique key. This could be set via the SetStorageItemString JavaScript action.
+ *
+ * @param {string} key - This field is required.
+ * @returns {Promise.}
+ */
+export async function GetStorageItemString(key) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ return getItem(key).then(result => {
+ if (result === null) {
+ return Promise.reject(new Error(`Storage item '${key}' does not exist`));
+ }
+ return result;
+ });
+ async function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ const value = window.localStorage.getItem(key);
+ return Promise.resolve(value);
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStorageItemString.json b/javascriptsource/nanoflowcommons/actions/GetStorageItemString.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStorageItemString.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/GetStraightLineDistance.js b/javascriptsource/nanoflowcommons/actions/GetStraightLineDistance.js
new file mode 100644
index 0000000..ef03b45
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/GetStraightLineDistance.js
@@ -0,0 +1,56 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+function deg2rad(deg) {
+ return deg.times(Math.PI / 180);
+}
+function kmToStatueMile(km) {
+ return km.div(1.609344);
+}
+function kmToNauticalMile(km) {
+ return km.div(1.852);
+}
+// END EXTRA CODE
+
+/**
+ * @param {Big} latitudePoint1
+ * @param {Big} longitudePoint1
+ * @param {Big} latitudePoint2
+ * @param {Big} longitudePoint2
+ * @param {"NanoflowCommons.Enum_DistanceUnit.KILOMETER"|"NanoflowCommons.Enum_DistanceUnit.STATUTE_MILE"|"NanoflowCommons.Enum_DistanceUnit.NAUTICAL_MILE"} unit
+ * @returns {Promise.}
+ */
+export async function GetStraightLineDistance(latitudePoint1, longitudePoint1, latitudePoint2, longitudePoint2, unit) {
+ // BEGIN USER CODE
+ const R = 6371; // Radius of the earth in km
+ const dLat = deg2rad(latitudePoint2.minus(latitudePoint1)).toNumber();
+ const dLon = deg2rad(longitudePoint2.minus(longitudePoint1)).toNumber();
+ const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+ Math.cos(deg2rad(latitudePoint1).toNumber()) *
+ Math.cos(deg2rad(latitudePoint2).toNumber()) *
+ Math.sin(dLon / 2) *
+ Math.sin(dLon / 2);
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+ const d = new Big(R * c); // Distance in km
+ switch (unit) {
+ case "KILOMETER": {
+ return d;
+ }
+ case "STATUTE_MILE": {
+ return kmToStatueMile(d);
+ }
+ case "NAUTICAL_MILE": {
+ return kmToNauticalMile(d);
+ }
+ default:
+ throw new Error(`Unknown unit: ${unit}`);
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/HideProgress.js b/javascriptsource/nanoflowcommons/actions/HideProgress.js
new file mode 100644
index 0000000..50a0e95
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/HideProgress.js
@@ -0,0 +1,26 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Hides default progress bar
+ * @param {Big} identifier - Identifier of ui which should be hidden. This param is required
+ * @returns {Promise.}
+ */
+export async function HideProgress(identifier) {
+ // BEGIN USER CODE
+ if (identifier == null) {
+ return Promise.reject(new Error("Input parameter 'Identifier' is required"));
+ }
+ mx.ui.hideProgress(Number(identifier));
+ return Promise.resolve();
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/IsConnectedToServer.js b/javascriptsource/nanoflowcommons/actions/IsConnectedToServer.js
new file mode 100644
index 0000000..2717e2c
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/IsConnectedToServer.js
@@ -0,0 +1,27 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @returns {Promise.}
+ */
+export async function IsConnectedToServer() {
+ // BEGIN USER CODE
+ try {
+ const response = await fetch(mx.remoteUrl);
+ return response.ok;
+ }
+ catch (err) {
+ console.error(err);
+ return false;
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/LICENSE b/javascriptsource/nanoflowcommons/actions/LICENSE
new file mode 100644
index 0000000..564e565
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/LICENSE
@@ -0,0 +1,202 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2019 Mendix BV
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
\ No newline at end of file
diff --git a/javascriptsource/nanoflowcommons/actions/NavigateTo.js b/javascriptsource/nanoflowcommons/actions/NavigateTo.js
new file mode 100644
index 0000000..8944d1c
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/NavigateTo.js
@@ -0,0 +1,72 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Opens a navigation application on your device or a web browser showing Google Maps directions.
+ * @param {string} location - This field is required.
+ * @returns {Promise.}
+ */
+export async function NavigateTo(location) {
+ // BEGIN USER CODE
+ if (!location) {
+ return Promise.reject(new Error("Input parameter 'Location' is required"));
+ }
+ location = encodeURIComponent(location);
+ const iosUrl = `maps://maps.apple.com/?daddr=${location}`;
+ const androidUrl = `google.navigation:q=${location}`;
+ const webUrl = `https://maps.google.com/maps?daddr=${location}`;
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ const Platform = require("react-native").Platform;
+ const url = Platform.select({
+ ios: iosUrl,
+ default: androidUrl
+ });
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid or mobile web platform
+ if (window && window.navigator.userAgent) {
+ // iOS platform
+ if (/iPad|iPhone|iPod/i.test(window.navigator.userAgent)) {
+ openUrl(iosUrl);
+ return Promise.resolve(true);
+ }
+ // Android platform
+ if (/android|sink/i.test(window.navigator.userAgent)) {
+ openUrl(androidUrl);
+ return Promise.resolve(true);
+ }
+ }
+ // Desktop web or other platform
+ if (window) {
+ window.location.href = webUrl;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ function openUrl(url) {
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ }
+ // Mobile web platform
+ if (window) {
+ window.location.href = url;
+ }
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/OpenMap.js b/javascriptsource/nanoflowcommons/actions/OpenMap.js
new file mode 100644
index 0000000..be6ebc1
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/OpenMap.js
@@ -0,0 +1,72 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Opens a map application on your device or a web browser showing Google Maps.
+ * @param {string} location - Can be either address, latitude/longitude (51.906, 4.488) or interest point.This field is required.
+ * @returns {Promise.}
+ */
+export async function OpenMap(location) {
+ // BEGIN USER CODE
+ if (!location) {
+ return Promise.reject(new Error("Input parameter 'Location' is required"));
+ }
+ location = encodeURIComponent(location);
+ const iosUrl = `maps://maps.apple.com/?q=${location}`;
+ const androidUrl = `geo:0,0?q=${location}`;
+ const webUrl = `https://maps.google.com/maps?q=${location}`;
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ const Platform = require("react-native").Platform;
+ const url = Platform.select({
+ ios: iosUrl,
+ default: androidUrl
+ });
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid or mobile web platform
+ if (window && window.navigator.userAgent) {
+ // iOS platform
+ if (/iPad|iPhone|iPod/i.test(window.navigator.userAgent)) {
+ openUrl(iosUrl);
+ return Promise.resolve(true);
+ }
+ // Android platform
+ if (/android|sink/i.test(window.navigator.userAgent)) {
+ openUrl(androidUrl);
+ return Promise.resolve(true);
+ }
+ }
+ // Desktop web or other platform
+ if (window) {
+ window.location.href = webUrl;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ function openUrl(url) {
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ }
+ // Mobile web platform
+ if (window) {
+ window.location.href = url;
+ }
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/OpenURL.js b/javascriptsource/nanoflowcommons/actions/OpenURL.js
new file mode 100644
index 0000000..e96b3bd
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/OpenURL.js
@@ -0,0 +1,45 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Opens the provided URL in the web browser.
+ * @param {string} url - This field is required.
+ * @returns {Promise.}
+ */
+export async function OpenURL(url) {
+ // BEGIN USER CODE
+ if (!url) {
+ return Promise.reject(new Error("Input parameter 'Url' is required"));
+ }
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ return Promise.resolve(true);
+ }
+ // Web platform
+ if (window) {
+ window.location.href = url;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RefreshEntity.js b/javascriptsource/nanoflowcommons/actions/RefreshEntity.js
new file mode 100644
index 0000000..973ddbc
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RefreshEntity.js
@@ -0,0 +1,30 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Updates an entity without needing to refresh the whole page via passing an entity.
+ * @param {string} entityToRefresh - Entity which will be refreshed.
+ * @returns {Promise.}
+ */
+export async function RefreshEntity(entityToRefresh) {
+ // BEGIN USER CODE
+ if (!entityToRefresh) {
+ return Promise.reject(new Error("EntityToRefresh parameter is required"));
+ }
+ return new Promise(resolve => {
+ mx.data.update({
+ entity: entityToRefresh,
+ callback: () => resolve(true)
+ });
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RefreshObject.js b/javascriptsource/nanoflowcommons/actions/RefreshObject.js
new file mode 100644
index 0000000..6216ae4
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RefreshObject.js
@@ -0,0 +1,30 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Updates an entity object without needing to refresh the whole page via passing an entity object.
+ * @param {MxObject} objectToRefresh - Object which will be refreshed.
+ * @returns {Promise.}
+ */
+export async function RefreshObject(objectToRefresh) {
+ // BEGIN USER CODE
+ if (!objectToRefresh) {
+ return Promise.reject(new Error("ObjectToRefresh parameter is required"));
+ }
+ return new Promise(resolve => {
+ mx.data.update({
+ guid: objectToRefresh.getGuid(),
+ callback: () => resolve(true)
+ });
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Reload.js b/javascriptsource/nanoflowcommons/actions/Reload.js
new file mode 100644
index 0000000..363e682
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Reload.js
@@ -0,0 +1,25 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Reloads web and native applications.
+ * @returns {Promise.}
+ */
+export async function Reload() {
+ // BEGIN USER CODE
+ mx.reload();
+ return new Promise(() => {
+ // Never resolve this pormise to ensure that the next action in the nanoflow (if any)
+ // will not be executed before the actual reload is happended.
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.js b/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.js
new file mode 100644
index 0000000..e0b9d2d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.js
@@ -0,0 +1,36 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Remove a content identified by a unique key. This could be set via any of the Set Storage Item JavaScript actions
+ * @param {string} key - This field is required.
+ * @returns {Promise.}
+ */
+export async function RemoveStorageItem(key) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ return removeItem(key).then(() => true);
+ function removeItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.removeItem(key);
+ }
+ if (window) {
+ window.localStorage.removeItem(key);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.json b/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RemoveStorageItem.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.js b/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.js
new file mode 100644
index 0000000..9867ad6
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.js
@@ -0,0 +1,129 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import Geolocation from '@react-native-community/geolocation';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * On the native platform a request for permission should be made before the `GetCurrentLocation` action would work.
+ * @returns {Promise.}
+ */
+export async function RequestLocationPermission() {
+ // BEGIN USER CODE
+ var _a;
+ let reactNativeModule;
+ let geolocationModule;
+ const hasPermissionIOS = async () => {
+ const openSetting = () => {
+ reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Linking.openSettings().catch(() => {
+ reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Alert.alert("Unable to open settings.");
+ });
+ };
+ return geolocationModule
+ .requestAuthorization("whenInUse")
+ .then((status) => {
+ if (status === "granted") {
+ return true;
+ }
+ if (status === "denied") {
+ reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Alert.alert("Location permission denied.");
+ }
+ if (status === "disabled") {
+ reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Alert.alert("Location Services must be enabled to determine your location.", "", [
+ { text: "Go to Settings", onPress: openSetting },
+ {
+ text: "Don't Use Location"
+ }
+ ]);
+ }
+ return false;
+ });
+ };
+ const hasPermissionAndroid = async () => {
+ var _a, _b;
+ if (typeof ((_a = reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform) === null || _a === void 0 ? void 0 : _a.Version) === "number" && ((_b = reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform) === null || _b === void 0 ? void 0 : _b.Version) < 23) {
+ return true;
+ }
+ const androidLocationPermission = reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION;
+ if (!androidLocationPermission) {
+ return false;
+ }
+ return reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.check(androidLocationPermission).then(hasPermission => {
+ var _a;
+ return hasPermission
+ ? true
+ : (_a = reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid) === null || _a === void 0 ? void 0 : _a.request(androidLocationPermission).then(status => {
+ if (status === (reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.RESULTS.GRANTED)) {
+ return true;
+ }
+ if (status === (reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.RESULTS.DENIED)) {
+ reactNativeModule.ToastAndroid.show("Location permission denied by user.", reactNativeModule.ToastAndroid.LONG);
+ }
+ else if (status === (reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN)) {
+ reactNativeModule.ToastAndroid.show("Location permission revoked by user.", reactNativeModule.ToastAndroid.LONG);
+ }
+ return false;
+ });
+ });
+ };
+ const hasLocationPermission = async () => {
+ if ((reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform.OS) === "ios") {
+ const hasPermission = await hasPermissionIOS();
+ return hasPermission;
+ }
+ if ((reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform.OS) === "android") {
+ const hasPermission = await hasPermissionAndroid();
+ return hasPermission !== null && hasPermission !== void 0 ? hasPermission : false;
+ }
+ return Promise.reject(new Error("Unsupported platform"));
+ };
+ const hasLocationPermissionForOldLibrary = async () => {
+ if ((reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.Platform.OS) === "android") {
+ const locationPermission = reactNativeModule.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION;
+ return reactNativeModule.PermissionsAndroid.check(locationPermission).then(hasPermission => hasPermission
+ ? true
+ : reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.request(locationPermission).then(status => status === (reactNativeModule === null || reactNativeModule === void 0 ? void 0 : reactNativeModule.PermissionsAndroid.RESULTS.GRANTED)));
+ }
+ else if (geolocationModule && geolocationModule.requestAuthorization) {
+ try {
+ geolocationModule.requestAuthorization();
+ return Promise.resolve(true);
+ }
+ catch (error) {
+ return Promise.reject(error);
+ }
+ }
+ return false;
+ };
+ if (navigator && navigator.product === "ReactNative") {
+ reactNativeModule = require("react-native");
+ if (!reactNativeModule) {
+ return Promise.reject(new Error("React Native module could not be found"));
+ }
+ if (reactNativeModule.NativeModules.RNFusedLocation) {
+ geolocationModule = (await import('react-native-geolocation-service')).default;
+ return hasLocationPermission();
+ }
+ else if (reactNativeModule.NativeModules.RNCGeolocation) {
+ geolocationModule = Geolocation;
+ return (_a = (await hasLocationPermissionForOldLibrary())) !== null && _a !== void 0 ? _a : false;
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ }
+ else if (navigator && navigator.geolocation) {
+ return Promise.reject(new Error("No permission request for location is required for web/hybrid platform"));
+ }
+ else {
+ return Promise.reject(new Error("Geolocation module could not be found"));
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.json b/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.json
new file mode 100644
index 0000000..9fd572c
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/RequestLocationPermission.json
@@ -0,0 +1,6 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/geolocation": "2.0.2",
+ "react-native-geolocation-service": "5.2.0"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ReverseGeocode.js b/javascriptsource/nanoflowcommons/actions/ReverseGeocode.js
new file mode 100644
index 0000000..5da0cce
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ReverseGeocode.js
@@ -0,0 +1,109 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import Geodecoder from 'react-native-geocoder';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Reverse geocoding is the process of converting geographic coordinates (latitude and longitude) into a human-readable address.
+ * @param {string} latitude - This field is required.
+ * @param {string} longitude - This field is required.
+ * @param {"NanoflowCommons.GeocodingProvider.Google"|"NanoflowCommons.GeocodingProvider.Geocodio"|"NanoflowCommons.GeocodingProvider.LocationIQ"|"NanoflowCommons.GeocodingProvider.MapQuest"} geocodingProvider - This field is required for use on web.
+ * @param {string} providerApiKey - This field is required for use on web. Note that the keys are accessible by the end users and should be protected in other ways; for example restricted domain name.
+ * @returns {Promise.}
+ */
+export async function ReverseGeocode(latitude, longitude, geocodingProvider, providerApiKey) {
+ // BEGIN USER CODE
+ /**
+ * Documentation:
+ * - Native: https://github.com/devfd/react-native-geocoder
+ * - Google: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding
+ * - Geocodio: https://www.geocod.io/docs/#reverse-geocoding
+ * - LocationIQ: https://locationiq.com/docs-html/index.html#reverse-geocoding
+ * - MapQuest: https://developer.mapquest.com/documentation/open/geocoding-api/address/get/
+ */
+ if (!latitude) {
+ return Promise.reject(new Error("Input parameter 'Latitude' is required"));
+ }
+ if (!longitude) {
+ return Promise.reject(new Error("Input parameter 'Longitude' is required"));
+ }
+ if (navigator && navigator.product === "ReactNative") {
+ const position = { lat: Number(latitude), lng: Number(longitude) };
+ return Geodecoder.geocodePosition(position).then(results => {
+ if (results.length === 0) {
+ return Promise.reject(new Error("No results found"));
+ }
+ return results[0].formattedAddress;
+ });
+ }
+ if (!geocodingProvider) {
+ return Promise.reject(new Error("Input parameter 'Geocoding provider' is required for use on web"));
+ }
+ if (!providerApiKey) {
+ return Promise.reject(new Error("Input parameter 'Provider api key' is required for use on web"));
+ }
+ latitude = encodeURIComponent(latitude);
+ longitude = encodeURIComponent(longitude);
+ providerApiKey = encodeURIComponent(providerApiKey);
+ const url = getApiUrl(geocodingProvider, latitude, longitude, providerApiKey);
+ return fetch(url)
+ .then(response => response.json().catch(() => response.text().then(text => {
+ return Promise.reject(new Error(text));
+ })))
+ .then(response => getAddress(geocodingProvider, response))
+ .catch(error => Promise.reject(error));
+ function getApiUrl(provider, lat, long, key) {
+ switch (provider) {
+ case "Google":
+ return `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${long}&key=${key}`;
+ case "Geocodio":
+ return `https://api.geocod.io/v1.3/reverse?q=${lat},${long}&api_key=${key}`;
+ case "LocationIQ":
+ return `https://eu1.locationiq.com/v1/reverse.php?format=json&lat=${lat}&lon=${long}&key=${key}`;
+ case "MapQuest":
+ return `https://www.mapquestapi.com/geocoding/v1/reverse?location=${lat},${long}&key=${key}`;
+ }
+ }
+ function getAddress(provider, response) {
+ switch (provider) {
+ case "Google":
+ if (response.status !== "OK") {
+ throw new Error(response.error_message);
+ }
+ return response.results[0].formatted_address;
+ case "Geocodio":
+ if (response.error) {
+ throw new Error(response.error);
+ }
+ if (response.results.length === 0) {
+ throw new Error("No results found");
+ }
+ return response.results[0].formatted_address;
+ case "LocationIQ":
+ if (response.error) {
+ throw new Error(response.error);
+ }
+ return response.display_name;
+ case "MapQuest":
+ if (response.info.statuscode !== 0) {
+ throw new Error(response.info.messages.join(", "));
+ }
+ if (response.results.length === 0) {
+ throw new Error("No results found");
+ }
+ const location = response.results[0].locations[0];
+ const city = location.adminArea5;
+ const country = location.adminArea1;
+ return `${location.street}, ${location.postalCode} ${city}, ${country}`;
+ }
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ReverseGeocode.json b/javascriptsource/nanoflowcommons/actions/ReverseGeocode.json
new file mode 100644
index 0000000..aa3b0e5
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ReverseGeocode.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "react-native-geocoder": "0.5.0"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SendTextMessage.js b/javascriptsource/nanoflowcommons/actions/SendTextMessage.js
new file mode 100644
index 0000000..e83fb07
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SendTextMessage.js
@@ -0,0 +1,46 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Launches the text messaging app on your device.
+ * @param {string} phoneNumber - This field is required.
+ * @returns {Promise.}
+ */
+export async function SendTextMessage(phoneNumber) {
+ // BEGIN USER CODE
+ if (!phoneNumber) {
+ return Promise.reject(new Error("Input parameter 'Phone number' is required"));
+ }
+ const url = `sms:${encodeURI(phoneNumber)}`;
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Linking = require("react-native").Linking;
+ return Linking.canOpenURL(url).then(supported => {
+ if (!supported) {
+ return false;
+ }
+ return Linking.openURL(url).then(() => true);
+ });
+ }
+ // Hybrid platform
+ if (window && window.cordova) {
+ window.open(url, "_system");
+ return Promise.resolve(true);
+ }
+ // Web platform
+ if (window) {
+ window.location.href = url;
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.js b/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.js
new file mode 100644
index 0000000..f4ecff9
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.js
@@ -0,0 +1,47 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Store a Mendix object in device storage, identified by a unique key. Can be accesed by the GetStargeItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {MxObject} value - This field is required.
+ * @returns {Promise.}
+ */
+export async function SetStorageItemObject(key, value) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!value) {
+ return Promise.reject(new Error("Input parameter 'Value' is required"));
+ }
+ const serializedObject = serializeMxObject(value);
+ return setItem(key, JSON.stringify(serializedObject));
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.json b/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemObject.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.js b/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.js
new file mode 100644
index 0000000..004a1d3
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.js
@@ -0,0 +1,47 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Store a list of Mendix objects in device storage, identified by a unique key. Can be accessed by the GetStorageItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {MxObject[]} value - This field is required.
+ * @returns {Promise.}
+ */
+export async function SetStorageItemObjectList(key, value) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!value) {
+ return Promise.reject(new Error("Input parameter 'Value' is required"));
+ }
+ const serializedObjects = value.map(serializeMxObject);
+ return setItem(key, JSON.stringify(serializedObjects));
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ function serializeMxObject(object) {
+ return object.getAttributes().reduce((accumulator, attributeName) => {
+ accumulator[attributeName] = object.get(attributeName);
+ return accumulator;
+ }, { guid: object.getGuid() });
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.json b/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemObjectList.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemString.js b/javascriptsource/nanoflowcommons/actions/SetStorageItemString.js
new file mode 100644
index 0000000..7c0460a
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemString.js
@@ -0,0 +1,40 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Store a string value in the device storage, identified by a unique key. Can be accessed by the GetStorageItemObject action. Please note that users can clear the device storage.
+ * @param {string} key - This field is required.
+ * @param {string} value - This field is required.
+ * @returns {Promise.}
+ */
+export async function SetStorageItemString(key, value) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ if (!value) {
+ return Promise.reject(new Error("Input parameter 'Value' is required"));
+ }
+ return setItem(key, value);
+ function setItem(key, value) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.setItem(key, value);
+ }
+ if (window) {
+ window.localStorage.setItem(key, value);
+ return Promise.resolve();
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SetStorageItemString.json b/javascriptsource/nanoflowcommons/actions/SetStorageItemString.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SetStorageItemString.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Share.js b/javascriptsource/nanoflowcommons/actions/Share.js
new file mode 100644
index 0000000..dd18881
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Share.js
@@ -0,0 +1,58 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Action to invoke the native sharing mechanism of the device.
+ * @param {string} url - The url to share.
+ * @param {string} text - The text to share.
+ * @param {string} title - An optional title for the message or url to share. Only some share targets use this value.
+ * @returns {Promise.}
+ */
+export async function Share(url, text, title) {
+ // BEGIN USER CODE
+ if (!text && !url) {
+ return Promise.reject(new Error("It is required to provide at least one of input parameters 'Text' and 'Url'"));
+ }
+ // Native platform
+ // Documentation https://facebook.github.io/react-native/docs/share
+ if (navigator && navigator.product === "ReactNative") {
+ const RNShare = require("react-native").Share;
+ const content = url && text ? { message: text + "\n" + url, title } : url ? { url, title } : { message: text, title };
+ return RNShare.share(content).then(result => {
+ if (result.action === RNShare.dismissedAction) {
+ return false;
+ }
+ return true;
+ });
+ }
+ // Web platform
+ // Documentation https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share
+ if (navigator && navigator.share) {
+ return navigator.share({ url, text, title }).then(() => true);
+ }
+ // Hybrid platform
+ // Documentation https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
+ if (window && window.plugins && window.plugins.socialsharing) {
+ return new Promise((resolve, reject) => {
+ window.plugins.socialsharing.shareWithOptions({
+ message: text,
+ subject: title,
+ url
+ }, result => resolve(result.completed), errorMessage => reject(new Error(errorMessage)));
+ });
+ }
+ if (document && document.location && document.location.protocol === "http:") {
+ return Promise.reject(new Error("This action requires a secure https: connection"));
+ }
+ return Promise.reject(new Error("This action is not supported by this browser"));
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ShowConfirmation.js b/javascriptsource/nanoflowcommons/actions/ShowConfirmation.js
new file mode 100644
index 0000000..03e26d7
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ShowConfirmation.js
@@ -0,0 +1,50 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Shows a confirmation dialog during the execution of a nanoflow, to make perform actions based on the user input.
+ * @param {string} titleCaption - Set to empty to use default text 'Confirmation'. (Only for native)
+ * @param {string} question - This field is required.
+ * @param {string} cancelButtonCaption - Set to empty to use default text 'Cancel'.
+ * @param {string} proceedButtonCaption - Set to empty to use default text 'OK'.
+ * @returns {Promise.}
+ */
+export async function ShowConfirmation(titleCaption, question, cancelButtonCaption, proceedButtonCaption) {
+ // BEGIN USER CODE
+ if (!question) {
+ return Promise.reject(new Error("Input parameter 'Question' is required"));
+ }
+ const cancel = cancelButtonCaption || "Cancel";
+ const proceed = proceedButtonCaption || "OK";
+ const title = titleCaption || "Confirmation";
+ // Native platform
+ if (navigator && navigator.product === "ReactNative") {
+ const Alert = require("react-native").Alert;
+ return new Promise(resolve => {
+ Alert.alert(title, question, [
+ { text: cancel, onPress: () => resolve(false), style: "cancel" },
+ { text: proceed, onPress: () => resolve(true) }
+ ]);
+ });
+ }
+ // Other platforms
+ return new Promise(resolve => {
+ mx.ui.confirmation({
+ content: question,
+ proceed,
+ cancel,
+ handler: () => resolve(true),
+ onCancel: () => resolve(false)
+ });
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ShowProgress.js b/javascriptsource/nanoflowcommons/actions/ShowProgress.js
new file mode 100644
index 0000000..990f9dd
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ShowProgress.js
@@ -0,0 +1,27 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Shows default progress bar
+ * @param {string} message - The text to show while loading.
+ * @param {boolean} blocking - Block the user interface immediately.
+ * @returns {Promise.}
+ */
+export async function ShowProgress(message, blocking) {
+ // BEGIN USER CODE
+ const id = mx.ui.showProgress(message, blocking);
+ if (id !== undefined) {
+ return Promise.resolve(new Big(id));
+ }
+ return Promise.reject(new Error("Could not open the loading dialog"));
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SignIn.js b/javascriptsource/nanoflowcommons/actions/SignIn.js
new file mode 100644
index 0000000..ebb6bfd
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SignIn.js
@@ -0,0 +1,36 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Tries to login using a username and password.
+ *
+ * Returns an HTTP response status code, for example:
+ * - 200 when the login succeeds
+ * - 401 when the entered username or password is incorrect
+ * - 0 when the network connection is unavailable
+ *
+ * @param {string} username - This field is required.
+ * @param {string} password - This field is required.
+ * @returns {Promise.}
+ */
+export async function SignIn(username, password) {
+ // BEGIN USER CODE
+ if (!username || !password) {
+ return Promise.resolve(new Big(401));
+ }
+ return new Promise(resolve => {
+ const onSuccess = () => resolve(new Big(200));
+ const onError = (error) => resolve(new Big(error.status));
+ mx.login(username, password, onSuccess, onError);
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/SignOut.js b/javascriptsource/nanoflowcommons/actions/SignOut.js
new file mode 100644
index 0000000..e6652ad
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/SignOut.js
@@ -0,0 +1,28 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * If the user is logged in, logs out the user and restarts the client.
+ *
+ * If the user is not logged in, the return value is false
+ *
+ * @returns {Promise.}
+ */
+export async function SignOut() {
+ // BEGIN USER CODE
+ if (!mx.session.isGuest()) {
+ mx.logout();
+ return Promise.resolve(true);
+ }
+ return Promise.resolve(false);
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/StorageItemExists.js b/javascriptsource/nanoflowcommons/actions/StorageItemExists.js
new file mode 100644
index 0000000..6ce9b48
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/StorageItemExists.js
@@ -0,0 +1,36 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import AsyncStorage from '@react-native-community/async-storage';
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Check if an item exists in a device storage, identified by a unique key. The value could be set by a Set Storage Item action.
+ * @param {string} key - This field is required.
+ * @returns {Promise.}
+ */
+export async function StorageItemExists(key) {
+ // BEGIN USER CODE
+ if (!key) {
+ return Promise.reject(new Error("Input parameter 'Key' is required"));
+ }
+ return getItem(key).then(result => result !== null);
+ function getItem(key) {
+ if (navigator && navigator.product === "ReactNative") {
+ return AsyncStorage.getItem(key);
+ }
+ if (window) {
+ const value = window.localStorage.getItem(key);
+ return Promise.resolve(value);
+ }
+ return Promise.reject(new Error("No storage API available"));
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/StorageItemExists.json b/javascriptsource/nanoflowcommons/actions/StorageItemExists.json
new file mode 100644
index 0000000..a560d6d
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/StorageItemExists.json
@@ -0,0 +1,5 @@
+{
+ "nativeDependencies": {
+ "@react-native-community/async-storage": "1.12.1"
+ }
+}
diff --git a/javascriptsource/nanoflowcommons/actions/TimeBetween.js b/javascriptsource/nanoflowcommons/actions/TimeBetween.js
new file mode 100644
index 0000000..a321f61
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/TimeBetween.js
@@ -0,0 +1,50 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * The TimeBetween function calculates the difference between the input Date and times in milliseconds, seconds, minutes, hours or days, depending on the unitOfTime.
+ * @param {Date} startDate
+ * @param {Date} endDate
+ * @param {string} unitOfTime - Must be one of: "MILLISECOND"|"SECOND"|"MINUTE"|"HOUR"|"DAY"
+ * @returns {Promise.}
+ */
+export async function TimeBetween(startDate, endDate, unitOfTime) {
+ // BEGIN USER CODE
+ if (startDate == null) {
+ throw new Error("Required field: startDate");
+ }
+ if (endDate == null) {
+ throw new Error("Required field: endDate");
+ }
+ if (unitOfTime == null) {
+ throw new Error("Required field: unitOfTime");
+ }
+ const difference = endDate.getTime() - startDate.getTime();
+ function getDiff(difference, unit) {
+ switch (unit) {
+ case "MILLISECOND":
+ return difference;
+ case "SECOND":
+ return difference / 1000;
+ case "MINUTE":
+ return difference / 60000;
+ case "HOUR":
+ return difference / 3600000;
+ case "DAY":
+ return difference / 86400000;
+ default:
+ throw new Error("Unit of time not supported: " + unit);
+ }
+ }
+ return new Big(getDiff(difference, unitOfTime));
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/ToggleSidebar.js b/javascriptsource/nanoflowcommons/actions/ToggleSidebar.js
new file mode 100644
index 0000000..9579cd3
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/ToggleSidebar.js
@@ -0,0 +1,25 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @returns {Promise.}
+ */
+export async function ToggleSidebar() {
+ // BEGIN USER CODE
+ mx.ui.toggleSidebar();
+ // Web platform
+ if (window && !(navigator && navigator.product === "ReactNative")) {
+ document.dispatchEvent(new CustomEvent("toggleSidebar"));
+ }
+ return Promise.resolve();
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/Wait.js b/javascriptsource/nanoflowcommons/actions/Wait.js
new file mode 100644
index 0000000..09474df
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/Wait.js
@@ -0,0 +1,27 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Wait for number of milliseconds before continuing nanoflow execution.
+ * @param {Big} delay - The number of milliseconds to wait. This field is required.
+ * @returns {Promise.}
+ */
+export async function Wait(delay) {
+ // BEGIN USER CODE
+ if (delay == null) {
+ return Promise.reject(new Error("Input parameter 'delay' is required."));
+ }
+ return new Promise(resolve => {
+ setTimeout(() => resolve(), Number(delay));
+ });
+ // END USER CODE
+}
diff --git a/javascriptsource/nanoflowcommons/actions/dependencies.json b/javascriptsource/nanoflowcommons/actions/dependencies.json
new file mode 100644
index 0000000..624d87b
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/dependencies.json
@@ -0,0 +1 @@
+[{"react-native-geocoder":{"version":"0.5.0","transitive":false,"url":"https://github.com/devfd/react-native-geocoder"}},{"@react-native-community/geolocation":{"version":"2.0.2","transitive":false,"url":"https://github.com/react-native-community/react-native-geolocation#README.md"}},{"react-native-geolocation-service":{"version":"5.2.0","transitive":false,"url":"https://github.com/Agontuk/react-native-geolocation-service"}},{"@react-native-community/async-storage":{"version":"1.12.1","transitive":false,"url":"https://github.com/react-native-community/react-native-async-storage#readme"}},{"deep-assign":{"version":"3.0.0","transitive":true,"url":null}},{"is-obj":{"version":"1.0.1","transitive":true,"url":null}},{"js-base64":{"version":"3.7.2","transitive":false,"url":null}}]
\ No newline at end of file
diff --git a/javascriptsource/nanoflowcommons/actions/dependencies.txt b/javascriptsource/nanoflowcommons/actions/dependencies.txt
new file mode 100644
index 0000000..60f76f9
--- /dev/null
+++ b/javascriptsource/nanoflowcommons/actions/dependencies.txt
@@ -0,0 +1,217 @@
+Name: react-native-geocoder
+Version: 0.5.0
+License: MIT
+Private: false
+Description: react native geocoding and reverse geocoding
+Repository: https://github.com/devfd/react-native-geocoder
+Homepage: https://github.com/devfd/react-native-geocoder
+License Copyright:
+===
+
+The MIT License (MIT)
+
+Copyright (c) 2015 Alexey
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+
+---
+
+Name: @react-native-community/geolocation
+Version: 2.0.2
+License: MIT
+Private: false
+Description: React Native Geolocation Module for iOS and Android
+Homepage: https://github.com/react-native-community/react-native-geolocation#README.md
+
+---
+
+Name: react-native-geolocation-service
+Version: 5.2.0
+License: MIT
+Private: false
+Description: React native geolocation service for iOS and android
+Repository: https://github.com/Agontuk/react-native-geolocation-service
+Homepage: https://github.com/Agontuk/react-native-geolocation-service
+License Copyright:
+===
+
+The MIT License (MIT)
+Copyright (c) 2018 Iftekhar Rifat
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+---
+
+Name: @react-native-community/async-storage
+Version: 1.12.1
+License: MIT
+Private: false
+Description: Asynchronous, persistent, key-value storage system for React Native.
+Repository: https://github.com/react-native-community/react-native-async-storage.git
+Homepage: https://github.com/react-native-community/react-native-async-storage#readme
+License Copyright:
+===
+
+MIT License
+
+Copyright (c) 2015-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+---
+
+Name: deep-assign
+Version: 3.0.0
+License: MIT
+Private: false
+Description: Recursive Object.assign()
+Repository: sindresorhus/deep-assign
+License Copyright:
+===
+
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+---
+
+Name: is-obj
+Version: 1.0.1
+License: MIT
+Private: false
+Description: Check if a value is an object
+Repository: sindresorhus/is-obj
+License Copyright:
+===
+
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+---
+
+Name: js-base64
+Version: 3.7.2
+License: BSD-3-Clause
+Private: false
+Description: Yet another Base64 transcoder in pure-JS
+Repository: git+https://github.com/dankogai/js-base64.git
+License Copyright:
+===
+
+Copyright (c) 2014, Dan Kogai
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of {{{project}}} nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/javascriptsource/webactions/.version b/javascriptsource/webactions/.version
new file mode 100644
index 0000000..f161b5d
--- /dev/null
+++ b/javascriptsource/webactions/.version
@@ -0,0 +1 @@
+2.10.0
\ No newline at end of file
diff --git a/javascriptsource/webactions/LICENSE b/javascriptsource/webactions/LICENSE
new file mode 100644
index 0000000..51dfbf5
--- /dev/null
+++ b/javascriptsource/webactions/LICENSE
@@ -0,0 +1,201 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2020 Mendix Technology BV
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/javascriptsource/webactions/actions/FocusHelper.js b/javascriptsource/webactions/actions/FocusHelper.js
new file mode 100644
index 0000000..68a7273
--- /dev/null
+++ b/javascriptsource/webactions/actions/FocusHelper.js
@@ -0,0 +1,322 @@
+export function setFocus(element) {
+ clearSelection();
+ element.focus();
+ selectText(element);
+}
+
+function clearSelection() {
+ // This is necessary for IE and Edge
+ const selection = document.getSelection();
+ if (selection === null || isEmptySelection(selection)) {
+ // Prevent IE11 from switching focus to document.body unless absolutely necessary
+ return;
+ }
+ selection.removeAllRanges();
+ selection.addRange(document.createRange());
+}
+
+function isEmptySelection(selection) {
+ if (selection.rangeCount === 1) {
+ const range = selection.getRangeAt(0);
+ return range.startOffset === range.endOffset;
+ }
+ return selection.rangeCount === 0;
+}
+
+function selectText(element) {
+ const input = element;
+ if (input.type === "text" || input.type === "password") {
+ input.select();
+ }
+}
+
+export function getFocus() {
+ const activeElement = document.activeElement && getHTMLElement(document.activeElement);
+ return activeElement !== document.body ? activeElement : null;
+}
+
+export function clearFocus() {
+ const current = getFocus();
+ if (current) {
+ current.blur();
+ }
+}
+
+export function focusFirst(container) {
+ const first = findFirst(container);
+ if (first) {
+ setFocus(first);
+ }
+}
+
+export function focusNext() {
+ const next = findNext(getFocus());
+ if (next) {
+ setFocus(next);
+ }
+}
+
+export function findFirst(container) {
+ return findNextInContainer(container, false);
+}
+
+export function findNext(target, reverse = false) {
+ var _a;
+ const element = target && getHTMLElement(target);
+ const next = () => element && findNextNonWrapping(element, reverse);
+ const wrapAround = () => {
+ var _a;
+ return findNextNonWrapping(
+ (_a = getFocusCapturingRoot(element)) !== null && _a !== void 0 ? _a : document.body,
+ reverse
+ );
+ };
+ return (_a = next()) !== null && _a !== void 0 ? _a : wrapAround();
+}
+
+function findNextNonWrapping(element, reverse = false) {
+ const focusRoot = getFocusRoot(element);
+ let current;
+ if (!focusRoot.contains(element)) {
+ if (isFocusable(focusRoot)) {
+ return focusRoot;
+ }
+ current = focusRoot;
+ } else {
+ current = element;
+ }
+ let found;
+ if (!reverse && isFocusContext(current) && !skipContainer(current)) {
+ found = findNextInContainer(current, !!reverse);
+ if (found) {
+ return found;
+ }
+ }
+ do {
+ const context = findFocusContext(current, focusRoot);
+ found = findNextInContainer(context, !!reverse, current);
+ if (found) {
+ return found;
+ }
+ if (reverse && isFocusable(context)) {
+ return context;
+ }
+ current = context;
+ } while (current !== focusRoot);
+ return null;
+}
+
+const FOCUS_CONTEXT_ATTRIBUTE = "data-focusindex";
+const FOCUS_CAPTURING_ATTRIBUTE = "data-focus-capturing";
+const FOCUS_CAPTURING_MODAL = "modal";
+const FOCUS_CAPTURING_NON_MODAL = "non-modal";
+
+function findFocusContext(element, focusRoot) {
+ if (element === focusRoot) {
+ return focusRoot;
+ }
+ let current = element;
+ while (current !== focusRoot && current.parentElement) {
+ current = current.parentElement;
+ if (isFocusContext(current)) {
+ return current;
+ }
+ }
+ return focusRoot;
+}
+
+function getFocusRoot(element) {
+ var _a;
+ const capturingRoot = getFocusCapturingRoot(element);
+ if (!capturingRoot) {
+ // We're outside all focus capturing elements, e.g. in a floating popup
+ return document.body;
+ }
+ return (_a = getModalFocusRoot()) !== null && _a !== void 0 ? _a : capturingRoot;
+}
+
+function getModalFocusRoot() {
+ const focusRoots = document.querySelectorAll(`[${FOCUS_CAPTURING_ATTRIBUTE}=${FOCUS_CAPTURING_MODAL}]`);
+ const focusRoot = focusRoots.length ? focusRoots[focusRoots.length - 1] : null;
+ return focusRoot && isHTMLElement(focusRoot) ? focusRoot : null;
+}
+
+function getFocusCapturingRoot(element) {
+ if (!element || element === document.body) {
+ return document.body;
+ }
+ let current = element;
+ while (current && isHTMLElement(current)) {
+ const captureMode = current.getAttribute(FOCUS_CAPTURING_ATTRIBUTE);
+ if (captureMode === FOCUS_CAPTURING_MODAL || captureMode === FOCUS_CAPTURING_NON_MODAL) {
+ return current;
+ }
+ current = current.parentElement;
+ }
+ return null;
+}
+
+function findNextInContainer(container, reverse, afterElement) {
+ const startTabIndex = afterElement && afterElement !== container ? getEffectiveTabIndex(afterElement) : undefined;
+ const candidates = gatherDescendants(container);
+ const tabIndices = Object.keys(candidates)
+ .map(s => parseInt(s, 10))
+ .filter(tabIndexFilter(startTabIndex, reverse))
+ .sort(compareTabIndex);
+ if (reverse) {
+ tabIndices.reverse();
+ }
+ for (const tabIndex of tabIndices) {
+ let array = candidates[tabIndex];
+ if (array !== undefined) {
+ if (reverse) {
+ array.reverse();
+ }
+ if (tabIndex === startTabIndex) {
+ array = array.slice(array.indexOf(afterElement) + 1);
+ }
+ const candidate = findNextInArray(array, reverse);
+ if (candidate) {
+ return candidate;
+ }
+ }
+ }
+ return null;
+}
+
+function findNextInArray(array, reverse) {
+ for (const element of array) {
+ if (!reverse && isFocusable(element)) {
+ return element;
+ }
+ if (isFocusContext(element) && !skipContainer(element)) {
+ const candidate = findNextInContainer(element, reverse);
+ if (candidate) {
+ return candidate;
+ }
+ }
+ if (reverse && isFocusable(element)) {
+ return element;
+ }
+ }
+ return null;
+}
+
+function gatherDescendants(e, output = {}) {
+ for (let i = 0; i < e.children.length; i++) {
+ const child = e.children.item(i);
+ if (!isHTMLElement(child)) {
+ continue;
+ }
+ const tabIndex = getEffectiveTabIndex(child);
+ const elements = (output[tabIndex] = tabIndex in output ? output[tabIndex] : []);
+ elements.push(child);
+ if (!isFocusContext(child)) {
+ gatherDescendants(child, output);
+ }
+ }
+ return output;
+}
+
+function tabIndexFilter(startTabIndex, reverse) {
+ return startTabIndex === undefined
+ ? () => true
+ : reverse
+ ? t => compareTabIndex(t, startTabIndex) <= 0
+ : t => compareTabIndex(t, startTabIndex) >= 0;
+}
+
+function compareTabIndex(a, b) {
+ return a === b ? 0 : a === 0 ? 1 : b === 0 ? -1 : a - b;
+}
+
+function isFocusContext(element) {
+ return element === document.body || element.getAttribute(FOCUS_CONTEXT_ATTRIBUTE) !== null;
+}
+
+function getEffectiveTabIndex(element) {
+ const focusIndex = getIntAttribute(element, FOCUS_CONTEXT_ATTRIBUTE);
+ const tabIndexValue = focusIndex !== null ? focusIndex : getTabIndex(element);
+ // An element with tabindex -1 is placed within the natural order of elements with effective tabindex 0
+ return Math.max(0, tabIndexValue !== null && tabIndexValue !== void 0 ? tabIndexValue : 0);
+}
+
+function getTabIndex(element) {
+ const tabIndex = getIntAttribute(element, "tabindex");
+ return tabIndex !== -32768 ? tabIndex : null; // -32768 is returned by IE/Edge for tabindex="" :(
+}
+
+function getIntAttribute(element, attribute) {
+ const value = element.getAttribute(attribute);
+ return value ? parseInt(value, 10) : null;
+}
+
+function skipContainer(element) {
+ return element.getAttribute(FOCUS_CONTEXT_ATTRIBUTE) === "-1";
+}
+
+export function isFocusable(element) {
+ return isNavigableElement(element) && isInteractive(element);
+}
+
+export function isNavigableElement(element) {
+ if (skipContainer(element)) {
+ return false;
+ }
+ const tabIndex = getTabIndex(element);
+ return (tabIndex === null ? getDefaultTabIndex(element) : tabIndex) >= 0;
+}
+
+export function getFocusableContainer(target) {
+ let element = getHTMLElement(target);
+ while (element) {
+ if (getTabIndex(element) !== null || getDefaultTabIndex(element) === 0) {
+ return element;
+ }
+ element = element.parentElement;
+ }
+ return null;
+}
+
+function getDefaultTabIndex(element) {
+ // We have to check this ourselves, because IE and Edge return the wrong default value for the tabIndex JS property.
+ switch (element.tagName.toLowerCase()) {
+ case "a":
+ case "area":
+ case "button":
+ case "input":
+ case "object":
+ case "select":
+ case "textarea":
+ return 0;
+ default:
+ return element.getAttribute("contenteditable") ? 0 : -1;
+ }
+}
+
+export function isInteractive(element) {
+ return isVisible(element) && isEnabled(element);
+}
+
+function isVisible(element) {
+ if (element.offsetWidth === 0 && element.offsetHeight === 0) {
+ return false;
+ }
+ return window.getComputedStyle(element).visibility === "visible";
+}
+
+function isEnabled(element) {
+ return !element.disabled;
+}
+
+export function getHTMLElement(target) {
+ return isHTMLElement(target) ? target : isNode(target) ? target.parentElement : null;
+}
+
+function isNode(target) {
+ return target.parentElement !== undefined;
+}
+
+export function isHTMLElement(target) {
+ return target.offsetParent !== undefined;
+}
diff --git a/javascriptsource/webactions/actions/FocusNext.js b/javascriptsource/webactions/actions/FocusNext.js
new file mode 100644
index 0000000..3ad313b
--- /dev/null
+++ b/javascriptsource/webactions/actions/FocusNext.js
@@ -0,0 +1,23 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import { focusNext } from "./FocusHelper";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Move the keyboard focus to the next element that can be focused.
+ * @returns {Promise.}
+ */
+export async function FocusNext() {
+ // BEGIN USER CODE
+ focusNext();
+ return Promise.resolve();
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/FocusPrevious.js b/javascriptsource/webactions/actions/FocusPrevious.js
new file mode 100644
index 0000000..4e27285
--- /dev/null
+++ b/javascriptsource/webactions/actions/FocusPrevious.js
@@ -0,0 +1,29 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import { findNext, getFocus, setFocus } from "./FocusHelper";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Move the keyboard focus to the previous element that can be focused.
+ * @returns {Promise.}
+ */
+export async function FocusPrevious() {
+ // BEGIN USER CODE
+ function focusPrevious() {
+ const previous = findNext(getFocus(), true);
+ if (previous) {
+ setFocus(previous);
+ }
+ }
+ focusPrevious();
+ return Promise.resolve();
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/ReadCookie.js b/javascriptsource/webactions/actions/ReadCookie.js
new file mode 100644
index 0000000..b61c418
--- /dev/null
+++ b/javascriptsource/webactions/actions/ReadCookie.js
@@ -0,0 +1,23 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {string} key
+ * @returns {Promise.}
+ */
+export async function ReadCookie(key) {
+ // BEGIN USER CODE
+ const entry = document.cookie.split("; ").find(row => row.startsWith(`${key}=`));
+ const value = entry ? entry.split("=")[1] : undefined;
+ return value ? value : "";
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/ScrollTo.js b/javascriptsource/webactions/actions/ScrollTo.js
new file mode 100644
index 0000000..30312f9
--- /dev/null
+++ b/javascriptsource/webactions/actions/ScrollTo.js
@@ -0,0 +1,31 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Scroll the window to make targeted element visible
+ * @param {string} targetSelector - Selector to reach the element to be scrolled to. Examples: .warning to scroll to an element with the class warning, or .mx-name-textBox1 to scroll to a text box with the class mx-name-textBox1 (and name textBox1).
+ * @returns {Promise.}
+ */
+export async function ScrollTo(targetSelector) {
+ // BEGIN USER CODE
+ const element = document.querySelector(targetSelector);
+ if (element) {
+ element.scrollIntoView({
+ behavior: "smooth",
+ block: "start",
+ inline: "nearest"
+ });
+ } else {
+ console.log("no item found");
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/SetCookie.js b/javascriptsource/webactions/actions/SetCookie.js
new file mode 100644
index 0000000..db44f1a
--- /dev/null
+++ b/javascriptsource/webactions/actions/SetCookie.js
@@ -0,0 +1,26 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * @param {string} key
+ * @param {string} value
+ * @returns {Promise.}
+ */
+export async function SetCookie(key, value) {
+ // BEGIN USER CODE
+ try {
+ document.cookie = key + "=" + value + ";";
+ } catch (e) {
+ console.error(e);
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/SetFavicon.js b/javascriptsource/webactions/actions/SetFavicon.js
new file mode 100644
index 0000000..3756d4b
--- /dev/null
+++ b/javascriptsource/webactions/actions/SetFavicon.js
@@ -0,0 +1,56 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+function cloneWithNewUrl(link, href) {
+ const target = link.cloneNode();
+ const search = new URL(link.href).search;
+ target.href = href;
+ const targetHref = new URL(target.href);
+ targetHref.search = search;
+ target.href = targetHref.toString();
+ return target;
+}
+// END EXTRA CODE
+
+/**
+ * @param {string} iconUrl16x16
+ * @param {string} iconUrl32x32
+ * @param {string} appleTouchIconUrl
+ * @returns {Promise.}
+ */
+export async function SetFavicon(iconUrl16x16, iconUrl32x32, appleTouchIconUrl) {
+ // BEGIN USER CODE
+ const entries = [
+ ['link[rel="icon"][sizes="16x16"]', iconUrl16x16, "16x16"],
+ ['link[rel="icon"][sizes="32x32"]', iconUrl32x32, "32x32"],
+ ['link[rel="apple-touch-icon"]', appleTouchIconUrl]
+ ];
+ const links = entries.reduce((acc, [selector, href, sizes]) => {
+ const element = document.querySelector(selector);
+ if (element) {
+ acc.push(cloneWithNewUrl(element, href));
+ element.remove();
+ } else {
+ const link = document.createElement("link");
+ link.href = href;
+ const bypassCacheHref = new URL(link.href);
+ bypassCacheHref.search = "v" + Date.now();
+ link.href = bypassCacheHref.toString();
+ link.rel = "icon";
+ if (sizes) {
+ link.sizes = sizes;
+ }
+ acc.push(link);
+ }
+ return acc;
+ }, []);
+ document.head.append(...links);
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/SetFocus.js b/javascriptsource/webactions/actions/SetFocus.js
new file mode 100644
index 0000000..fcf6046
--- /dev/null
+++ b/javascriptsource/webactions/actions/SetFocus.js
@@ -0,0 +1,33 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+import { isFocusable, focusFirst, setFocus } from "./FocusHelper";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Set focus to the element found with the selector, The element should be able to hold focus like a link, button, or input.
+ * @param {string} targetSelector - Selector to reach the element to give focus. Examples: .warning to scroll to focus element with the class warning, or .mx-name-textBox1 to focus to a text box with the class mx-name-textBox1 (and name textBox1).
+ * @returns {Promise.}
+ */
+export async function SetFocus(targetSelector) {
+ // BEGIN USER CODE
+ const targetNode = targetSelector ? document.querySelector(targetSelector) : null;
+ if (targetNode) {
+ if (isFocusable(targetNode)) {
+ setFocus(targetNode);
+ } else {
+ // If the target is not focusable, select the first focusable within
+ focusFirst(targetNode);
+ }
+ } else {
+ console.warn(`No DOM node found to set focus for query selector ${targetSelector}`);
+ }
+ // END USER CODE
+}
diff --git a/javascriptsource/webactions/actions/TakePicture.js b/javascriptsource/webactions/actions/TakePicture.js
new file mode 100644
index 0000000..f97e54f
--- /dev/null
+++ b/javascriptsource/webactions/actions/TakePicture.js
@@ -0,0 +1,412 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+import { Big } from "big.js";
+
+// BEGIN EXTRA CODE
+// END EXTRA CODE
+
+/**
+ * Take a picture using the device's camera.
+ * @param {MxObject} picture - This is required.
+ * @param {boolean} showConfirmationScreen
+ * @param {"WebActions.PictureQuality.original"|"WebActions.PictureQuality.low"|"WebActions.PictureQuality.medium"|"WebActions.PictureQuality.high"|"WebActions.PictureQuality.custom"} pictureQuality - The default picture quality is 'Medium'.
+ * @param {Big} maximumWidth - The picture will be scaled to this maximum pixel width, while maintaining the aspect ratio.
+ * @param {Big} maximumHeight - The picture will be scaled to this maximum pixel height, while maintaining the aspect ratio.
+ * @returns {Promise.}
+ */
+export async function TakePicture(picture, showConfirmationScreen, pictureQuality, maximumWidth, maximumHeight) {
+ // BEGIN USER CODE
+ const CAMERA_POSITION = {
+ BACK_CAMERA: "environment",
+ FRONT_CAMERA: "user"
+ };
+ const getUserText = prepareLanguage();
+ if (!picture) {
+ return Promise.reject(new Error("Input parameter 'Picture' is required."));
+ }
+ if (!picture.inheritsFrom("System.Image")) {
+ return Promise.reject(new Error(`Entity ${picture.getEntity()} does not inherit from 'System.Image'.`));
+ }
+ if (!("mediaDevices" in navigator) || !("getUserMedia" in navigator.mediaDevices)) {
+ return Promise.reject(new Error("Media devices are not supported."));
+ }
+ if (pictureQuality === "custom" && !maximumHeight && !maximumWidth) {
+ return Promise.reject(
+ new Error("Picture quality is set to 'Custom', but no maximum width or height was provided")
+ );
+ }
+ // TODO: WC-463 rollup has a bug where comments are removed from the top of files, disallowing imports between "extra code" comments. Until this is fixed, SVGs are manually encoded and added here.
+ const closeSVG =
+ "PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xOC4yMjIyIDE2LjAwMDNMMjYuNTM5NyA3LjY4MjhDMjcuMTU0MSA3LjA2ODM4IDI3LjE1NDEgNi4wNzUyNCAyNi41Mzk3IDUuNDYwODJDMjUuOTI1MyA0Ljg0NjM5IDI0LjkzMjEgNC44NDYzOSAyNC4zMTc3IDUuNDYwODJMMTYuMDAwMiAxMy43NzgzTDcuNjgyNzkgNS40NjA4MkM3LjA2ODM3IDQuODQ2MzkgNi4wNzUyNCA0Ljg0NjM5IDUuNDYwODIgNS40NjA4MkM0Ljg0NjM5IDYuMDc1MjQgNC44NDYzOSA3LjA2ODM4IDUuNDYwODIgNy42ODI4TDEzLjc3ODMgMTYuMDAwM0w1LjQ2MDgyIDI0LjMxNzhDNC44NDYzOSAyNC45MzIzIDQuODQ2MzkgMjUuOTI1NCA1LjQ2MDgyIDI2LjUzOThDNS43NjcyNCAyNi44NDYzIDYuMTY5NTIgMjcuMDAwMyA2LjU3MTggMjcuMDAwM0M2Ljk3NDA4IDI3LjAwMDMgNy4zNzYzNiAyNi44NDYzIDcuNjgyNzkgMjYuNTM5OEwxNi4wMDAyIDE4LjIyMjNMMjQuMzE3NyAyNi41Mzk4QzI0LjYyNDEgMjYuODQ2MyAyNS4wMjY0IDI3LjAwMDMgMjUuNDI4NyAyNy4wMDAzQzI1LjgzMSAyNy4wMDAzIDI2LjIzMzMgMjYuODQ2MyAyNi41Mzk3IDI2LjUzOThDMjcuMTU0MSAyNS45MjU0IDI3LjE1NDEgMjQuOTMyMyAyNi41Mzk3IDI0LjMxNzhMMTguMjIyMiAxNi4wMDAzWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==";
+ const syncSVG =
+ "PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTk5IDVDMTIuNzA5MyA1IDkuNzU0NzQgNi40NDQ1NCA3LjczNzY2IDguNzM3NjJMMTAuMTQ2NCAxMS4xNDY0QzEwLjQ2MTQgMTEuNDYxNCAxMC4yMzgzIDEyIDkuNzkyOSAxMkgyLjVDMi4yMjM4NiAxMiAyIDExLjc3NjEgMiAxMS41VjQuMjA3MDZDMiAzLjc2MTYgMi41Mzg1OCAzLjUzODUyIDIuODUzNTYgMy44NTM1TDUuNjEzMiA2LjYxMzE2QzguMTczOTIgMy43ODE1IDExLjg3ODIgMiAxNS45OTk5IDJDMjMuMTY0NCAyIDI5LjA3MDIgNy4zODA0MiAyOS45MDAyIDE0LjMyMTlDMjkuOTk4NiAxNS4xNDQ0IDI5LjQxMTYgMTUuODkxIDI4LjU4OSAxNS45ODk0QzI3Ljc2NjQgMTYuMDg3OCAyNy4wMTk4IDE1LjUwMDcgMjYuOTIxNCAxNC42NzgxQzI2LjI2OTYgOS4yMjY5IDIxLjYyNzIgNSAxNS45OTk5IDVaTTMuNDEwOSAxNi4wMTA2QzQuMjMzNDYgMTUuOTEyMiA0Ljk4MDAyIDE2LjQ5OTMgNS4wNzg0IDE3LjMyMTlDNS43MzAzMiAyMi43NzMgMTAuMzcyNiAyNyAxNS45OTk5IDI3QzE5LjI5MDYgMjcgMjIuMjQ1MiAyNS41NTU0IDI0LjI2MjIgMjMuMjYyNEwyMS44NTM2IDIwLjg1MzZDMjEuNTM4NiAyMC41Mzg2IDIxLjc2MTYgMjAgMjIuMjA3MiAyMEgyOS41QzI5Ljc3NjIgMjAgMzAgMjAuMjI0IDMwIDIwLjVWMjcuNzkzQzMwIDI4LjIzODQgMjkuNDYxNCAyOC40NjE0IDI5LjE0NjQgMjguMTQ2NEwyNi4zODY4IDI1LjM4NjhDMjMuODI2IDI4LjIxODQgMjAuMTIxNiAzMCAxNS45OTk5IDMwQzguODM1NDIgMzAgMi45Mjk3OCAyNC42MTk2IDIuMDk5NjIgMTcuNjc4MUMyLjAwMTI2IDE2Ljg1NTYgMi41ODgzNCAxNi4xMDkgMy40MTA5IDE2LjAxMDZaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K";
+ const cameraButtonSVG =
+ "PHN2ZyB3aWR0aD0iNzAiIGhlaWdodD0iNzAiIHZpZXdCb3g9IjAgMCA3MCA3MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMzUiIGN5PSIzNSIgcj0iMzUiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjM1IiBjeT0iMzUiIHI9IjI4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+Cjwvc3ZnPgo=";
+ const saveSVG =
+ "PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTI5Ljc1ODMgNS4zOTY5NEMzMC40MDY5IDUuOTczNTMgMzAuNDY1NCA2Ljk2Njc5IDI5Ljg4ODggNy42MTU0NEwxMy4xMjY5IDI2LjQ3MjZDMTIuODI4NyAyNi44MDgxIDEyLjQwMTIgMjcgMTEuOTUyNCAyN0MxMS41MDM1IDI3IDExLjA3NjEgMjYuODA4MSAxMC43Nzc5IDI2LjQ3MjZMMi4zOTY5NCAxNy4wNDRDMS44MjAzNiAxNi4zOTUzIDEuODc4NzkgMTUuNDAyMSAyLjUyNzQ0IDE0LjgyNTVDMy4xNzYxIDE0LjI0ODkgNC4xNjkzNiAxNC4zMDc0IDQuNzQ1OTQgMTQuOTU2TDExLjk1MjQgMjMuMDYzM0wyNy41Mzk4IDUuNTI3NDRDMjguMTE2NCA0Ljg3ODc5IDI5LjEwOTYgNC44MjAzNiAyOS43NTgzIDUuMzk2OTRaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K";
+ // eslint-disable-next-line no-async-promise-executor
+ return new Promise(async (resolve, reject) => {
+ let error;
+ let stream;
+ let videoIsReady = false;
+ let shouldFaceEnvironment = true;
+ const {
+ video,
+ wrapper,
+ actionControl,
+ switchControl,
+ closeControl,
+ createAction,
+ controlsWrapper,
+ createActionAndSwitch,
+ addAllControlButtons,
+ removeAllControlButtons
+ } = createFirstScreenElements();
+ document.body.appendChild(wrapper);
+ await startCamera(CAMERA_POSITION.BACK_CAMERA);
+ const { handler: takePictureHandler, cleanup: secondScreenCleanup } = prepareSecondScreen();
+ if (await hasMultipleCameras()) {
+ controlsWrapper.classList.add("take-picture-action-switch-control-wrapper");
+ createActionAndSwitch();
+ } else {
+ controlsWrapper.classList.add("take-picture-action-control-wrapper");
+ createAction();
+ }
+ closeControl.addEventListener("click", () => {
+ closeControlHandler();
+ secondScreenCleanup();
+ resolve(false);
+ });
+ switchControl.addEventListener("click", switchControlHandler);
+ actionControl.addEventListener("click", () => {
+ removeAllControlButtons();
+ if (showConfirmationScreen) {
+ // Delay the `takePictureHandler` to the next cycle so the UI preparations can go first. Otherwise, the control-buttons are not removed while the second screen is being set up.
+ setTimeout(() => {
+ takePictureHandler(() => {
+ addAllControlButtons();
+ video.play();
+ });
+ }, 0);
+ } else {
+ video.pause();
+ const videoCanvas = getVideoCanvas();
+ savePicture(videoCanvas, () => {
+ videoCanvas.remove();
+ closeControlHandler();
+ });
+ }
+ });
+ video.addEventListener("loadedmetadata", () => (videoIsReady = true));
+ function getVideoCanvas() {
+ const videoCanvas = document.createElement("canvas");
+ videoCanvas.height = video.videoHeight;
+ videoCanvas.width = video.videoWidth;
+ const videoContext = videoCanvas.getContext("2d");
+ videoContext === null || videoContext === void 0 ? void 0 : videoContext.drawImage(video, 0, 0);
+ return videoCanvas;
+ }
+ function createFirstScreenElements() {
+ const wrapper = document.createElement("div");
+ wrapper.setAttribute("role", "dialog");
+ wrapper.setAttribute("aria-labelledby", "take-picture-modal-label");
+ wrapper.classList.add("take-picture-wrapper");
+ const video = document.createElement("video");
+ video.classList.add("take-picture-video-element");
+ video.setAttribute("autoplay", "");
+ video.setAttribute("muted", "");
+ video.setAttribute("playsinline", "");
+ const controlsWrapper = document.createElement("div");
+ const closeControlWrapper = document.createElement("div");
+ closeControlWrapper.classList.add("take-picture-close-control-wrapper");
+ const actionControl = document.createElement("button");
+ actionControl.setAttribute("aria-label", getUserText("Take picture", "Foto nemen"));
+ actionControl.classList.add("take-picture-action-control");
+ const actionControlWrapper = document.createElement("div");
+ actionControlWrapper.classList.add("take-picture-action-spacing");
+ const switchControl = document.createElement("button");
+ switchControl.setAttribute("aria-label", getUserText("Switch camera", "Van camera wisselen"));
+ switchControl.classList.add("take-picture-switch-control");
+ const switchControlWrapper = document.createElement("div");
+ switchControlWrapper.classList.add("take-picture-switch-spacing");
+ const closeControl = document.createElement("button");
+ closeControl.setAttribute("aria-label", getUserText("Close", "Afsluiten"));
+ closeControl.classList.add("take-picture-close-control");
+ const closeImg = document.createElement("img");
+ closeImg.src = `data:image/svg+xml;base64,${closeSVG}`;
+ const switchImg = document.createElement("img");
+ switchImg.src = `data:image/svg+xml;base64,${syncSVG}`;
+ const takePictureImg = document.createElement("img");
+ takePictureImg.src = `data:image/svg+xml;base64,${cameraButtonSVG}`;
+ closeControl.appendChild(closeImg);
+ switchControl.appendChild(switchImg);
+ actionControl.appendChild(takePictureImg);
+ function createActionAndSwitch() {
+ const spacingDiv = document.createElement("div");
+ spacingDiv.classList.add("take-picture-spacing-div");
+ actionControlWrapper.appendChild(actionControl);
+ switchControlWrapper.appendChild(switchControl);
+ controlsWrapper.appendChild(spacingDiv);
+ controlsWrapper.appendChild(actionControlWrapper);
+ controlsWrapper.appendChild(switchControlWrapper);
+ }
+ closeControlWrapper.appendChild(closeControl);
+ function addAllControlButtons() {
+ wrapper.appendChild(controlsWrapper);
+ wrapper.appendChild(closeControlWrapper);
+ }
+ function removeAllControlButtons() {
+ wrapper.removeChild(controlsWrapper);
+ wrapper.removeChild(closeControlWrapper);
+ }
+ addAllControlButtons();
+ wrapper.appendChild(video);
+ return {
+ video,
+ wrapper,
+ controlsWrapper,
+ actionControl,
+ switchControl,
+ closeControl,
+ createActionAndSwitch,
+ createAction: () => controlsWrapper.appendChild(actionControl),
+ addAllControlButtons,
+ removeAllControlButtons
+ };
+ }
+ function prepareSecondScreen() {
+ let confirmationWrapper;
+ return {
+ handler: onResumeFirstScreen => {
+ if (videoIsReady) {
+ confirmationWrapper = document.createElement("div");
+ confirmationWrapper.classList.add("take-picture-confirm-wrapper");
+ video.pause();
+ // Element to retrieve the blob from mediaStream (not rendered on the screen)
+ const videoCanvas = getVideoCanvas();
+ const pictureImg = document.createElement("img");
+ pictureImg.classList.add("take-picture-image");
+ pictureImg.src = videoCanvas.toDataURL();
+ const buttonWrapper = document.createElement("div");
+ buttonWrapper.classList.add("take-picture-button-wrapper");
+ const saveBtn = document.createElement("button");
+ saveBtn.setAttribute("aria-label", getUserText("Save", "Opslaan"));
+ saveBtn.classList.add("take-picture-save-control");
+ const saveImg = document.createElement("img");
+ saveImg.src = `data:image/svg+xml;base64,${saveSVG}`;
+ saveBtn.appendChild(saveImg);
+ const closeBtn = document.createElement("button");
+ closeBtn.setAttribute("aria-label", getUserText("Close", "Afsluiten"));
+ closeBtn.classList.add("take-picture-close-control");
+ const closeImg = document.createElement("img");
+ closeImg.src = `data:image/svg+xml;base64,${closeSVG}`;
+ closeBtn.appendChild(closeImg);
+ buttonWrapper.appendChild(closeBtn);
+ buttonWrapper.appendChild(saveBtn);
+ confirmationWrapper.appendChild(buttonWrapper);
+ confirmationWrapper.appendChild(pictureImg);
+ document.body.appendChild(confirmationWrapper);
+ saveBtn.addEventListener("click", () => {
+ confirmationWrapper.removeChild(buttonWrapper);
+ savePicture(videoCanvas, () => {
+ closeControlHandler();
+ cleanupConfirmationElements();
+ });
+ });
+ closeBtn.addEventListener("click", () => {
+ cleanupConfirmationElements();
+ onResumeFirstScreen();
+ });
+ // eslint-disable-next-line no-inner-declarations
+ function cleanupConfirmationElements() {
+ document.body.removeChild(confirmationWrapper);
+ videoCanvas.remove();
+ }
+ }
+ },
+ cleanup: () => {
+ try {
+ document.body.removeChild(confirmationWrapper);
+ } catch (e) {
+ // silently handle case where node already removed.
+ }
+ }
+ };
+ }
+ async function switchControlHandler() {
+ if (!stream) {
+ return;
+ }
+ stopCamera();
+ if (await hasMultipleCameras()) {
+ shouldFaceEnvironment = !shouldFaceEnvironment;
+ }
+ await startCamera(shouldFaceEnvironment ? CAMERA_POSITION.BACK_CAMERA : CAMERA_POSITION.FRONT_CAMERA);
+ }
+ function closeControlHandler() {
+ stopCamera();
+ document.body.removeChild(wrapper);
+ }
+ async function startCamera(facingMode) {
+ var _a;
+ try {
+ stream = await navigator.mediaDevices.getUserMedia({
+ video: Object.assign({ facingMode }, getCameraQuality())
+ });
+ (_a = stream === null || stream === void 0 ? void 0 : stream.getTracks()) === null || _a === void 0
+ ? void 0
+ : _a.forEach(track => {
+ track.addEventListener("ended", () => {
+ closeControlHandler();
+ reject(new Error("Video stream unexpectedly ended."));
+ });
+ });
+ } catch (e) {
+ if (e instanceof Error) {
+ switch (e.name) {
+ case "NotAllowedError":
+ error = getUserText("Permission denied.", "Geen toestemming.");
+ break;
+ case "NotFoundError":
+ error = getUserText("Media not available.", "Media niet beschikbaar.");
+ break;
+ case "NotReadableError":
+ error = getUserText(
+ "Media not available, is it already in use elsewhere?",
+ "Media niet beschikbaar, wordt deze al ergens anders gebruikt?"
+ );
+ break;
+ default:
+ error = e.message;
+ break;
+ }
+ }
+ }
+ if (error) {
+ closeControlHandler();
+ mx.ui.error(error);
+ resolve(false);
+ }
+ if (stream) {
+ video.srcObject = stream;
+ }
+ }
+ function stopCamera() {
+ videoIsReady = false;
+ const tracks = stream === null || stream === void 0 ? void 0 : stream.getTracks();
+ tracks === null || tracks === void 0
+ ? void 0
+ : tracks.forEach(track => {
+ track.stop();
+ });
+ stream = undefined;
+ }
+ function savePicture(videoCanvas, onSuccess) {
+ const progressId = mx.ui.showProgress();
+ const filename = `device-camera-picture-${new Date().getTime()}.png`; // `toBlob` defaults to PNG.
+ new Promise((resolve, reject) => {
+ videoCanvas.toBlob(blob => {
+ if (blob) {
+ resolve(blob);
+ } else {
+ mx.ui.hideProgress(progressId);
+ reject(new Error("Couldn't save picture, please try again."));
+ }
+ });
+ })
+ .then(blob => {
+ mx.data.saveDocument(
+ picture.getGuid(),
+ filename,
+ {},
+ blob,
+ () => {
+ picture.set("Name", filename);
+ mx.data.commit({
+ mxobj: picture,
+ callback: () => {
+ mx.ui.hideProgress(progressId);
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
+ resolve(true);
+ },
+ error: error => {
+ mx.ui.hideProgress(progressId);
+ reject(
+ new Error(
+ `An error occurred while trying to save the file${
+ error.message ? `: ${error.message}` : ""
+ }. Please try again.`
+ )
+ );
+ }
+ });
+ },
+ error => {
+ mx.ui.hideProgress(progressId);
+ reject(
+ new Error(
+ `An error occurred while trying to save the file${
+ error.message ? `: ${error.message}` : ""
+ }. Please try again.`
+ )
+ );
+ }
+ );
+ })
+ .catch(message => {
+ mx.ui.hideProgress(progressId);
+ reject(new Error(message));
+ });
+ }
+ function getCameraQuality() {
+ switch (pictureQuality) {
+ case "low":
+ return {
+ width: { ideal: 1024 },
+ height: { ideal: 1024 }
+ };
+ case "medium":
+ default:
+ return {
+ width: { ideal: 2048 },
+ height: { ideal: 2048 }
+ };
+ case "high":
+ return {
+ width: { ideal: 4096 },
+ height: { ideal: 4096 }
+ };
+ case "custom":
+ return {
+ width: { ideal: Number(maximumWidth) },
+ height: { ideal: Number(maximumHeight) }
+ };
+ }
+ }
+ });
+ function prepareLanguage() {
+ const englishFn = english => english;
+ try {
+ return mx.session.sessionData.locale.code.toLowerCase().includes("en")
+ ? englishFn
+ : (_english, dutch) => dutch;
+ } catch (_) {
+ return englishFn;
+ }
+ }
+ async function hasMultipleCameras() {
+ const videoDevices = (await navigator.mediaDevices.enumerateDevices()).filter(
+ deviceInfo => deviceInfo.kind === "videoinput"
+ );
+ if (!videoDevices.length) {
+ return Promise.reject(new Error("Your device does not have a camera."));
+ }
+ return videoDevices.length > 1;
+ }
+ // END USER CODE
+}
diff --git a/javasource/administration/proxies/Account.java b/javasource/administration/proxies/Account.java
deleted file mode 100644
index e5dbdb3..0000000
--- a/javasource/administration/proxies/Account.java
+++ /dev/null
@@ -1,238 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package administration.proxies;
-
-public class Account extends system.proxies.User
-{
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Administration.Account";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- FullName("FullName"),
- Email("Email"),
- IsLocalUser("IsLocalUser"),
- Name("Name"),
- Password("Password"),
- LastLogin("LastLogin"),
- Blocked("Blocked"),
- Active("Active"),
- FailedLogins("FailedLogins"),
- WebServiceUser("WebServiceUser"),
- IsAnonymous("IsAnonymous"),
- UserRoles("System.UserRoles"),
- User_Language("System.User_Language"),
- User_TimeZone("System.User_TimeZone");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public Account(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Administration.Account"));
- }
-
- protected Account(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject accountMendixObject)
- {
- super(context, accountMendixObject);
- if (!com.mendix.core.Core.isSubClassOf("Administration.Account", accountMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Administration.Account");
- }
-
- /**
- * @deprecated Use 'Account.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static administration.proxies.Account initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return administration.proxies.Account.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static administration.proxies.Account initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new administration.proxies.Account(context, mendixObject);
- }
-
- public static administration.proxies.Account load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return administration.proxies.Account.initialize(context, mendixObject);
- }
-
- public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
- {
- java.util.List result = new java.util.ArrayList();
- for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//Administration.Account" + xpathConstraint))
- result.add(administration.proxies.Account.initialize(context, obj));
- return result;
- }
-
- /**
- * @return value of FullName
- */
- public final java.lang.String getFullName()
- {
- return getFullName(getContext());
- }
-
- /**
- * @param context
- * @return value of FullName
- */
- public final java.lang.String getFullName(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.FullName.toString());
- }
-
- /**
- * Set value of FullName
- * @param fullname
- */
- public final void setFullName(java.lang.String fullname)
- {
- setFullName(getContext(), fullname);
- }
-
- /**
- * Set value of FullName
- * @param context
- * @param fullname
- */
- public final void setFullName(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String fullname)
- {
- getMendixObject().setValue(context, MemberNames.FullName.toString(), fullname);
- }
-
- /**
- * @return value of Email
- */
- public final java.lang.String getEmail()
- {
- return getEmail(getContext());
- }
-
- /**
- * @param context
- * @return value of Email
- */
- public final java.lang.String getEmail(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.Email.toString());
- }
-
- /**
- * Set value of Email
- * @param email
- */
- public final void setEmail(java.lang.String email)
- {
- setEmail(getContext(), email);
- }
-
- /**
- * Set value of Email
- * @param context
- * @param email
- */
- public final void setEmail(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String email)
- {
- getMendixObject().setValue(context, MemberNames.Email.toString(), email);
- }
-
- /**
- * @return value of IsLocalUser
- */
- public final java.lang.Boolean getIsLocalUser()
- {
- return getIsLocalUser(getContext());
- }
-
- /**
- * @param context
- * @return value of IsLocalUser
- */
- public final java.lang.Boolean getIsLocalUser(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.IsLocalUser.toString());
- }
-
- /**
- * Set value of IsLocalUser
- * @param islocaluser
- */
- public final void setIsLocalUser(java.lang.Boolean islocaluser)
- {
- setIsLocalUser(getContext(), islocaluser);
- }
-
- /**
- * Set value of IsLocalUser
- * @param context
- * @param islocaluser
- */
- public final void setIsLocalUser(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean islocaluser)
- {
- getMendixObject().setValue(context, MemberNames.IsLocalUser.toString(), islocaluser);
- }
-
- @java.lang.Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj != null && getClass().equals(obj.getClass()))
- {
- final administration.proxies.Account that = (administration.proxies.Account) obj;
- return getMendixObject().equals(that.getMendixObject());
- }
- return false;
- }
-
- @java.lang.Override
- public int hashCode()
- {
- return getMendixObject().hashCode();
- }
-
- /**
- * @return String name of this class
- */
- public static java.lang.String getType()
- {
- return "Administration.Account";
- }
-
- /**
- * @return String GUID from this object, format: ID_0000000000
- * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
- */
- @java.lang.Override
- @java.lang.Deprecated
- public java.lang.String getGUID()
- {
- return "ID_" + getMendixObject().getId().toLong();
- }
-}
diff --git a/javasource/administration/proxies/AccountPasswordData.java b/javasource/administration/proxies/AccountPasswordData.java
deleted file mode 100644
index 76846d3..0000000
--- a/javasource/administration/proxies/AccountPasswordData.java
+++ /dev/null
@@ -1,317 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package administration.proxies;
-
-public class AccountPasswordData
-{
- private final com.mendix.systemwideinterfaces.core.IMendixObject accountPasswordDataMendixObject;
-
- private final com.mendix.systemwideinterfaces.core.IContext context;
-
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Administration.AccountPasswordData";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- OldPassword("OldPassword"),
- NewPassword("NewPassword"),
- ConfirmPassword("ConfirmPassword"),
- AccountPasswordData_Account("Administration.AccountPasswordData_Account");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public AccountPasswordData(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Administration.AccountPasswordData"));
- }
-
- protected AccountPasswordData(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject accountPasswordDataMendixObject)
- {
- if (accountPasswordDataMendixObject == null)
- throw new java.lang.IllegalArgumentException("The given object cannot be null.");
- if (!com.mendix.core.Core.isSubClassOf("Administration.AccountPasswordData", accountPasswordDataMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Administration.AccountPasswordData");
-
- this.accountPasswordDataMendixObject = accountPasswordDataMendixObject;
- this.context = context;
- }
-
- /**
- * @deprecated Use 'AccountPasswordData.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static administration.proxies.AccountPasswordData initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return administration.proxies.AccountPasswordData.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static administration.proxies.AccountPasswordData initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new administration.proxies.AccountPasswordData(context, mendixObject);
- }
-
- public static administration.proxies.AccountPasswordData load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return administration.proxies.AccountPasswordData.initialize(context, mendixObject);
- }
-
- /**
- * Commit the changes made on this proxy object.
- */
- public final void commit() throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Commit the changes made on this proxy object using the specified context.
- */
- public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Delete the object.
- */
- public final void delete()
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
-
- /**
- * Delete the object using the specified context.
- */
- public final void delete(com.mendix.systemwideinterfaces.core.IContext context)
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
- /**
- * @return value of OldPassword
- */
- public final java.lang.String getOldPassword()
- {
- return getOldPassword(getContext());
- }
-
- /**
- * @param context
- * @return value of OldPassword
- */
- public final java.lang.String getOldPassword(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.OldPassword.toString());
- }
-
- /**
- * Set value of OldPassword
- * @param oldpassword
- */
- public final void setOldPassword(java.lang.String oldpassword)
- {
- setOldPassword(getContext(), oldpassword);
- }
-
- /**
- * Set value of OldPassword
- * @param context
- * @param oldpassword
- */
- public final void setOldPassword(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String oldpassword)
- {
- getMendixObject().setValue(context, MemberNames.OldPassword.toString(), oldpassword);
- }
-
- /**
- * @return value of NewPassword
- */
- public final java.lang.String getNewPassword()
- {
- return getNewPassword(getContext());
- }
-
- /**
- * @param context
- * @return value of NewPassword
- */
- public final java.lang.String getNewPassword(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.NewPassword.toString());
- }
-
- /**
- * Set value of NewPassword
- * @param newpassword
- */
- public final void setNewPassword(java.lang.String newpassword)
- {
- setNewPassword(getContext(), newpassword);
- }
-
- /**
- * Set value of NewPassword
- * @param context
- * @param newpassword
- */
- public final void setNewPassword(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String newpassword)
- {
- getMendixObject().setValue(context, MemberNames.NewPassword.toString(), newpassword);
- }
-
- /**
- * @return value of ConfirmPassword
- */
- public final java.lang.String getConfirmPassword()
- {
- return getConfirmPassword(getContext());
- }
-
- /**
- * @param context
- * @return value of ConfirmPassword
- */
- public final java.lang.String getConfirmPassword(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.ConfirmPassword.toString());
- }
-
- /**
- * Set value of ConfirmPassword
- * @param confirmpassword
- */
- public final void setConfirmPassword(java.lang.String confirmpassword)
- {
- setConfirmPassword(getContext(), confirmpassword);
- }
-
- /**
- * Set value of ConfirmPassword
- * @param context
- * @param confirmpassword
- */
- public final void setConfirmPassword(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String confirmpassword)
- {
- getMendixObject().setValue(context, MemberNames.ConfirmPassword.toString(), confirmpassword);
- }
-
- /**
- * @return value of AccountPasswordData_Account
- */
- public final administration.proxies.Account getAccountPasswordData_Account() throws com.mendix.core.CoreException
- {
- return getAccountPasswordData_Account(getContext());
- }
-
- /**
- * @param context
- * @return value of AccountPasswordData_Account
- */
- public final administration.proxies.Account getAccountPasswordData_Account(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- administration.proxies.Account result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.AccountPasswordData_Account.toString());
- if (identifier != null)
- result = administration.proxies.Account.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of AccountPasswordData_Account
- * @param accountpassworddata_account
- */
- public final void setAccountPasswordData_Account(administration.proxies.Account accountpassworddata_account)
- {
- setAccountPasswordData_Account(getContext(), accountpassworddata_account);
- }
-
- /**
- * Set value of AccountPasswordData_Account
- * @param context
- * @param accountpassworddata_account
- */
- public final void setAccountPasswordData_Account(com.mendix.systemwideinterfaces.core.IContext context, administration.proxies.Account accountpassworddata_account)
- {
- if (accountpassworddata_account == null)
- getMendixObject().setValue(context, MemberNames.AccountPasswordData_Account.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.AccountPasswordData_Account.toString(), accountpassworddata_account.getMendixObject().getId());
- }
-
- /**
- * @return the IMendixObject instance of this proxy for use in the Core interface.
- */
- public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject()
- {
- return accountPasswordDataMendixObject;
- }
-
- /**
- * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization.
- */
- public final com.mendix.systemwideinterfaces.core.IContext getContext()
- {
- return context;
- }
-
- @java.lang.Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj != null && getClass().equals(obj.getClass()))
- {
- final administration.proxies.AccountPasswordData that = (administration.proxies.AccountPasswordData) obj;
- return getMendixObject().equals(that.getMendixObject());
- }
- return false;
- }
-
- @java.lang.Override
- public int hashCode()
- {
- return getMendixObject().hashCode();
- }
-
- /**
- * @return String name of this class
- */
- public static java.lang.String getType()
- {
- return "Administration.AccountPasswordData";
- }
-
- /**
- * @return String GUID from this object, format: ID_0000000000
- * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
- */
- @java.lang.Deprecated
- public java.lang.String getGUID()
- {
- return "ID_" + getMendixObject().getId().toLong();
- }
-}
diff --git a/javasource/administration/proxies/microflows/Microflows.java b/javasource/administration/proxies/microflows/Microflows.java
deleted file mode 100644
index cf4d0e7..0000000
--- a/javasource/administration/proxies/microflows/Microflows.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package administration.proxies.microflows;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.mendix.core.Core;
-import com.mendix.core.CoreException;
-import com.mendix.systemwideinterfaces.MendixRuntimeException;
-import com.mendix.systemwideinterfaces.core.IContext;
-import com.mendix.systemwideinterfaces.core.IMendixObject;
-
-public class Microflows
-{
- // These are the microflows for the Administration module
- public static void changeMyPassword(IContext context, administration.proxies.AccountPasswordData _accountPasswordData)
- {
- Map params = new HashMap<>();
- params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject());
- Core.microflowCall("Administration.ChangeMyPassword").withParams(params).execute(context);
- }
- public static void changePassword(IContext context, administration.proxies.AccountPasswordData _accountPasswordData)
- {
- Map params = new HashMap<>();
- params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject());
- Core.microflowCall("Administration.ChangePassword").withParams(params).execute(context);
- }
- public static void manageMyAccount(IContext context)
- {
- Map params = new HashMap<>();
- Core.microflowCall("Administration.ManageMyAccount").withParams(params).execute(context);
- }
- public static void newAccount(IContext context)
- {
- Map params = new HashMap<>();
- Core.microflowCall("Administration.NewAccount").withParams(params).execute(context);
- }
- /**
- * Create a new user object and change the default attribute values so the user will be handled as a webservice user.
- * Finally open the User_NewEdit form so all remaing user information can be set.
- */
- public static void newWebServiceAccount(IContext context)
- {
- Map params = new HashMap<>();
- Core.microflowCall("Administration.NewWebServiceAccount").withParams(params).execute(context);
- }
- public static java.util.List retrieveTimeZones(IContext context)
- {
- Map params = new HashMap<>();
- java.util.List objs = Core.microflowCall("Administration.RetrieveTimeZones").withParams(params).execute(context);
- java.util.List result = null;
- if (objs != null)
- {
- result = new java.util.ArrayList<>();
- for (IMendixObject obj : objs)
- result.add(system.proxies.TimeZone.initialize(context, obj));
- }
- return result;
- }
- public static void saveNewAccount(IContext context, administration.proxies.AccountPasswordData _accountPasswordData)
- {
- Map params = new HashMap<>();
- params.put("AccountPasswordData", _accountPasswordData == null ? null : _accountPasswordData.getMendixObject());
- Core.microflowCall("Administration.SaveNewAccount").withParams(params).execute(context);
- }
- public static void showMyPasswordForm(IContext context, administration.proxies.Account _account)
- {
- Map params = new HashMap<>();
- params.put("Account", _account == null ? null : _account.getMendixObject());
- Core.microflowCall("Administration.ShowMyPasswordForm").withParams(params).execute(context);
- }
- public static void showPasswordForm(IContext context, administration.proxies.Account _account)
- {
- Map params = new HashMap<>();
- params.put("Account", _account == null ? null : _account.getMendixObject());
- Core.microflowCall("Administration.ShowPasswordForm").withParams(params).execute(context);
- }
-}
\ No newline at end of file
diff --git a/javasource/atlas_ui_resources/proxies/constants/Constants.java b/javasource/atlas_ui_resources/proxies/constants/Constants.java
deleted file mode 100644
index c11d979..0000000
--- a/javasource/atlas_ui_resources/proxies/constants/Constants.java
+++ /dev/null
@@ -1,17 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package atlas_ui_resources.proxies.constants;
-
-import com.mendix.core.Core;
-
-public class Constants
-{
- // These are the constants for the Atlas_UI_Resources module
-
- public static java.lang.String getAtlas_UI_Resources_Version()
- {
- return (java.lang.String)Core.getConfiguration().getConstantValue("Atlas_UI_Resources.Atlas_UI_Resources_Version");
- }
-}
\ No newline at end of file
diff --git a/javasource/email_connector/actions/CalculateIncomingAccountMetrics.java b/javasource/email_connector/actions/CalculateIncomingAccountMetrics.java
index dfb3bda..067d245 100644
--- a/javasource/email_connector/actions/CalculateIncomingAccountMetrics.java
+++ b/javasource/email_connector/actions/CalculateIncomingAccountMetrics.java
@@ -10,64 +10,119 @@
package email_connector.actions;
import com.mendix.core.Core;
+import com.mendix.core.CoreException;
import com.mendix.datahub.connector.eventtracking.Metrics;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
-import email_connector.proxies.ENUM_IncomingProtocol;
-import email_connector.proxies.EmailAccount;
-import email_connector.proxies.IncomingEmailConfiguration;
+import email_connector.proxies.*;
+import com.mendix.systemwideinterfaces.core.IMendixObject;
+import email_connector.proxies.constants.Constants;
+import java.util.Map;
+import java.util.stream.Collectors;
+import static java.util.stream.Collectors.counting;
public class CalculateIncomingAccountMetrics extends CustomJavaAction
{
- public CalculateIncomingAccountMetrics(IContext context)
+ private java.util.List __EmailAccountList;
+ private java.util.List EmailAccountList;
+
+ public CalculateIncomingAccountMetrics(IContext context, java.util.List EmailAccountList)
{
super(context);
+ this.__EmailAccountList = EmailAccountList;
}
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
+ this.EmailAccountList = java.util.Optional.ofNullable(this.__EmailAccountList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__EmailAccountListElement -> email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccountListElement))
+ .collect(java.util.stream.Collectors.toList());
+
// BEGIN USER CODE
for (var protocol : ENUM_IncomingProtocol.values())
{
- var query = "SELECT "+ EmailAccount.entityName +"/"+ EmailAccount.MemberNames.isOAuthUsed.toString() +" FROM "
- + IncomingEmailConfiguration.entityName +" INNER JOIN "
- + IncomingEmailConfiguration.entityName +"/"+IncomingEmailConfiguration.MemberNames.IncomingEmailConfiguration_EmailAccount.toString() +"/"+ EmailAccount.entityName
- + " WHERE " + IncomingEmailConfiguration.MemberNames.IncomingProtocol.toString() + "='" + protocol.getCaption() + "';";
- var request = Core.createOQLTextGetRequest();
- request.setQuery(query);
- var dataTable = Core.retrieveOQLDataTable(getContext(), request);
- var oauthAccCnt=0;
- var basicAccCnt=0;
- if (dataTable.getRowCount() > 0) {
- for (com.mendix.systemwideinterfaces.connectionbus.data.IDataRow row : dataTable) {
- if((boolean) row.getValue(getContext(), 0))
- oauthAccCnt++;
- else
- basicAccCnt++;
+ var basicAccCount = this.EmailAccountList.stream()
+ .filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getIncomingEmailConfiguration_EmailAccount().getIncomingProtocol()) && !emailAccount.getisOAuthUsed();
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ })
+ .count();
+
+ Map mailBoxTypeAccounts = this.EmailAccountList.stream().filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getIncomingEmailConfiguration_EmailAccount().getIncomingProtocol());
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ }).collect(Collectors.groupingBy(EmailAccount::getIsSharedMailbox, counting()));
+
+ Map oAuthAccounts = this.EmailAccountList.stream().filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getIncomingEmailConfiguration_EmailAccount().getIncomingProtocol()) && emailAccount.getEmailAccount_OAuthProvider() != null;
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ }).collect(Collectors.groupingBy(emailAccount -> {
+ try {
+ return emailAccount.getEmailAccount_OAuthProvider().getOAuthType();
+ } catch (CoreException e) {
+ throw new IllegalStateException(e);
}
- }
+ }, counting()));
+
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("auth_method", "basic")
+ .addTag("setup", "incoming")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(basicAccCount);
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("auth_method", ENUM_OAuthType.AUTH_CODE.name().toLowerCase())
+ .addTag("setup", "incoming")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(oAuthAccounts.getOrDefault(ENUM_OAuthType.AUTH_CODE, 0L));
Metrics.createGauge("dnl_connectors_ec_account_configuration")
- .addTag("type", protocol.getCaption())
- .addTag("auth_method", "basic")
- .addTag("setup", "incoming")
- .setDescription("User sets up account configuration")
- .build()
- .recordValue(basicAccCnt);
+ .addTag("type", protocol.getCaption())
+ .addTag("auth_method", ENUM_OAuthType.CLIENT_CRED.name().toLowerCase())
+ .addTag("setup", "incoming")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(oAuthAccounts.getOrDefault(ENUM_OAuthType.CLIENT_CRED, 0L));
Metrics.createGauge("dnl_connectors_ec_account_configuration")
- .addTag("type", protocol.getCaption())
- .addTag("auth_method", "oauth")
- .addTag("setup", "incoming")
- .setDescription("User sets up account configuration")
- .build()
- .recordValue(oauthAccCnt);
+ .addTag("type", protocol.getCaption())
+ .addTag("setup", "incoming")
+ .addTag("mailbox_type", "shared")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(mailBoxTypeAccounts.getOrDefault(Boolean.TRUE, 0L));
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("setup", "incoming")
+ .addTag("mailbox_type", "primary")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(mailBoxTypeAccounts.getOrDefault(Boolean.FALSE, 0L));
}
+
return null;
// END USER CODE
}
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/CalculateOutgoingAccountMetrics.java b/javasource/email_connector/actions/CalculateOutgoingAccountMetrics.java
index 2db3666..10b6d97 100644
--- a/javasource/email_connector/actions/CalculateOutgoingAccountMetrics.java
+++ b/javasource/email_connector/actions/CalculateOutgoingAccountMetrics.java
@@ -10,58 +10,112 @@
package email_connector.actions;
import com.mendix.core.Core;
+import com.mendix.core.CoreException;
import com.mendix.datahub.connector.eventtracking.Metrics;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
+import email_connector.proxies.ENUM_OAuthType;
import email_connector.proxies.ENUM_OutgoingProtocol;
import email_connector.proxies.EmailAccount;
-import email_connector.proxies.OutgoingEmailConfiguration;
+import com.mendix.systemwideinterfaces.core.IMendixObject;
+import email_connector.proxies.constants.Constants;
+import java.util.Map;
+import java.util.stream.Collectors;
+import static java.util.stream.Collectors.counting;
public class CalculateOutgoingAccountMetrics extends CustomJavaAction
{
- public CalculateOutgoingAccountMetrics(IContext context)
+ private java.util.List __EmailAccountList;
+ private java.util.List EmailAccountList;
+
+ public CalculateOutgoingAccountMetrics(IContext context, java.util.List EmailAccountList)
{
super(context);
+ this.__EmailAccountList = EmailAccountList;
}
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
+ this.EmailAccountList = java.util.Optional.ofNullable(this.__EmailAccountList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__EmailAccountListElement -> email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccountListElement))
+ .collect(java.util.stream.Collectors.toList());
+
// BEGIN USER CODE
for (var protocol : ENUM_OutgoingProtocol.values())
{
+ var basicAccCount = this.EmailAccountList.stream()
+ .filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getOutgoingEmailConfiguration_EmailAccount().getOutgoingProtocol()) && !emailAccount.getisOAuthUsed();
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ })
+ .count();
+
+ Map mailBoxTypeAccounts = this.EmailAccountList.stream().filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getOutgoingEmailConfiguration_EmailAccount().getOutgoingProtocol());
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ }).collect(Collectors.groupingBy(EmailAccount::getIsSharedMailbox, counting()));
- var query = "SELECT "+ EmailAccount.entityName +"/"+ EmailAccount.MemberNames.isOAuthUsed.toString() +" FROM "
- + OutgoingEmailConfiguration.entityName +" INNER JOIN "
- + OutgoingEmailConfiguration.entityName +"/"+OutgoingEmailConfiguration.MemberNames.OutgoingEmailConfiguration_EmailAccount.toString() +"/"+ EmailAccount.entityName
- + " WHERE " + OutgoingEmailConfiguration.MemberNames.OutgoingProtocol.toString() + "='" + protocol.getCaption() + "';";
- var request = Core.createOQLTextGetRequest();
- request.setQuery(query);
- var dataTable = Core.retrieveOQLDataTable(getContext(), request);
- var oauthAccCnt=0;
- var basicAccCnt=0;
- if (dataTable.getRowCount() > 0) {
- for (com.mendix.systemwideinterfaces.connectionbus.data.IDataRow row : dataTable) {
- if((boolean) row.getValue(getContext(), 0))
- oauthAccCnt++;
- else
- basicAccCnt++;
+ Map oAuthAccounts = this.EmailAccountList.stream().filter(emailAccount -> {
+ try {
+ return protocol.equals(emailAccount.getOutgoingEmailConfiguration_EmailAccount().getOutgoingProtocol()) && emailAccount.getEmailAccount_OAuthProvider() != null;
+ } catch (CoreException e) {
+ Core.getLogger(Constants.getLogNode()).error(e);
+ }
+ return false;
+ }).collect(Collectors.groupingBy(emailAccount -> {
+ try {
+ return emailAccount.getEmailAccount_OAuthProvider().getOAuthType();
+ } catch (CoreException e) {
+ throw new IllegalStateException(e);
}
- }
+ }, counting()));
+
Metrics.createGauge("dnl_connectors_ec_account_configuration")
.addTag("type", protocol.getCaption())
.addTag("auth_method", "basic")
.addTag("setup", "outgoing")
.setDescription("User sets up account configuration")
.build()
- .recordValue(basicAccCnt);
+ .recordValue(basicAccCount);
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("auth_method", ENUM_OAuthType.AUTH_CODE.name().toLowerCase())
+ .addTag("setup", "outgoing")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(oAuthAccounts.getOrDefault(ENUM_OAuthType.AUTH_CODE, 0L));
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("auth_method", ENUM_OAuthType.CLIENT_CRED.name().toLowerCase())
+ .addTag("setup", "outgoing")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(oAuthAccounts.getOrDefault(ENUM_OAuthType.CLIENT_CRED, 0L));
+ Metrics.createGauge("dnl_connectors_ec_account_configuration")
+ .addTag("type", protocol.getCaption())
+ .addTag("setup", "outgoing")
+ .addTag("mailbox_type", "shared")
+ .setDescription("User sets up account configuration")
+ .build()
+ .recordValue(mailBoxTypeAccounts.getOrDefault(Boolean.TRUE, 0L));
Metrics.createGauge("dnl_connectors_ec_account_configuration")
.addTag("type", protocol.getCaption())
- .addTag("auth_method", "oauth")
.addTag("setup", "outgoing")
+ .addTag("mailbox_type", "primary")
.setDescription("User sets up account configuration")
.build()
- .recordValue(oauthAccCnt);
+ .recordValue(mailBoxTypeAccounts.getOrDefault(Boolean.FALSE, 0L));
}
return null;
// END USER CODE
@@ -69,6 +123,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/CheckServerConnection.java b/javasource/email_connector/actions/CheckServerConnection.java
index d9286d7..933ca4f 100644
--- a/javasource/email_connector/actions/CheckServerConnection.java
+++ b/javasource/email_connector/actions/CheckServerConnection.java
@@ -40,7 +40,7 @@ public CheckServerConnection(IContext context, IMendixObject EmailAccount)
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
- this.EmailAccount = __EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
+ this.EmailAccount = this.__EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
// BEGIN USER CODE
if (this.EmailAccount == null) {
@@ -61,6 +61,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/ConvertHTMLBodyToPlainText.java b/javasource/email_connector/actions/ConvertHTMLBodyToPlainText.java
index b315b29..cadff20 100644
--- a/javasource/email_connector/actions/ConvertHTMLBodyToPlainText.java
+++ b/javasource/email_connector/actions/ConvertHTMLBodyToPlainText.java
@@ -41,6 +41,7 @@ public java.lang.String executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/CopyAttachmentContent.java b/javasource/email_connector/actions/CopyAttachmentContent.java
index 54404b2..1d92011 100644
--- a/javasource/email_connector/actions/CopyAttachmentContent.java
+++ b/javasource/email_connector/actions/CopyAttachmentContent.java
@@ -32,9 +32,9 @@ public CopyAttachmentContent(IContext context, IMendixObject CopyFrom, IMendixOb
@java.lang.Override
public java.lang.Boolean executeAction() throws Exception
{
- this.CopyFrom = __CopyFrom == null ? null : system.proxies.FileDocument.initialize(getContext(), __CopyFrom);
+ this.CopyFrom = this.__CopyFrom == null ? null : system.proxies.FileDocument.initialize(getContext(), __CopyFrom);
- this.CopyTo = __CopyTo == null ? null : system.proxies.FileDocument.initialize(getContext(), __CopyTo);
+ this.CopyTo = this.__CopyTo == null ? null : system.proxies.FileDocument.initialize(getContext(), __CopyTo);
// BEGIN USER CODE
IContext context = this.getContext();
@@ -50,6 +50,7 @@ public java.lang.Boolean executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/CreateEmailFromTemplate.java b/javasource/email_connector/actions/CreateEmailFromTemplate.java
index b0180c6..3ad6c00 100644
--- a/javasource/email_connector/actions/CreateEmailFromTemplate.java
+++ b/javasource/email_connector/actions/CreateEmailFromTemplate.java
@@ -40,7 +40,7 @@ public CreateEmailFromTemplate(IContext context, IMendixObject DataObject, IMend
@java.lang.Override
public IMendixObject executeAction() throws Exception
{
- this.EmailTemplate = __EmailTemplate == null ? null : email_connector.proxies.EmailTemplate.initialize(getContext(), __EmailTemplate);
+ this.EmailTemplate = this.__EmailTemplate == null ? null : email_connector.proxies.EmailTemplate.initialize(getContext(), __EmailTemplate);
// BEGIN USER CODE
if (this.EmailTemplate == null)
@@ -63,6 +63,7 @@ public IMendixObject executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/DeleteDuplicateMxReflectionObject.java b/javasource/email_connector/actions/DeleteDuplicateMxReflectionObject.java
new file mode 100644
index 0000000..03d66f0
--- /dev/null
+++ b/javasource/email_connector/actions/DeleteDuplicateMxReflectionObject.java
@@ -0,0 +1,206 @@
+// This file was generated by Mendix Studio Pro.
+//
+// WARNING: Only the following code will be retained when actions are regenerated:
+// - the import list
+// - the code between BEGIN USER CODE and END USER CODE
+// - the code between BEGIN EXTRA CODE and END EXTRA CODE
+// Other code you write will be lost the next time you deploy the project.
+// Special characters, e.g., é, ö, à, etc. are supported in comments.
+
+package email_connector.actions;
+
+import com.mendix.core.Core;
+import com.mendix.core.CoreException;
+import com.mendix.systemwideinterfaces.core.IContext;
+import com.mendix.systemwideinterfaces.core.IMendixIdentifier;
+import com.mendix.systemwideinterfaces.core.IMendixObject;
+import com.mendix.webui.CustomJavaAction;
+import email_connector.proxies.EmailTemplate;
+import email_connector.proxies.constants.Constants;
+import mxmodelreflection.proxies.MxObjectMember;
+import mxmodelreflection.proxies.MxObjectReference;
+import mxmodelreflection.proxies.MxObjectType;
+import mxmodelreflection.proxies.Token;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class DeleteDuplicateMxReflectionObject extends CustomJavaAction
+{
+ private java.util.List __TokenList;
+ private java.util.List TokenList;
+ private java.util.List __MxObjectMemberList;
+ private java.util.List MxObjectMemberList;
+ private java.util.List __MxObjectReferenceList;
+ private java.util.List MxObjectReferenceList;
+ private java.util.List __MxObjectTypeList;
+ private java.util.List MxObjectTypeList;
+ private java.util.List __EmailTemplateList;
+ private java.util.List EmailTemplateList;
+
+ public DeleteDuplicateMxReflectionObject(IContext context, java.util.List TokenList, java.util.List MxObjectMemberList, java.util.List MxObjectReferenceList, java.util.List MxObjectTypeList, java.util.List EmailTemplateList)
+ {
+ super(context);
+ this.__TokenList = TokenList;
+ this.__MxObjectMemberList = MxObjectMemberList;
+ this.__MxObjectReferenceList = MxObjectReferenceList;
+ this.__MxObjectTypeList = MxObjectTypeList;
+ this.__EmailTemplateList = EmailTemplateList;
+ }
+
+ @java.lang.Override
+ public java.lang.Void executeAction() throws Exception
+ {
+ this.TokenList = java.util.Optional.ofNullable(this.__TokenList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__TokenListElement -> mxmodelreflection.proxies.Token.initialize(getContext(), __TokenListElement))
+ .collect(java.util.stream.Collectors.toList());
+
+ this.MxObjectMemberList = java.util.Optional.ofNullable(this.__MxObjectMemberList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__MxObjectMemberListElement -> mxmodelreflection.proxies.MxObjectMember.initialize(getContext(), __MxObjectMemberListElement))
+ .collect(java.util.stream.Collectors.toList());
+
+ this.MxObjectReferenceList = java.util.Optional.ofNullable(this.__MxObjectReferenceList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__MxObjectReferenceListElement -> mxmodelreflection.proxies.MxObjectReference.initialize(getContext(), __MxObjectReferenceListElement))
+ .collect(java.util.stream.Collectors.toList());
+
+ this.MxObjectTypeList = java.util.Optional.ofNullable(this.__MxObjectTypeList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__MxObjectTypeListElement -> mxmodelreflection.proxies.MxObjectType.initialize(getContext(), __MxObjectTypeListElement))
+ .collect(java.util.stream.Collectors.toList());
+
+ this.EmailTemplateList = java.util.Optional.ofNullable(this.__EmailTemplateList)
+ .orElse(java.util.Collections.emptyList())
+ .stream()
+ .map(__EmailTemplateListElement -> email_connector.proxies.EmailTemplate.initialize(getContext(), __EmailTemplateListElement))
+ .collect(java.util.stream.Collectors.toList());
+
+ // BEGIN USER CODE
+ int mxObjectMemberDuplicateCount = 0;
+ int mxObjectReferenceDuplicateCount = 0;
+ int mxObjectTypeDuplicateCount = 0;
+ if (!this.MxObjectMemberList.isEmpty()) {
+ List duplicateMxObjectMemberList = filterDuplicates(this.MxObjectMemberList, MxObjectMember::getCompleteName);
+ if (!duplicateMxObjectMemberList.isEmpty()) {
+ List mxObjectMemberIMendixObjectList = sortAndMapToMendixObjects(duplicateMxObjectMemberList, MxObjectMember::getMendixObject);
+ List mxObjectMemberOriginalList = new ArrayList<>();
+ // Process tokens
+ for (IMendixObject token : this.__TokenList) {
+ processTokenAndEmailTemplates(mxObjectMemberIMendixObjectList, token, Token.MemberNames.Token_MxObjectMember.toString(), MxObjectMember.MemberNames.CompleteName.toString(), mxObjectMemberOriginalList);
+ Core.commit(this.getContext(), token);
+ }
+ // Remove original objects from list of all duplicates
+ mxObjectMemberIMendixObjectList.removeAll(mxObjectMemberOriginalList);
+ mxObjectMemberDuplicateCount = mxObjectMemberIMendixObjectList.size();
+ // Delete objects which are created due to duplication of templates
+ Core.delete(this.getContext(), mxObjectMemberIMendixObjectList);
+ }
+ }
+ if (!this.MxObjectReferenceList.isEmpty()) {
+ List duplicateMxObjectReferenceList = filterMxObjectReferenceDuplicates(this.MxObjectReferenceList, MxObjectReference::getCompleteName, MxObjectReference::getParentEntity);
+ if (!duplicateMxObjectReferenceList.isEmpty()) {
+ List mxObjectReferenceIMendixObjectList = sortAndMapToMendixObjects(duplicateMxObjectReferenceList, MxObjectReference::getMendixObject);
+ List mxObjectReferenceOriginalList = new ArrayList<>();
+ // Process tokens
+ for (IMendixObject token : this.__TokenList) {
+ processTokenAndEmailTemplates(mxObjectReferenceIMendixObjectList, token, Token.MemberNames.Token_MxObjectReference.toString(), MxObjectReference.MemberNames.CompleteName.toString(), mxObjectReferenceOriginalList);
+ Core.commit(this.getContext(), token);
+ }
+ // Remove original objects from list of all duplicates
+ mxObjectReferenceIMendixObjectList.removeAll(mxObjectReferenceOriginalList);
+ mxObjectReferenceDuplicateCount = mxObjectReferenceIMendixObjectList.size();
+ // Delete objects which are created due to duplication of templates
+ Core.delete(this.getContext(), mxObjectReferenceIMendixObjectList);
+ }
+ }
+
+ if (!this.MxObjectTypeList.isEmpty()) {
+ List duplicateMxObjectTypeList = filterDuplicates(this.MxObjectTypeList, MxObjectType::getCompleteName);
+ if (!duplicateMxObjectTypeList.isEmpty()) {
+ List mxObjectTypeIMendixObjectList = sortAndMapToMendixObjects(duplicateMxObjectTypeList, MxObjectType::getMendixObject);
+ List mxObjectTypeOriginalList = new ArrayList<>();
+ // Process tokens
+ for (IMendixObject token : this.__TokenList) {
+ processTokenAndEmailTemplates(mxObjectTypeIMendixObjectList, token, Token.MemberNames.Token_MxObjectType_Start.toString(), MxObjectType.MemberNames.CompleteName.toString(), mxObjectTypeOriginalList);
+ processTokenAndEmailTemplates(mxObjectTypeIMendixObjectList, token, Token.MemberNames.Token_MxObjectType_Referenced.toString(), MxObjectType.MemberNames.CompleteName.toString(), mxObjectTypeOriginalList);
+ Core.commit(this.getContext(), token);
+ }
+ // Process email templates
+ for (IMendixObject emailTemplate : this.__EmailTemplateList) {
+ processTokenAndEmailTemplates(mxObjectTypeIMendixObjectList, emailTemplate, EmailTemplate.MemberNames.EmailTemplate_MxObjectType.toString(), MxObjectType.MemberNames.CompleteName.toString(), mxObjectTypeOriginalList);
+ Core.commit(this.getContext(), emailTemplate);
+ }
+ // Remove original objects from list of all duplicates
+ mxObjectTypeIMendixObjectList.removeAll(mxObjectTypeOriginalList);
+ mxObjectTypeDuplicateCount = mxObjectTypeIMendixObjectList.size();
+ // Delete objects which are created due to duplication of templates
+ Core.delete(this.getContext(), mxObjectTypeIMendixObjectList);
+ }
+ }
+ Core.getLogger(Constants.getLogNode()).info(String.format("Successfully deleted %d record(s) from entity '%s'.", mxObjectMemberDuplicateCount, "MxObjectMember"));
+ Core.getLogger(Constants.getLogNode()).info(String.format("Successfully deleted %d record(s) from entity '%s'.", mxObjectReferenceDuplicateCount, "MxObjectReference"));
+ Core.getLogger(Constants.getLogNode()).info(String.format("Successfully deleted %d record(s) from entity '%s'.", mxObjectTypeDuplicateCount, "MxObjectType"));
+ return null;
+ // END USER CODE
+ }
+
+ /**
+ * Returns a string representation of this action
+ * @return a string representation of this action
+ */
+ @java.lang.Override
+ public java.lang.String toString()
+ {
+ return "DeleteDuplicateMxReflectionObject";
+ }
+
+ // BEGIN EXTRA CODE
+ private List filterDuplicates(List list, Function getCompleteName) {
+ return list.stream()
+ .collect(Collectors.groupingBy(getCompleteName))
+ .values().stream()
+ .filter(l -> l.size() > 1)
+ .flatMap(List::stream)
+ .collect(Collectors.toList());
+ }
+
+ private List filterMxObjectReferenceDuplicates(List list, Function getCompleteName, Function getParentEntity) {
+ return list.stream()
+ .collect(Collectors.groupingBy(getCompleteName, Collectors.groupingBy(getParentEntity, Collectors.toList())))
+ .values().stream()
+ .flatMap(map -> map.values().stream())
+ .filter(l -> l.size() > 1)
+ .flatMap(List::stream)
+ .collect(Collectors.toList());
+ }
+
+ private List sortAndMapToMendixObjects(List list, Function getMendixObject) {
+ return list.stream()
+ .map(getMendixObject)
+ .sorted(Comparator.comparingLong(obj -> obj.getId().toLong()))
+ .collect(Collectors.toList());
+ }
+
+ private void processTokenAndEmailTemplates(List duplicateMendixObjectsList, IMendixObject mendixObject, String referenceName, String completeNameReference, List originalList) throws CoreException {
+ IMendixIdentifier mxIdentifier = mendixObject.getValue(this.getContext(), referenceName);
+ if (mxIdentifier != null) {
+ IMendixObject object = Core.retrieveId(this.getContext(), mxIdentifier);
+ for (IMendixObject duplicateMxObject : duplicateMendixObjectsList) {
+ if (duplicateMxObject.getValue(this.getContext(), completeNameReference).equals(object.getValue(this.getContext(), completeNameReference))) {
+ mendixObject.setValue(this.getContext(), referenceName, duplicateMxObject.getId());
+ if(!originalList.contains(duplicateMxObject)) {
+ originalList.add(duplicateMxObject);
+ }
+ break;
+ }
+ }
+ }
+ }
+ // END EXTRA CODE
+}
diff --git a/javasource/email_connector/actions/EndTransaction.java b/javasource/email_connector/actions/EndTransaction.java
index 0f30c6c..6e4db6d 100644
--- a/javasource/email_connector/actions/EndTransaction.java
+++ b/javasource/email_connector/actions/EndTransaction.java
@@ -30,6 +30,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GenerateOAuthNonce.java b/javasource/email_connector/actions/GenerateOAuthNonce.java
index a84de4b..895eb55 100644
--- a/javasource/email_connector/actions/GenerateOAuthNonce.java
+++ b/javasource/email_connector/actions/GenerateOAuthNonce.java
@@ -30,6 +30,7 @@ public java.lang.String executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetAppRootURL.java b/javasource/email_connector/actions/GetAppRootURL.java
index 54df9d7..b390177 100644
--- a/javasource/email_connector/actions/GetAppRootURL.java
+++ b/javasource/email_connector/actions/GetAppRootURL.java
@@ -31,6 +31,7 @@ public java.lang.String executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetAutoConfig.java b/javasource/email_connector/actions/GetAutoConfig.java
index 892fd1a..41935e6 100644
--- a/javasource/email_connector/actions/GetAutoConfig.java
+++ b/javasource/email_connector/actions/GetAutoConfig.java
@@ -42,6 +42,7 @@ public IMendixObject executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetBaseDNList.java b/javasource/email_connector/actions/GetBaseDNList.java
index fa4a9fd..31a5a48 100644
--- a/javasource/email_connector/actions/GetBaseDNList.java
+++ b/javasource/email_connector/actions/GetBaseDNList.java
@@ -34,7 +34,7 @@ public GetBaseDNList(IContext context, IMendixObject LDAPConfiguration)
@java.lang.Override
public java.util.List executeAction() throws Exception
{
- this.LDAPConfiguration = __LDAPConfiguration == null ? null : email_connector.proxies.LDAPConfiguration.initialize(getContext(), __LDAPConfiguration);
+ this.LDAPConfiguration = this.__LDAPConfiguration == null ? null : email_connector.proxies.LDAPConfiguration.initialize(getContext(), __LDAPConfiguration);
// BEGIN USER CODE
if (this.LDAPConfiguration == null)
@@ -62,6 +62,7 @@ public java.util.List executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetFolderNames.java b/javasource/email_connector/actions/GetFolderNames.java
index 15fbd60..11f07e7 100644
--- a/javasource/email_connector/actions/GetFolderNames.java
+++ b/javasource/email_connector/actions/GetFolderNames.java
@@ -36,7 +36,7 @@ public GetFolderNames(IContext context, IMendixObject MxEmailAccount)
@java.lang.Override
public java.util.List executeAction() throws Exception
{
- this.MxEmailAccount = __MxEmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __MxEmailAccount);
+ this.MxEmailAccount = this.__MxEmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __MxEmailAccount);
// BEGIN USER CODE
if (this.MxEmailAccount == null)
@@ -57,6 +57,7 @@ public java.util.List executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetMendixID.java b/javasource/email_connector/actions/GetMendixID.java
index 295e88e..2812440 100644
--- a/javasource/email_connector/actions/GetMendixID.java
+++ b/javasource/email_connector/actions/GetMendixID.java
@@ -33,6 +33,7 @@ public java.lang.Long executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/GetPayloadFromJWT.java b/javasource/email_connector/actions/GetPayloadFromJWT.java
index f360d09..83a8dfa 100644
--- a/javasource/email_connector/actions/GetPayloadFromJWT.java
+++ b/javasource/email_connector/actions/GetPayloadFromJWT.java
@@ -35,6 +35,7 @@ public java.lang.String executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/RetrieveEmailMessages.java b/javasource/email_connector/actions/RetrieveEmailMessages.java
index 77c48dd..93ccd11 100644
--- a/javasource/email_connector/actions/RetrieveEmailMessages.java
+++ b/javasource/email_connector/actions/RetrieveEmailMessages.java
@@ -42,7 +42,7 @@ public RetrieveEmailMessages(IContext context, IMendixObject emailAccount, java.
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
- this.emailAccount = __emailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __emailAccount);
+ this.emailAccount = this.__emailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __emailAccount);
// BEGIN USER CODE
if (this.emailAccount == null)
@@ -63,6 +63,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/SendEmail.java b/javasource/email_connector/actions/SendEmail.java
index ea267cd..047455a 100644
--- a/javasource/email_connector/actions/SendEmail.java
+++ b/javasource/email_connector/actions/SendEmail.java
@@ -43,9 +43,9 @@ public SendEmail(IContext context, IMendixObject EmailAccount, IMendixObject Ema
@java.lang.Override
public java.lang.Boolean executeAction() throws Exception
{
- this.EmailAccount = __EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
+ this.EmailAccount = this.__EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
- this.EmailMessage = __EmailMessage == null ? null : email_connector.proxies.EmailMessage.initialize(getContext(), __EmailMessage);
+ this.EmailMessage = this.__EmailMessage == null ? null : email_connector.proxies.EmailMessage.initialize(getContext(), __EmailMessage);
// BEGIN USER CODE
if (this.EmailAccount == null)
@@ -85,6 +85,7 @@ public java.lang.Boolean executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/SendEmailWithTemplate.java b/javasource/email_connector/actions/SendEmailWithTemplate.java
index 2e7af95..fd424b1 100644
--- a/javasource/email_connector/actions/SendEmailWithTemplate.java
+++ b/javasource/email_connector/actions/SendEmailWithTemplate.java
@@ -44,9 +44,9 @@ public SendEmailWithTemplate(IContext context, IMendixObject DataObject, IMendix
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
- this.EmailAccount = __EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
+ this.EmailAccount = this.__EmailAccount == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __EmailAccount);
- this.EmailTemplate = __EmailTemplate == null ? null : email_connector.proxies.EmailTemplate.initialize(getContext(), __EmailTemplate);
+ this.EmailTemplate = this.__EmailTemplate == null ? null : email_connector.proxies.EmailTemplate.initialize(getContext(), __EmailTemplate);
// BEGIN USER CODE
if (this.EmailAccount == null)
@@ -84,6 +84,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/SubscribeToIncomingEmail.java b/javasource/email_connector/actions/SubscribeToIncomingEmail.java
index 1aad320..a9072f7 100644
--- a/javasource/email_connector/actions/SubscribeToIncomingEmail.java
+++ b/javasource/email_connector/actions/SubscribeToIncomingEmail.java
@@ -39,7 +39,7 @@ public SubscribeToIncomingEmail(IContext context, IMendixObject account, java.la
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
- this.account = __account == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __account);
+ this.account = this.__account == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __account);
// BEGIN USER CODE
if (this.account == null)
@@ -57,6 +57,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/actions/UnsubscribeFromIncomingEmail.java b/javasource/email_connector/actions/UnsubscribeFromIncomingEmail.java
index 486d9b8..9e64a2e 100644
--- a/javasource/email_connector/actions/UnsubscribeFromIncomingEmail.java
+++ b/javasource/email_connector/actions/UnsubscribeFromIncomingEmail.java
@@ -34,7 +34,7 @@ public UnsubscribeFromIncomingEmail(IContext context, IMendixObject account)
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
- this.account = __account == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __account);
+ this.account = this.__account == null ? null : email_connector.proxies.EmailAccount.initialize(getContext(), __account);
// BEGIN USER CODE
if (this.account == null)
@@ -50,6 +50,7 @@ public java.lang.Void executeAction() throws Exception
/**
* Returns a string representation of this action
+ * @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
diff --git a/javasource/email_connector/implementation/Commons.java b/javasource/email_connector/implementation/Commons.java
index 4bd1b18..ad4a85d 100644
--- a/javasource/email_connector/implementation/Commons.java
+++ b/javasource/email_connector/implementation/Commons.java
@@ -49,7 +49,7 @@ else if (attachmentPosition.equalsIgnoreCase("attachment"))
}
public static String getHandling(ENUM_MessageHandling messageHandling) throws EmailConnectorException {
- if(messageHandling == null)
+ if (messageHandling == null)
throw new EmailConnectorException(Error.EMPTY_MESSAGE_HANDLING.getMessage());
else if (messageHandling.equals(ENUM_MessageHandling.DeleteMessage))
return "DeleteMessage";
@@ -60,7 +60,7 @@ else if (messageHandling.equals(ENUM_MessageHandling.MoveMessage))
}
public static FetchStrategy getFetchStrategy(email_connector.proxies.ENUM_FetchStrategy fetchStrategy) throws EmailConnectorException {
- if(fetchStrategy == null)
+ if (fetchStrategy == null)
throw new EmailConnectorException(Error.EMPTY_FETCH_STRATEGY.getMessage());
else if (fetchStrategy.name().equalsIgnoreCase("Latest"))
return FetchStrategy.LATEST;
diff --git a/javasource/email_connector/implementation/EmailListener.java b/javasource/email_connector/implementation/EmailListener.java
index 1af3b2a..f3b13fd 100644
--- a/javasource/email_connector/implementation/EmailListener.java
+++ b/javasource/email_connector/implementation/EmailListener.java
@@ -58,7 +58,7 @@ public void onBatchReceived(List messageList) {
} catch (CoreRuntimeException | EmailConnectorException | CoreException e) {
log.error(e.getMessage(), e);
if (context != null && context.isInTransaction())
- context.rollbackTransAction();
+ context.rollbackTransaction();
}
}
diff --git a/javasource/email_connector/implementation/MxMailMapper.java b/javasource/email_connector/implementation/MxMailMapper.java
index 2b39c30..1f0f9a2 100644
--- a/javasource/email_connector/implementation/MxMailMapper.java
+++ b/javasource/email_connector/implementation/MxMailMapper.java
@@ -15,9 +15,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
import static email_connector.implementation.Commons.*;
@@ -50,18 +48,23 @@ public static void setReceiveAccountConfigurations(EmailAccount mxEmailAccount,
}
- private static void setCommonAccountConfiguration(EmailAccount mxEmailAccount, Account serverAccount) {
+ private static void setCommonAccountConfiguration(EmailAccount mxEmailAccount, Account serverAccount) throws EmailConnectorException {
serverAccount.setSanitizeEmailBodyForXSSScript(mxEmailAccount.getsanitizeEmailBodyForXSSScript());
- serverAccount.setConnectionTimeout(String.valueOf(mxEmailAccount.getTimeout()));
+ if (mxEmailAccount.getTimeout() > 0) serverAccount.setConnectionTimeout(mxEmailAccount.getTimeout());
serverAccount.setFromDisplayName(mxEmailAccount.getFromDisplayName());
serverAccount.setUseSSLServerCheckIdentity(mxEmailAccount.getUseSSLCheckServerIdentity());
+ serverAccount.setSharedMailbox(mxEmailAccount.getIsSharedMailbox());
+ if (mxEmailAccount.getIsSharedMailbox() && (mxEmailAccount.getMailAddress() == null || mxEmailAccount.getMailAddress().isBlank())) {
+ throw new EmailConnectorException(Error.EMPTY_MAIL_ADDRESS.getMessage());
+ }
+ serverAccount.setMailAddress(mxEmailAccount.getMailAddress());
serverAccount.setOAuthUsed(mxEmailAccount.getisOAuthUsed());
- if (serverAccount.isOAuthUsed() && mxEmailAccount.getOAuthSetupComplete().equals(true)) {
+ if (serverAccount.isOAuthUsed()) {
serverAccount.setoAuthAccessTokenWorker(new OAuthTokenWorker(mxEmailAccount));
}
}
- private static void processAttachment(Message serverMessage, EmailMessage mxEmailMessage, boolean processInlineAttachment,IContext context) throws EmailConnectorException {
+ private static void processAttachment(Message serverMessage, EmailMessage mxEmailMessage, boolean processInlineAttachment, IContext context) throws EmailConnectorException {
List serverAttachmentList = serverMessage.getAttachment();
for (Attachment serverAttachment : serverAttachmentList) {
var mxAttachment = new email_connector.proxies.Attachment(context);
@@ -75,7 +78,6 @@ private static void processAttachment(Message serverMessage, EmailMessage mxEmai
mxAttachment.setattachmentSize(serverAttachment.getAttachmentSize());
if (serverAttachment.getAttachmentPosition() != null)
mxAttachment.setPosition(getPosition(serverAttachment.getAttachmentPosition()));
-
var byteStream = new ByteArrayInputStream(serverAttachment.getAttachmentContent());
Core.storeFileDocumentContent(context, mxAttachment.getMendixObject(), byteStream);
if (serverAttachment.getAttachmentPosition() != null && processInlineAttachment) {
@@ -84,12 +86,11 @@ private static void processAttachment(Message serverMessage, EmailMessage mxEmai
}
}
-
private static void displayInlineAttachment(EmailMessage mxEmailMessage, Attachment serverAttachment, email_connector.proxies.Attachment mxAttachment) {
- var url = "/file?target=window&fileID=";
+ var url = "/file?target=window&guid=";
if (serverAttachment.getAttachmentPosition().equalsIgnoreCase("inline")) {
String source = "cid:" + serverAttachment.getAttachmentContentID();
- String target = url + mxAttachment.getFileID();
+ String target = url + mxAttachment.getMendixObject().getId().toLong();
mxEmailMessage.setContent(mxEmailMessage.getContent().replaceAll(source, target));
}
}
@@ -111,12 +112,10 @@ private static EmailMessage getMxEmailMessage(EmailAccount mxEmailAccount, Messa
mxEmailMessage.setReplyTo(serverMessage.getReplyTo());
mxEmailMessage.setFromDisplayName(serverMessage.getFromDisplayName());
if (serverMessage.isHasAttachments()) {
- processAttachment(serverMessage, mxEmailMessage, mxEmailAccount.getIncomingEmailConfiguration_EmailAccount().getProcessInlineImage(),context);
+ processAttachment(serverMessage, mxEmailMessage, mxEmailAccount.getIncomingEmailConfiguration_EmailAccount().getProcessInlineImage(), context);
}
- if(serverMessage.getHeaders() != null && !serverMessage.getHeaders().isEmpty())
- {
- for (var header: serverMessage.getHeaders().entrySet())
- {
+ if (serverMessage.getHeaders() != null && !serverMessage.getHeaders().isEmpty()) {
+ for (var header : serverMessage.getHeaders().entrySet()) {
var mxHeader = new EmailHeader(context);
mxHeader.setKey(header.getKey());
mxHeader.setValue(header.getValue());
@@ -160,17 +159,23 @@ public static void setServerSendEmailMessage(EmailMessage emailMessage, SendEmai
sendEmailMsg.setSubject(emailMessage.getSubject());
sendEmailMsg.setFromDisplayName(emailMessage.getFromDisplayName());
setRecipients(emailMessage, sendEmailMsg);
-
sendEmailMsg.setContent(emailMessage.getContent());
sendEmailMsg.setPlainBody(emailMessage.getPlainBody());
sendEmailMsg.setUseOnlyPlainText(emailMessage.getUseOnlyPlainText());
sendEmailMsg.setSigned(emailMessage.getisSigned());
-
sendEmailMsg.setEncrypted(emailMessage.getisEncrypted());
+ Map headerMap = new HashMap<>();
+ List emailHeaders = Core.retrieveByPath(context, emailMessage.getMendixObject(), EmailHeader.MemberNames.EmailHeader_EmailMessage.toString());
+ if (emailHeaders != null) {
+ for (IMendixObject header : emailHeaders) {
+ headerMap.put(EmailHeader.initialize(context, header).getKey(), EmailHeader.initialize(context, header).getValue());
+ }
+ }
+
+ sendEmailMsg.setHeaders(headerMap);
if (emailMessage.getReplyTo() != null && !emailMessage.getReplyTo().isEmpty())
sendEmailMsg.setReplyTo(emailMessage.getReplyTo());
-
if (attachmentList != null && !attachmentList.isEmpty()) {
List serverAttachmentList = new ArrayList<>();
for (email_connector.proxies.Attachment mxAttachment : attachmentList) {
@@ -186,7 +191,6 @@ public static void setServerSendEmailMessage(EmailMessage emailMessage, SendEmai
} catch (IOException ex) {
throw new EmailConnectorException(Error.ERROR_FETCH_ATTACHMENT_CONTENT.getMessage());
}
-
}
sendEmailMsg.setAttachment(serverAttachmentList);
}
@@ -195,19 +199,15 @@ public static void setServerSendEmailMessage(EmailMessage emailMessage, SendEmai
private static void setRecipients(EmailMessage emailMessage, SendEmailMessage sendEmailMsg) {
if (emailMessage.getFrom() != null && !emailMessage.getFrom().isEmpty())
sendEmailMsg.setFrom(Arrays.asList(emailMessage.getFrom().trim().split(ADDRESSSEPARATORREGEX)));
-
if (emailMessage.getTo() != null && !emailMessage.getTo().isEmpty())
sendEmailMsg.setTo(Arrays.asList(emailMessage.getTo().trim().split(ADDRESSSEPARATORREGEX)));
-
if (emailMessage.getCC() != null && !emailMessage.getCC().isEmpty())
sendEmailMsg.setCc(Arrays.asList(emailMessage.getCC().trim().split(ADDRESSSEPARATORREGEX)));
-
if (emailMessage.getBCC() != null && !emailMessage.getBCC().isEmpty())
sendEmailMsg.setBcc(Arrays.asList(emailMessage.getBCC().trim().split(ADDRESSSEPARATORREGEX)));
}
public static void getMappedEmailProvider(IContext context, EmailProvider emailProviders, email_connector.proxies.EmailProvider mxEmailProvider) throws EmailConnectorException {
-
for (com.mendix.datahub.connector.email.model.autoconfig.IncomingServer incomingServer : emailProviders.getIncomingServers()) {
var mxIncomingServer = new IncomingServer(context);
mxIncomingServer.setIncomingServer_EmailProvider(mxEmailProvider);
@@ -216,8 +216,6 @@ public static void getMappedEmailProvider(IContext context, EmailProvider emailP
mxIncomingServer.setSocketType(incomingServer.getSocketType());
mxIncomingServer.setIncomingProtocol(getIncomingProxyProtocol(incomingServer.getType()));
}
-
-
for (com.mendix.datahub.connector.email.model.autoconfig.OutgoingServer outgoingServer : emailProviders.getOutgoingServers()) {
var mxOutgoingServer = new OutgoingServer(context);
mxOutgoingServer.setOutgoingServer_EmailProvider(mxEmailProvider);
@@ -242,6 +240,7 @@ public static EmailMessage getEmailMessageFromTemplate(IContext context, EmailTe
emailMessage.setUseOnlyPlainText(emailTemplate.getUseOnlyPlainText());
emailMessage.setReplyTo(emailTemplate.getReplyTo());
emailMessage.setFromDisplayName(emailTemplate.getFromDisplayName());
+ emailMessage.setFrom(emailTemplate.getFromAddress());
if (Boolean.TRUE.equals(queued)) {
emailMessage.setQueuedForSending(true);
emailMessage.setStatus(ENUM_EmailStatus.QUEUED);
diff --git a/javasource/email_connector/implementation/NotificationListener.java b/javasource/email_connector/implementation/NotificationListener.java
index 4655a5f..ee8193d 100644
--- a/javasource/email_connector/implementation/NotificationListener.java
+++ b/javasource/email_connector/implementation/NotificationListener.java
@@ -56,7 +56,7 @@ public void onEmailNotificationReceived(List messageList) {
} catch (CoreRuntimeException | EmailConnectorException | CoreException e) {
log.error(e.getMessage(), e);
if (context != null && context.isInTransaction())
- context.rollbackTransAction();
+ context.rollbackTransaction();
}
}
diff --git a/javasource/email_connector/proxies/Attachment.java b/javasource/email_connector/proxies/Attachment.java
deleted file mode 100644
index 9883a08..0000000
--- a/javasource/email_connector/proxies/Attachment.java
+++ /dev/null
@@ -1,403 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public class Attachment extends system.proxies.FileDocument
-{
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Email_Connector.Attachment";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- ContentID("ContentID"),
- attachmentName("attachmentName"),
- attachmentSize("attachmentSize"),
- attachmentContentType("attachmentContentType"),
- Position("Position"),
- FileID("FileID"),
- Name("Name"),
- DeleteAfterDownload("DeleteAfterDownload"),
- Contents("Contents"),
- HasContents("HasContents"),
- Size("Size"),
- Attachment_EmailMessage("Email_Connector.Attachment_EmailMessage"),
- Attachment_EmailTemplate("Email_Connector.Attachment_EmailTemplate");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public Attachment(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Email_Connector.Attachment"));
- }
-
- protected Attachment(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject attachmentMendixObject)
- {
- super(context, attachmentMendixObject);
- if (!com.mendix.core.Core.isSubClassOf("Email_Connector.Attachment", attachmentMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Email_Connector.Attachment");
- }
-
- /**
- * @deprecated Use 'Attachment.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static email_connector.proxies.Attachment initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return email_connector.proxies.Attachment.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static email_connector.proxies.Attachment initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new email_connector.proxies.Attachment(context, mendixObject);
- }
-
- public static email_connector.proxies.Attachment load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return email_connector.proxies.Attachment.initialize(context, mendixObject);
- }
-
- public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
- {
- java.util.List result = new java.util.ArrayList();
- for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//Email_Connector.Attachment" + xpathConstraint))
- result.add(email_connector.proxies.Attachment.initialize(context, obj));
- return result;
- }
-
- /**
- * @return value of ContentID
- */
- public final java.lang.String getContentID()
- {
- return getContentID(getContext());
- }
-
- /**
- * @param context
- * @return value of ContentID
- */
- public final java.lang.String getContentID(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.ContentID.toString());
- }
-
- /**
- * Set value of ContentID
- * @param contentid
- */
- public final void setContentID(java.lang.String contentid)
- {
- setContentID(getContext(), contentid);
- }
-
- /**
- * Set value of ContentID
- * @param context
- * @param contentid
- */
- public final void setContentID(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String contentid)
- {
- getMendixObject().setValue(context, MemberNames.ContentID.toString(), contentid);
- }
-
- /**
- * @return value of attachmentName
- */
- public final java.lang.String getattachmentName()
- {
- return getattachmentName(getContext());
- }
-
- /**
- * @param context
- * @return value of attachmentName
- */
- public final java.lang.String getattachmentName(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.attachmentName.toString());
- }
-
- /**
- * Set value of attachmentName
- * @param attachmentname
- */
- public final void setattachmentName(java.lang.String attachmentname)
- {
- setattachmentName(getContext(), attachmentname);
- }
-
- /**
- * Set value of attachmentName
- * @param context
- * @param attachmentname
- */
- public final void setattachmentName(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String attachmentname)
- {
- getMendixObject().setValue(context, MemberNames.attachmentName.toString(), attachmentname);
- }
-
- /**
- * @return value of attachmentSize
- */
- public final java.lang.Integer getattachmentSize()
- {
- return getattachmentSize(getContext());
- }
-
- /**
- * @param context
- * @return value of attachmentSize
- */
- public final java.lang.Integer getattachmentSize(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Integer) getMendixObject().getValue(context, MemberNames.attachmentSize.toString());
- }
-
- /**
- * Set value of attachmentSize
- * @param attachmentsize
- */
- public final void setattachmentSize(java.lang.Integer attachmentsize)
- {
- setattachmentSize(getContext(), attachmentsize);
- }
-
- /**
- * Set value of attachmentSize
- * @param context
- * @param attachmentsize
- */
- public final void setattachmentSize(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Integer attachmentsize)
- {
- getMendixObject().setValue(context, MemberNames.attachmentSize.toString(), attachmentsize);
- }
-
- /**
- * @return value of attachmentContentType
- */
- public final java.lang.String getattachmentContentType()
- {
- return getattachmentContentType(getContext());
- }
-
- /**
- * @param context
- * @return value of attachmentContentType
- */
- public final java.lang.String getattachmentContentType(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.attachmentContentType.toString());
- }
-
- /**
- * Set value of attachmentContentType
- * @param attachmentcontenttype
- */
- public final void setattachmentContentType(java.lang.String attachmentcontenttype)
- {
- setattachmentContentType(getContext(), attachmentcontenttype);
- }
-
- /**
- * Set value of attachmentContentType
- * @param context
- * @param attachmentcontenttype
- */
- public final void setattachmentContentType(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String attachmentcontenttype)
- {
- getMendixObject().setValue(context, MemberNames.attachmentContentType.toString(), attachmentcontenttype);
- }
-
- /**
- * Set value of Position
- * @param position
- */
- public final email_connector.proxies.ENUM_AttachmentPosition getPosition()
- {
- return getPosition(getContext());
- }
-
- /**
- * @param context
- * @return value of Position
- */
- public final email_connector.proxies.ENUM_AttachmentPosition getPosition(com.mendix.systemwideinterfaces.core.IContext context)
- {
- Object obj = getMendixObject().getValue(context, MemberNames.Position.toString());
- if (obj == null)
- return null;
-
- return email_connector.proxies.ENUM_AttachmentPosition.valueOf((java.lang.String) obj);
- }
-
- /**
- * Set value of Position
- * @param position
- */
- public final void setPosition(email_connector.proxies.ENUM_AttachmentPosition position)
- {
- setPosition(getContext(), position);
- }
-
- /**
- * Set value of Position
- * @param context
- * @param position
- */
- public final void setPosition(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.ENUM_AttachmentPosition position)
- {
- if (position != null)
- getMendixObject().setValue(context, MemberNames.Position.toString(), position.toString());
- else
- getMendixObject().setValue(context, MemberNames.Position.toString(), null);
- }
-
- /**
- * @return value of Attachment_EmailMessage
- */
- public final email_connector.proxies.EmailMessage getAttachment_EmailMessage() throws com.mendix.core.CoreException
- {
- return getAttachment_EmailMessage(getContext());
- }
-
- /**
- * @param context
- * @return value of Attachment_EmailMessage
- */
- public final email_connector.proxies.EmailMessage getAttachment_EmailMessage(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.EmailMessage result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.Attachment_EmailMessage.toString());
- if (identifier != null)
- result = email_connector.proxies.EmailMessage.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of Attachment_EmailMessage
- * @param attachment_emailmessage
- */
- public final void setAttachment_EmailMessage(email_connector.proxies.EmailMessage attachment_emailmessage)
- {
- setAttachment_EmailMessage(getContext(), attachment_emailmessage);
- }
-
- /**
- * Set value of Attachment_EmailMessage
- * @param context
- * @param attachment_emailmessage
- */
- public final void setAttachment_EmailMessage(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.EmailMessage attachment_emailmessage)
- {
- if (attachment_emailmessage == null)
- getMendixObject().setValue(context, MemberNames.Attachment_EmailMessage.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.Attachment_EmailMessage.toString(), attachment_emailmessage.getMendixObject().getId());
- }
-
- /**
- * @return value of Attachment_EmailTemplate
- */
- public final email_connector.proxies.EmailTemplate getAttachment_EmailTemplate() throws com.mendix.core.CoreException
- {
- return getAttachment_EmailTemplate(getContext());
- }
-
- /**
- * @param context
- * @return value of Attachment_EmailTemplate
- */
- public final email_connector.proxies.EmailTemplate getAttachment_EmailTemplate(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.EmailTemplate result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.Attachment_EmailTemplate.toString());
- if (identifier != null)
- result = email_connector.proxies.EmailTemplate.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of Attachment_EmailTemplate
- * @param attachment_emailtemplate
- */
- public final void setAttachment_EmailTemplate(email_connector.proxies.EmailTemplate attachment_emailtemplate)
- {
- setAttachment_EmailTemplate(getContext(), attachment_emailtemplate);
- }
-
- /**
- * Set value of Attachment_EmailTemplate
- * @param context
- * @param attachment_emailtemplate
- */
- public final void setAttachment_EmailTemplate(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.EmailTemplate attachment_emailtemplate)
- {
- if (attachment_emailtemplate == null)
- getMendixObject().setValue(context, MemberNames.Attachment_EmailTemplate.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.Attachment_EmailTemplate.toString(), attachment_emailtemplate.getMendixObject().getId());
- }
-
- @java.lang.Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj != null && getClass().equals(obj.getClass()))
- {
- final email_connector.proxies.Attachment that = (email_connector.proxies.Attachment) obj;
- return getMendixObject().equals(that.getMendixObject());
- }
- return false;
- }
-
- @java.lang.Override
- public int hashCode()
- {
- return getMendixObject().hashCode();
- }
-
- /**
- * @return String name of this class
- */
- public static java.lang.String getType()
- {
- return "Email_Connector.Attachment";
- }
-
- /**
- * @return String GUID from this object, format: ID_0000000000
- * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
- */
- @java.lang.Override
- @java.lang.Deprecated
- public java.lang.String getGUID()
- {
- return "ID_" + getMendixObject().getId().toLong();
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_AttachmentPosition.java b/javasource/email_connector/proxies/ENUM_AttachmentPosition.java
deleted file mode 100644
index 2a3af74..0000000
--- a/javasource/email_connector/proxies/ENUM_AttachmentPosition.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_AttachmentPosition
-{
- Attachment(new java.lang.String[][] { new java.lang.String[] { "en_US", "Attachment" } }),
- Inline(new java.lang.String[][] { new java.lang.String[] { "en_US", "Inline" } });
-
- private java.util.Map captions;
-
- private ENUM_AttachmentPosition(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_EmailStatus.java b/javasource/email_connector/proxies/ENUM_EmailStatus.java
deleted file mode 100644
index 658eb5b..0000000
--- a/javasource/email_connector/proxies/ENUM_EmailStatus.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_EmailStatus
-{
- QUEUED(new java.lang.String[][] { new java.lang.String[] { "en_US", "Queued" } }),
- SENT(new java.lang.String[][] { new java.lang.String[] { "en_US", "Sent" } }),
- FAILED(new java.lang.String[][] { new java.lang.String[] { "en_US", "Failed" } }),
- ERROR(new java.lang.String[][] { new java.lang.String[] { "en_US", "Error" } }),
- RECEIVED(new java.lang.String[][] { new java.lang.String[] { "en_US", "Received" } });
-
- private java.util.Map captions;
-
- private ENUM_EmailStatus(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_FetchStrategy.java b/javasource/email_connector/proxies/ENUM_FetchStrategy.java
deleted file mode 100644
index 0031612..0000000
--- a/javasource/email_connector/proxies/ENUM_FetchStrategy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_FetchStrategy
-{
- Latest(new java.lang.String[][] { new java.lang.String[] { "en_US", "Latest" } }),
- Oldest(new java.lang.String[][] { new java.lang.String[] { "en_US", "Oldest" } });
-
- private java.util.Map captions;
-
- private ENUM_FetchStrategy(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_IncomingProtocol.java b/javasource/email_connector/proxies/ENUM_IncomingProtocol.java
deleted file mode 100644
index d4baca9..0000000
--- a/javasource/email_connector/proxies/ENUM_IncomingProtocol.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_IncomingProtocol
-{
- IMAP(new java.lang.String[][] { new java.lang.String[] { "en_US", "IMAP" } }),
- IMAPS(new java.lang.String[][] { new java.lang.String[] { "en_US", "IMAPS" } }),
- POP3(new java.lang.String[][] { new java.lang.String[] { "en_US", "POP3" } }),
- POP3S(new java.lang.String[][] { new java.lang.String[] { "en_US", "POP3S" } });
-
- private java.util.Map captions;
-
- private ENUM_IncomingProtocol(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_LDAPAuthType.java b/javasource/email_connector/proxies/ENUM_LDAPAuthType.java
deleted file mode 100644
index ee32ce2..0000000
--- a/javasource/email_connector/proxies/ENUM_LDAPAuthType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_LDAPAuthType
-{
- none(new java.lang.String[][] { new java.lang.String[] { "en_US", "No Authentication" } }),
- simple(new java.lang.String[][] { new java.lang.String[] { "en_US", "Simple Authentication" } });
-
- private java.util.Map captions;
-
- private ENUM_LDAPAuthType(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_LogType.java b/javasource/email_connector/proxies/ENUM_LogType.java
deleted file mode 100644
index b0e0c2d..0000000
--- a/javasource/email_connector/proxies/ENUM_LogType.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_LogType
-{
- Message(new java.lang.String[][] { new java.lang.String[] { "en_US", "Message" } }),
- Warning(new java.lang.String[][] { new java.lang.String[] { "en_US", "Warning" } }),
- Error(new java.lang.String[][] { new java.lang.String[] { "en_US", "Error" } });
-
- private java.util.Map captions;
-
- private ENUM_LogType(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_MessageHandling.java b/javasource/email_connector/proxies/ENUM_MessageHandling.java
deleted file mode 100644
index 63f074d..0000000
--- a/javasource/email_connector/proxies/ENUM_MessageHandling.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_MessageHandling
-{
- NoHandling(new java.lang.String[][] { new java.lang.String[] { "en_US", "None" } }),
- DeleteMessage(new java.lang.String[][] { new java.lang.String[] { "en_US", "Remove original emails from server" } }),
- MoveMessage(new java.lang.String[][] { new java.lang.String[] { "en_US", "Move emails on server to another (existing) folder" } });
-
- private java.util.Map captions;
-
- private ENUM_MessageHandling(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_OutgoingProtocol.java b/javasource/email_connector/proxies/ENUM_OutgoingProtocol.java
deleted file mode 100644
index 59a391a..0000000
--- a/javasource/email_connector/proxies/ENUM_OutgoingProtocol.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_OutgoingProtocol
-{
- SMTP(new java.lang.String[][] { new java.lang.String[] { "en_US", "SMTP" } });
-
- private java.util.Map captions;
-
- private ENUM_OutgoingProtocol(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/ENUM_RecipientsRegEx.java b/javasource/email_connector/proxies/ENUM_RecipientsRegEx.java
deleted file mode 100644
index abb22e6..0000000
--- a/javasource/email_connector/proxies/ENUM_RecipientsRegEx.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public enum ENUM_RecipientsRegEx
-{
- regex(new java.lang.String[][] { new java.lang.String[] { "en_US", "^(?:(?:\"?(?:[^\";]*)\"?\\s?)?(?:[a-zA-Z0-9_!#$%&\"’*+/=?`{|}~^.-]+@[a-zA-Z0-9.\\[\\]-]+?>?;\\s?))*(?:(?:(?:\"?(?:[^\";]*)\"?\\s?)?(?:[a-zA-Z0-9_!#$%&\"’*+/=?`{|}~^.-]+@[a-zA-Z0-9.\\[\\]-]+?>?\\s?)))$" } });
-
- private java.util.Map captions;
-
- private ENUM_RecipientsRegEx(java.lang.String[][] captionStrings)
- {
- this.captions = new java.util.HashMap();
- for (java.lang.String[] captionString : captionStrings)
- captions.put(captionString[0], captionString[1]);
- }
-
- public java.lang.String getCaption(java.lang.String languageCode)
- {
- if (captions.containsKey(languageCode))
- return captions.get(languageCode);
- return captions.get("en_US");
- }
-
- public java.lang.String getCaption()
- {
- return captions.get("en_US");
- }
-}
diff --git a/javasource/email_connector/proxies/EmailAccount.java b/javasource/email_connector/proxies/EmailAccount.java
deleted file mode 100644
index 8c83641..0000000
--- a/javasource/email_connector/proxies/EmailAccount.java
+++ /dev/null
@@ -1,915 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public class EmailAccount
-{
- private final com.mendix.systemwideinterfaces.core.IMendixObject emailAccountMendixObject;
-
- private final com.mendix.systemwideinterfaces.core.IContext context;
-
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Email_Connector.EmailAccount";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- Username("Username"),
- Password("Password"),
- Timeout("Timeout"),
- sanitizeEmailBodyForXSSScript("sanitizeEmailBodyForXSSScript"),
- isP12Configured("isP12Configured"),
- isLDAPConfigured("isLDAPConfigured"),
- isIncomingEmailConfigured("isIncomingEmailConfigured"),
- isOutgoingEmailConfigured("isOutgoingEmailConfigured"),
- FromDisplayName("FromDisplayName"),
- UseSSLCheckServerIdentity("UseSSLCheckServerIdentity"),
- isOAuthUsed("isOAuthUsed"),
- OAuthSetupComplete("OAuthSetupComplete"),
- isEmailConfigAutoDetect("isEmailConfigAutoDetect"),
- OutgoingEmailConfiguration_EmailAccount("Email_Connector.OutgoingEmailConfiguration_EmailAccount"),
- IncomingEmailConfiguration_EmailAccount("Email_Connector.IncomingEmailConfiguration_EmailAccount"),
- Pk12Certificate_EmailAccount("Email_Connector.Pk12Certificate_EmailAccount"),
- EmailAccount_LDAPConfiguration("Email_Connector.EmailAccount_LDAPConfiguration"),
- EmailAccount_OAuthProvider("Email_Connector.EmailAccount_OAuthProvider"),
- EmailAccount_OAuthToken("Email_Connector.EmailAccount_OAuthToken");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public EmailAccount(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Email_Connector.EmailAccount"));
- }
-
- protected EmailAccount(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject emailAccountMendixObject)
- {
- if (emailAccountMendixObject == null)
- throw new java.lang.IllegalArgumentException("The given object cannot be null.");
- if (!com.mendix.core.Core.isSubClassOf("Email_Connector.EmailAccount", emailAccountMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Email_Connector.EmailAccount");
-
- this.emailAccountMendixObject = emailAccountMendixObject;
- this.context = context;
- }
-
- /**
- * @deprecated Use 'EmailAccount.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static email_connector.proxies.EmailAccount initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return email_connector.proxies.EmailAccount.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static email_connector.proxies.EmailAccount initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new email_connector.proxies.EmailAccount(context, mendixObject);
- }
-
- public static email_connector.proxies.EmailAccount load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return email_connector.proxies.EmailAccount.initialize(context, mendixObject);
- }
-
- public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
- {
- java.util.List result = new java.util.ArrayList();
- for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//Email_Connector.EmailAccount" + xpathConstraint))
- result.add(email_connector.proxies.EmailAccount.initialize(context, obj));
- return result;
- }
-
- /**
- * Commit the changes made on this proxy object.
- */
- public final void commit() throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Commit the changes made on this proxy object using the specified context.
- */
- public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Delete the object.
- */
- public final void delete()
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
-
- /**
- * Delete the object using the specified context.
- */
- public final void delete(com.mendix.systemwideinterfaces.core.IContext context)
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
- /**
- * @return value of Username
- */
- public final java.lang.String getUsername()
- {
- return getUsername(getContext());
- }
-
- /**
- * @param context
- * @return value of Username
- */
- public final java.lang.String getUsername(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.Username.toString());
- }
-
- /**
- * Set value of Username
- * @param username
- */
- public final void setUsername(java.lang.String username)
- {
- setUsername(getContext(), username);
- }
-
- /**
- * Set value of Username
- * @param context
- * @param username
- */
- public final void setUsername(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String username)
- {
- getMendixObject().setValue(context, MemberNames.Username.toString(), username);
- }
-
- /**
- * @return value of Password
- */
- public final java.lang.String getPassword()
- {
- return getPassword(getContext());
- }
-
- /**
- * @param context
- * @return value of Password
- */
- public final java.lang.String getPassword(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.Password.toString());
- }
-
- /**
- * Set value of Password
- * @param password
- */
- public final void setPassword(java.lang.String password)
- {
- setPassword(getContext(), password);
- }
-
- /**
- * Set value of Password
- * @param context
- * @param password
- */
- public final void setPassword(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String password)
- {
- getMendixObject().setValue(context, MemberNames.Password.toString(), password);
- }
-
- /**
- * @return value of Timeout
- */
- public final java.lang.Integer getTimeout()
- {
- return getTimeout(getContext());
- }
-
- /**
- * @param context
- * @return value of Timeout
- */
- public final java.lang.Integer getTimeout(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Integer) getMendixObject().getValue(context, MemberNames.Timeout.toString());
- }
-
- /**
- * Set value of Timeout
- * @param timeout
- */
- public final void setTimeout(java.lang.Integer timeout)
- {
- setTimeout(getContext(), timeout);
- }
-
- /**
- * Set value of Timeout
- * @param context
- * @param timeout
- */
- public final void setTimeout(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Integer timeout)
- {
- getMendixObject().setValue(context, MemberNames.Timeout.toString(), timeout);
- }
-
- /**
- * @return value of sanitizeEmailBodyForXSSScript
- */
- public final java.lang.Boolean getsanitizeEmailBodyForXSSScript()
- {
- return getsanitizeEmailBodyForXSSScript(getContext());
- }
-
- /**
- * @param context
- * @return value of sanitizeEmailBodyForXSSScript
- */
- public final java.lang.Boolean getsanitizeEmailBodyForXSSScript(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.sanitizeEmailBodyForXSSScript.toString());
- }
-
- /**
- * Set value of sanitizeEmailBodyForXSSScript
- * @param sanitizeemailbodyforxssscript
- */
- public final void setsanitizeEmailBodyForXSSScript(java.lang.Boolean sanitizeemailbodyforxssscript)
- {
- setsanitizeEmailBodyForXSSScript(getContext(), sanitizeemailbodyforxssscript);
- }
-
- /**
- * Set value of sanitizeEmailBodyForXSSScript
- * @param context
- * @param sanitizeemailbodyforxssscript
- */
- public final void setsanitizeEmailBodyForXSSScript(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean sanitizeemailbodyforxssscript)
- {
- getMendixObject().setValue(context, MemberNames.sanitizeEmailBodyForXSSScript.toString(), sanitizeemailbodyforxssscript);
- }
-
- /**
- * @return value of isP12Configured
- */
- public final java.lang.Boolean getisP12Configured()
- {
- return getisP12Configured(getContext());
- }
-
- /**
- * @param context
- * @return value of isP12Configured
- */
- public final java.lang.Boolean getisP12Configured(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isP12Configured.toString());
- }
-
- /**
- * Set value of isP12Configured
- * @param isp12configured
- */
- public final void setisP12Configured(java.lang.Boolean isp12configured)
- {
- setisP12Configured(getContext(), isp12configured);
- }
-
- /**
- * Set value of isP12Configured
- * @param context
- * @param isp12configured
- */
- public final void setisP12Configured(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isp12configured)
- {
- getMendixObject().setValue(context, MemberNames.isP12Configured.toString(), isp12configured);
- }
-
- /**
- * @return value of isLDAPConfigured
- */
- public final java.lang.Boolean getisLDAPConfigured()
- {
- return getisLDAPConfigured(getContext());
- }
-
- /**
- * @param context
- * @return value of isLDAPConfigured
- */
- public final java.lang.Boolean getisLDAPConfigured(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isLDAPConfigured.toString());
- }
-
- /**
- * Set value of isLDAPConfigured
- * @param isldapconfigured
- */
- public final void setisLDAPConfigured(java.lang.Boolean isldapconfigured)
- {
- setisLDAPConfigured(getContext(), isldapconfigured);
- }
-
- /**
- * Set value of isLDAPConfigured
- * @param context
- * @param isldapconfigured
- */
- public final void setisLDAPConfigured(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isldapconfigured)
- {
- getMendixObject().setValue(context, MemberNames.isLDAPConfigured.toString(), isldapconfigured);
- }
-
- /**
- * @return value of isIncomingEmailConfigured
- */
- public final java.lang.Boolean getisIncomingEmailConfigured()
- {
- return getisIncomingEmailConfigured(getContext());
- }
-
- /**
- * @param context
- * @return value of isIncomingEmailConfigured
- */
- public final java.lang.Boolean getisIncomingEmailConfigured(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isIncomingEmailConfigured.toString());
- }
-
- /**
- * Set value of isIncomingEmailConfigured
- * @param isincomingemailconfigured
- */
- public final void setisIncomingEmailConfigured(java.lang.Boolean isincomingemailconfigured)
- {
- setisIncomingEmailConfigured(getContext(), isincomingemailconfigured);
- }
-
- /**
- * Set value of isIncomingEmailConfigured
- * @param context
- * @param isincomingemailconfigured
- */
- public final void setisIncomingEmailConfigured(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isincomingemailconfigured)
- {
- getMendixObject().setValue(context, MemberNames.isIncomingEmailConfigured.toString(), isincomingemailconfigured);
- }
-
- /**
- * @return value of isOutgoingEmailConfigured
- */
- public final java.lang.Boolean getisOutgoingEmailConfigured()
- {
- return getisOutgoingEmailConfigured(getContext());
- }
-
- /**
- * @param context
- * @return value of isOutgoingEmailConfigured
- */
- public final java.lang.Boolean getisOutgoingEmailConfigured(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isOutgoingEmailConfigured.toString());
- }
-
- /**
- * Set value of isOutgoingEmailConfigured
- * @param isoutgoingemailconfigured
- */
- public final void setisOutgoingEmailConfigured(java.lang.Boolean isoutgoingemailconfigured)
- {
- setisOutgoingEmailConfigured(getContext(), isoutgoingemailconfigured);
- }
-
- /**
- * Set value of isOutgoingEmailConfigured
- * @param context
- * @param isoutgoingemailconfigured
- */
- public final void setisOutgoingEmailConfigured(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isoutgoingemailconfigured)
- {
- getMendixObject().setValue(context, MemberNames.isOutgoingEmailConfigured.toString(), isoutgoingemailconfigured);
- }
-
- /**
- * @return value of FromDisplayName
- */
- public final java.lang.String getFromDisplayName()
- {
- return getFromDisplayName(getContext());
- }
-
- /**
- * @param context
- * @return value of FromDisplayName
- */
- public final java.lang.String getFromDisplayName(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.FromDisplayName.toString());
- }
-
- /**
- * Set value of FromDisplayName
- * @param fromdisplayname
- */
- public final void setFromDisplayName(java.lang.String fromdisplayname)
- {
- setFromDisplayName(getContext(), fromdisplayname);
- }
-
- /**
- * Set value of FromDisplayName
- * @param context
- * @param fromdisplayname
- */
- public final void setFromDisplayName(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String fromdisplayname)
- {
- getMendixObject().setValue(context, MemberNames.FromDisplayName.toString(), fromdisplayname);
- }
-
- /**
- * @return value of UseSSLCheckServerIdentity
- */
- public final java.lang.Boolean getUseSSLCheckServerIdentity()
- {
- return getUseSSLCheckServerIdentity(getContext());
- }
-
- /**
- * @param context
- * @return value of UseSSLCheckServerIdentity
- */
- public final java.lang.Boolean getUseSSLCheckServerIdentity(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.UseSSLCheckServerIdentity.toString());
- }
-
- /**
- * Set value of UseSSLCheckServerIdentity
- * @param usesslcheckserveridentity
- */
- public final void setUseSSLCheckServerIdentity(java.lang.Boolean usesslcheckserveridentity)
- {
- setUseSSLCheckServerIdentity(getContext(), usesslcheckserveridentity);
- }
-
- /**
- * Set value of UseSSLCheckServerIdentity
- * @param context
- * @param usesslcheckserveridentity
- */
- public final void setUseSSLCheckServerIdentity(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean usesslcheckserveridentity)
- {
- getMendixObject().setValue(context, MemberNames.UseSSLCheckServerIdentity.toString(), usesslcheckserveridentity);
- }
-
- /**
- * @return value of isOAuthUsed
- */
- public final java.lang.Boolean getisOAuthUsed()
- {
- return getisOAuthUsed(getContext());
- }
-
- /**
- * @param context
- * @return value of isOAuthUsed
- */
- public final java.lang.Boolean getisOAuthUsed(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isOAuthUsed.toString());
- }
-
- /**
- * Set value of isOAuthUsed
- * @param isoauthused
- */
- public final void setisOAuthUsed(java.lang.Boolean isoauthused)
- {
- setisOAuthUsed(getContext(), isoauthused);
- }
-
- /**
- * Set value of isOAuthUsed
- * @param context
- * @param isoauthused
- */
- public final void setisOAuthUsed(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isoauthused)
- {
- getMendixObject().setValue(context, MemberNames.isOAuthUsed.toString(), isoauthused);
- }
-
- /**
- * @return value of OAuthSetupComplete
- */
- public final java.lang.Boolean getOAuthSetupComplete()
- {
- return getOAuthSetupComplete(getContext());
- }
-
- /**
- * @param context
- * @return value of OAuthSetupComplete
- */
- public final java.lang.Boolean getOAuthSetupComplete(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.OAuthSetupComplete.toString());
- }
-
- /**
- * Set value of OAuthSetupComplete
- * @param oauthsetupcomplete
- */
- public final void setOAuthSetupComplete(java.lang.Boolean oauthsetupcomplete)
- {
- setOAuthSetupComplete(getContext(), oauthsetupcomplete);
- }
-
- /**
- * Set value of OAuthSetupComplete
- * @param context
- * @param oauthsetupcomplete
- */
- public final void setOAuthSetupComplete(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean oauthsetupcomplete)
- {
- getMendixObject().setValue(context, MemberNames.OAuthSetupComplete.toString(), oauthsetupcomplete);
- }
-
- /**
- * @return value of isEmailConfigAutoDetect
- */
- public final java.lang.Boolean getisEmailConfigAutoDetect()
- {
- return getisEmailConfigAutoDetect(getContext());
- }
-
- /**
- * @param context
- * @return value of isEmailConfigAutoDetect
- */
- public final java.lang.Boolean getisEmailConfigAutoDetect(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.isEmailConfigAutoDetect.toString());
- }
-
- /**
- * Set value of isEmailConfigAutoDetect
- * @param isemailconfigautodetect
- */
- public final void setisEmailConfigAutoDetect(java.lang.Boolean isemailconfigautodetect)
- {
- setisEmailConfigAutoDetect(getContext(), isemailconfigautodetect);
- }
-
- /**
- * Set value of isEmailConfigAutoDetect
- * @param context
- * @param isemailconfigautodetect
- */
- public final void setisEmailConfigAutoDetect(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isemailconfigautodetect)
- {
- getMendixObject().setValue(context, MemberNames.isEmailConfigAutoDetect.toString(), isemailconfigautodetect);
- }
-
- /**
- * @return value of OutgoingEmailConfiguration_EmailAccount
- */
- public final email_connector.proxies.OutgoingEmailConfiguration getOutgoingEmailConfiguration_EmailAccount() throws com.mendix.core.CoreException
- {
- return getOutgoingEmailConfiguration_EmailAccount(getContext());
- }
-
- /**
- * @param context
- * @return value of OutgoingEmailConfiguration_EmailAccount
- */
- public final email_connector.proxies.OutgoingEmailConfiguration getOutgoingEmailConfiguration_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.OutgoingEmailConfiguration result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.OutgoingEmailConfiguration_EmailAccount.toString());
- if (identifier != null)
- result = email_connector.proxies.OutgoingEmailConfiguration.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of OutgoingEmailConfiguration_EmailAccount
- * @param outgoingemailconfiguration_emailaccount
- */
- public final void setOutgoingEmailConfiguration_EmailAccount(email_connector.proxies.OutgoingEmailConfiguration outgoingemailconfiguration_emailaccount)
- {
- setOutgoingEmailConfiguration_EmailAccount(getContext(), outgoingemailconfiguration_emailaccount);
- }
-
- /**
- * Set value of OutgoingEmailConfiguration_EmailAccount
- * @param context
- * @param outgoingemailconfiguration_emailaccount
- */
- public final void setOutgoingEmailConfiguration_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.OutgoingEmailConfiguration outgoingemailconfiguration_emailaccount)
- {
- if (outgoingemailconfiguration_emailaccount == null)
- getMendixObject().setValue(context, MemberNames.OutgoingEmailConfiguration_EmailAccount.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.OutgoingEmailConfiguration_EmailAccount.toString(), outgoingemailconfiguration_emailaccount.getMendixObject().getId());
- }
-
- /**
- * @return value of IncomingEmailConfiguration_EmailAccount
- */
- public final email_connector.proxies.IncomingEmailConfiguration getIncomingEmailConfiguration_EmailAccount() throws com.mendix.core.CoreException
- {
- return getIncomingEmailConfiguration_EmailAccount(getContext());
- }
-
- /**
- * @param context
- * @return value of IncomingEmailConfiguration_EmailAccount
- */
- public final email_connector.proxies.IncomingEmailConfiguration getIncomingEmailConfiguration_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.IncomingEmailConfiguration result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.IncomingEmailConfiguration_EmailAccount.toString());
- if (identifier != null)
- result = email_connector.proxies.IncomingEmailConfiguration.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of IncomingEmailConfiguration_EmailAccount
- * @param incomingemailconfiguration_emailaccount
- */
- public final void setIncomingEmailConfiguration_EmailAccount(email_connector.proxies.IncomingEmailConfiguration incomingemailconfiguration_emailaccount)
- {
- setIncomingEmailConfiguration_EmailAccount(getContext(), incomingemailconfiguration_emailaccount);
- }
-
- /**
- * Set value of IncomingEmailConfiguration_EmailAccount
- * @param context
- * @param incomingemailconfiguration_emailaccount
- */
- public final void setIncomingEmailConfiguration_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.IncomingEmailConfiguration incomingemailconfiguration_emailaccount)
- {
- if (incomingemailconfiguration_emailaccount == null)
- getMendixObject().setValue(context, MemberNames.IncomingEmailConfiguration_EmailAccount.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.IncomingEmailConfiguration_EmailAccount.toString(), incomingemailconfiguration_emailaccount.getMendixObject().getId());
- }
-
- /**
- * @return value of Pk12Certificate_EmailAccount
- */
- public final email_connector.proxies.Pk12Certificate getPk12Certificate_EmailAccount() throws com.mendix.core.CoreException
- {
- return getPk12Certificate_EmailAccount(getContext());
- }
-
- /**
- * @param context
- * @return value of Pk12Certificate_EmailAccount
- */
- public final email_connector.proxies.Pk12Certificate getPk12Certificate_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.Pk12Certificate result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.Pk12Certificate_EmailAccount.toString());
- if (identifier != null)
- result = email_connector.proxies.Pk12Certificate.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of Pk12Certificate_EmailAccount
- * @param pk12certificate_emailaccount
- */
- public final void setPk12Certificate_EmailAccount(email_connector.proxies.Pk12Certificate pk12certificate_emailaccount)
- {
- setPk12Certificate_EmailAccount(getContext(), pk12certificate_emailaccount);
- }
-
- /**
- * Set value of Pk12Certificate_EmailAccount
- * @param context
- * @param pk12certificate_emailaccount
- */
- public final void setPk12Certificate_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.Pk12Certificate pk12certificate_emailaccount)
- {
- if (pk12certificate_emailaccount == null)
- getMendixObject().setValue(context, MemberNames.Pk12Certificate_EmailAccount.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.Pk12Certificate_EmailAccount.toString(), pk12certificate_emailaccount.getMendixObject().getId());
- }
-
- /**
- * @return value of EmailAccount_LDAPConfiguration
- */
- public final email_connector.proxies.LDAPConfiguration getEmailAccount_LDAPConfiguration() throws com.mendix.core.CoreException
- {
- return getEmailAccount_LDAPConfiguration(getContext());
- }
-
- /**
- * @param context
- * @return value of EmailAccount_LDAPConfiguration
- */
- public final email_connector.proxies.LDAPConfiguration getEmailAccount_LDAPConfiguration(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.LDAPConfiguration result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.EmailAccount_LDAPConfiguration.toString());
- if (identifier != null)
- result = email_connector.proxies.LDAPConfiguration.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of EmailAccount_LDAPConfiguration
- * @param emailaccount_ldapconfiguration
- */
- public final void setEmailAccount_LDAPConfiguration(email_connector.proxies.LDAPConfiguration emailaccount_ldapconfiguration)
- {
- setEmailAccount_LDAPConfiguration(getContext(), emailaccount_ldapconfiguration);
- }
-
- /**
- * Set value of EmailAccount_LDAPConfiguration
- * @param context
- * @param emailaccount_ldapconfiguration
- */
- public final void setEmailAccount_LDAPConfiguration(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.LDAPConfiguration emailaccount_ldapconfiguration)
- {
- if (emailaccount_ldapconfiguration == null)
- getMendixObject().setValue(context, MemberNames.EmailAccount_LDAPConfiguration.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.EmailAccount_LDAPConfiguration.toString(), emailaccount_ldapconfiguration.getMendixObject().getId());
- }
-
- /**
- * @return value of EmailAccount_OAuthProvider
- */
- public final email_connector.proxies.OAuthProvider getEmailAccount_OAuthProvider() throws com.mendix.core.CoreException
- {
- return getEmailAccount_OAuthProvider(getContext());
- }
-
- /**
- * @param context
- * @return value of EmailAccount_OAuthProvider
- */
- public final email_connector.proxies.OAuthProvider getEmailAccount_OAuthProvider(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.OAuthProvider result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.EmailAccount_OAuthProvider.toString());
- if (identifier != null)
- result = email_connector.proxies.OAuthProvider.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of EmailAccount_OAuthProvider
- * @param emailaccount_oauthprovider
- */
- public final void setEmailAccount_OAuthProvider(email_connector.proxies.OAuthProvider emailaccount_oauthprovider)
- {
- setEmailAccount_OAuthProvider(getContext(), emailaccount_oauthprovider);
- }
-
- /**
- * Set value of EmailAccount_OAuthProvider
- * @param context
- * @param emailaccount_oauthprovider
- */
- public final void setEmailAccount_OAuthProvider(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.OAuthProvider emailaccount_oauthprovider)
- {
- if (emailaccount_oauthprovider == null)
- getMendixObject().setValue(context, MemberNames.EmailAccount_OAuthProvider.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.EmailAccount_OAuthProvider.toString(), emailaccount_oauthprovider.getMendixObject().getId());
- }
-
- /**
- * @return value of EmailAccount_OAuthToken
- */
- public final email_connector.proxies.OAuthToken getEmailAccount_OAuthToken() throws com.mendix.core.CoreException
- {
- return getEmailAccount_OAuthToken(getContext());
- }
-
- /**
- * @param context
- * @return value of EmailAccount_OAuthToken
- */
- public final email_connector.proxies.OAuthToken getEmailAccount_OAuthToken(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.OAuthToken result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.EmailAccount_OAuthToken.toString());
- if (identifier != null)
- result = email_connector.proxies.OAuthToken.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of EmailAccount_OAuthToken
- * @param emailaccount_oauthtoken
- */
- public final void setEmailAccount_OAuthToken(email_connector.proxies.OAuthToken emailaccount_oauthtoken)
- {
- setEmailAccount_OAuthToken(getContext(), emailaccount_oauthtoken);
- }
-
- /**
- * Set value of EmailAccount_OAuthToken
- * @param context
- * @param emailaccount_oauthtoken
- */
- public final void setEmailAccount_OAuthToken(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.OAuthToken emailaccount_oauthtoken)
- {
- if (emailaccount_oauthtoken == null)
- getMendixObject().setValue(context, MemberNames.EmailAccount_OAuthToken.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.EmailAccount_OAuthToken.toString(), emailaccount_oauthtoken.getMendixObject().getId());
- }
-
- /**
- * @return the IMendixObject instance of this proxy for use in the Core interface.
- */
- public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject()
- {
- return emailAccountMendixObject;
- }
-
- /**
- * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization.
- */
- public final com.mendix.systemwideinterfaces.core.IContext getContext()
- {
- return context;
- }
-
- @java.lang.Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj != null && getClass().equals(obj.getClass()))
- {
- final email_connector.proxies.EmailAccount that = (email_connector.proxies.EmailAccount) obj;
- return getMendixObject().equals(that.getMendixObject());
- }
- return false;
- }
-
- @java.lang.Override
- public int hashCode()
- {
- return getMendixObject().hashCode();
- }
-
- /**
- * @return String name of this class
- */
- public static java.lang.String getType()
- {
- return "Email_Connector.EmailAccount";
- }
-
- /**
- * @return String GUID from this object, format: ID_0000000000
- * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
- */
- @java.lang.Deprecated
- public java.lang.String getGUID()
- {
- return "ID_" + getMendixObject().getId().toLong();
- }
-}
diff --git a/javasource/email_connector/proxies/EmailConnectorLog.java b/javasource/email_connector/proxies/EmailConnectorLog.java
deleted file mode 100644
index 02d6d9e..0000000
--- a/javasource/email_connector/proxies/EmailConnectorLog.java
+++ /dev/null
@@ -1,525 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public class EmailConnectorLog
-{
- private final com.mendix.systemwideinterfaces.core.IMendixObject emailConnectorLogMendixObject;
-
- private final com.mendix.systemwideinterfaces.core.IContext context;
-
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Email_Connector.EmailConnectorLog";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- Created("Created"),
- Logtype("Logtype"),
- ErrorMessage("ErrorMessage"),
- TriggeredInMF("TriggeredInMF"),
- StackTrace("StackTrace"),
- Message("Message"),
- IsUnread("IsUnread"),
- EmailConnectorLog_EmailMessage("Email_Connector.EmailConnectorLog_EmailMessage"),
- EmailConnectorLog_EmailAccount("Email_Connector.EmailConnectorLog_EmailAccount");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public EmailConnectorLog(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Email_Connector.EmailConnectorLog"));
- }
-
- protected EmailConnectorLog(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject emailConnectorLogMendixObject)
- {
- if (emailConnectorLogMendixObject == null)
- throw new java.lang.IllegalArgumentException("The given object cannot be null.");
- if (!com.mendix.core.Core.isSubClassOf("Email_Connector.EmailConnectorLog", emailConnectorLogMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Email_Connector.EmailConnectorLog");
-
- this.emailConnectorLogMendixObject = emailConnectorLogMendixObject;
- this.context = context;
- }
-
- /**
- * @deprecated Use 'EmailConnectorLog.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static email_connector.proxies.EmailConnectorLog initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return email_connector.proxies.EmailConnectorLog.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static email_connector.proxies.EmailConnectorLog initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new email_connector.proxies.EmailConnectorLog(context, mendixObject);
- }
-
- public static email_connector.proxies.EmailConnectorLog load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return email_connector.proxies.EmailConnectorLog.initialize(context, mendixObject);
- }
-
- public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
- {
- java.util.List result = new java.util.ArrayList();
- for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//Email_Connector.EmailConnectorLog" + xpathConstraint))
- result.add(email_connector.proxies.EmailConnectorLog.initialize(context, obj));
- return result;
- }
-
- /**
- * Commit the changes made on this proxy object.
- */
- public final void commit() throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Commit the changes made on this proxy object using the specified context.
- */
- public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- com.mendix.core.Core.commit(context, getMendixObject());
- }
-
- /**
- * Delete the object.
- */
- public final void delete()
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
-
- /**
- * Delete the object using the specified context.
- */
- public final void delete(com.mendix.systemwideinterfaces.core.IContext context)
- {
- com.mendix.core.Core.delete(context, getMendixObject());
- }
- /**
- * @return value of Created
- */
- public final java.util.Date getCreated()
- {
- return getCreated(getContext());
- }
-
- /**
- * @param context
- * @return value of Created
- */
- public final java.util.Date getCreated(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.util.Date) getMendixObject().getValue(context, MemberNames.Created.toString());
- }
-
- /**
- * Set value of Created
- * @param created
- */
- public final void setCreated(java.util.Date created)
- {
- setCreated(getContext(), created);
- }
-
- /**
- * Set value of Created
- * @param context
- * @param created
- */
- public final void setCreated(com.mendix.systemwideinterfaces.core.IContext context, java.util.Date created)
- {
- getMendixObject().setValue(context, MemberNames.Created.toString(), created);
- }
-
- /**
- * Set value of Logtype
- * @param logtype
- */
- public final email_connector.proxies.ENUM_LogType getLogtype()
- {
- return getLogtype(getContext());
- }
-
- /**
- * @param context
- * @return value of Logtype
- */
- public final email_connector.proxies.ENUM_LogType getLogtype(com.mendix.systemwideinterfaces.core.IContext context)
- {
- Object obj = getMendixObject().getValue(context, MemberNames.Logtype.toString());
- if (obj == null)
- return null;
-
- return email_connector.proxies.ENUM_LogType.valueOf((java.lang.String) obj);
- }
-
- /**
- * Set value of Logtype
- * @param logtype
- */
- public final void setLogtype(email_connector.proxies.ENUM_LogType logtype)
- {
- setLogtype(getContext(), logtype);
- }
-
- /**
- * Set value of Logtype
- * @param context
- * @param logtype
- */
- public final void setLogtype(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.ENUM_LogType logtype)
- {
- if (logtype != null)
- getMendixObject().setValue(context, MemberNames.Logtype.toString(), logtype.toString());
- else
- getMendixObject().setValue(context, MemberNames.Logtype.toString(), null);
- }
-
- /**
- * @return value of ErrorMessage
- */
- public final java.lang.String getErrorMessage()
- {
- return getErrorMessage(getContext());
- }
-
- /**
- * @param context
- * @return value of ErrorMessage
- */
- public final java.lang.String getErrorMessage(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.ErrorMessage.toString());
- }
-
- /**
- * Set value of ErrorMessage
- * @param errormessage
- */
- public final void setErrorMessage(java.lang.String errormessage)
- {
- setErrorMessage(getContext(), errormessage);
- }
-
- /**
- * Set value of ErrorMessage
- * @param context
- * @param errormessage
- */
- public final void setErrorMessage(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String errormessage)
- {
- getMendixObject().setValue(context, MemberNames.ErrorMessage.toString(), errormessage);
- }
-
- /**
- * @return value of TriggeredInMF
- */
- public final java.lang.String getTriggeredInMF()
- {
- return getTriggeredInMF(getContext());
- }
-
- /**
- * @param context
- * @return value of TriggeredInMF
- */
- public final java.lang.String getTriggeredInMF(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.TriggeredInMF.toString());
- }
-
- /**
- * Set value of TriggeredInMF
- * @param triggeredinmf
- */
- public final void setTriggeredInMF(java.lang.String triggeredinmf)
- {
- setTriggeredInMF(getContext(), triggeredinmf);
- }
-
- /**
- * Set value of TriggeredInMF
- * @param context
- * @param triggeredinmf
- */
- public final void setTriggeredInMF(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String triggeredinmf)
- {
- getMendixObject().setValue(context, MemberNames.TriggeredInMF.toString(), triggeredinmf);
- }
-
- /**
- * @return value of StackTrace
- */
- public final java.lang.String getStackTrace()
- {
- return getStackTrace(getContext());
- }
-
- /**
- * @param context
- * @return value of StackTrace
- */
- public final java.lang.String getStackTrace(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.StackTrace.toString());
- }
-
- /**
- * Set value of StackTrace
- * @param stacktrace
- */
- public final void setStackTrace(java.lang.String stacktrace)
- {
- setStackTrace(getContext(), stacktrace);
- }
-
- /**
- * Set value of StackTrace
- * @param context
- * @param stacktrace
- */
- public final void setStackTrace(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String stacktrace)
- {
- getMendixObject().setValue(context, MemberNames.StackTrace.toString(), stacktrace);
- }
-
- /**
- * @return value of Message
- */
- public final java.lang.String getMessage()
- {
- return getMessage(getContext());
- }
-
- /**
- * @param context
- * @return value of Message
- */
- public final java.lang.String getMessage(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.String) getMendixObject().getValue(context, MemberNames.Message.toString());
- }
-
- /**
- * Set value of Message
- * @param message
- */
- public final void setMessage(java.lang.String message)
- {
- setMessage(getContext(), message);
- }
-
- /**
- * Set value of Message
- * @param context
- * @param message
- */
- public final void setMessage(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String message)
- {
- getMendixObject().setValue(context, MemberNames.Message.toString(), message);
- }
-
- /**
- * @return value of IsUnread
- */
- public final java.lang.Boolean getIsUnread()
- {
- return getIsUnread(getContext());
- }
-
- /**
- * @param context
- * @return value of IsUnread
- */
- public final java.lang.Boolean getIsUnread(com.mendix.systemwideinterfaces.core.IContext context)
- {
- return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.IsUnread.toString());
- }
-
- /**
- * Set value of IsUnread
- * @param isunread
- */
- public final void setIsUnread(java.lang.Boolean isunread)
- {
- setIsUnread(getContext(), isunread);
- }
-
- /**
- * Set value of IsUnread
- * @param context
- * @param isunread
- */
- public final void setIsUnread(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean isunread)
- {
- getMendixObject().setValue(context, MemberNames.IsUnread.toString(), isunread);
- }
-
- /**
- * @return value of EmailConnectorLog_EmailMessage
- */
- public final email_connector.proxies.EmailMessage getEmailConnectorLog_EmailMessage() throws com.mendix.core.CoreException
- {
- return getEmailConnectorLog_EmailMessage(getContext());
- }
-
- /**
- * @param context
- * @return value of EmailConnectorLog_EmailMessage
- */
- public final email_connector.proxies.EmailMessage getEmailConnectorLog_EmailMessage(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.EmailMessage result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.EmailConnectorLog_EmailMessage.toString());
- if (identifier != null)
- result = email_connector.proxies.EmailMessage.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of EmailConnectorLog_EmailMessage
- * @param emailconnectorlog_emailmessage
- */
- public final void setEmailConnectorLog_EmailMessage(email_connector.proxies.EmailMessage emailconnectorlog_emailmessage)
- {
- setEmailConnectorLog_EmailMessage(getContext(), emailconnectorlog_emailmessage);
- }
-
- /**
- * Set value of EmailConnectorLog_EmailMessage
- * @param context
- * @param emailconnectorlog_emailmessage
- */
- public final void setEmailConnectorLog_EmailMessage(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.EmailMessage emailconnectorlog_emailmessage)
- {
- if (emailconnectorlog_emailmessage == null)
- getMendixObject().setValue(context, MemberNames.EmailConnectorLog_EmailMessage.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.EmailConnectorLog_EmailMessage.toString(), emailconnectorlog_emailmessage.getMendixObject().getId());
- }
-
- /**
- * @return value of EmailConnectorLog_EmailAccount
- */
- public final email_connector.proxies.EmailAccount getEmailConnectorLog_EmailAccount() throws com.mendix.core.CoreException
- {
- return getEmailConnectorLog_EmailAccount(getContext());
- }
-
- /**
- * @param context
- * @return value of EmailConnectorLog_EmailAccount
- */
- public final email_connector.proxies.EmailAccount getEmailConnectorLog_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
- {
- email_connector.proxies.EmailAccount result = null;
- com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.EmailConnectorLog_EmailAccount.toString());
- if (identifier != null)
- result = email_connector.proxies.EmailAccount.load(context, identifier);
- return result;
- }
-
- /**
- * Set value of EmailConnectorLog_EmailAccount
- * @param emailconnectorlog_emailaccount
- */
- public final void setEmailConnectorLog_EmailAccount(email_connector.proxies.EmailAccount emailconnectorlog_emailaccount)
- {
- setEmailConnectorLog_EmailAccount(getContext(), emailconnectorlog_emailaccount);
- }
-
- /**
- * Set value of EmailConnectorLog_EmailAccount
- * @param context
- * @param emailconnectorlog_emailaccount
- */
- public final void setEmailConnectorLog_EmailAccount(com.mendix.systemwideinterfaces.core.IContext context, email_connector.proxies.EmailAccount emailconnectorlog_emailaccount)
- {
- if (emailconnectorlog_emailaccount == null)
- getMendixObject().setValue(context, MemberNames.EmailConnectorLog_EmailAccount.toString(), null);
- else
- getMendixObject().setValue(context, MemberNames.EmailConnectorLog_EmailAccount.toString(), emailconnectorlog_emailaccount.getMendixObject().getId());
- }
-
- /**
- * @return the IMendixObject instance of this proxy for use in the Core interface.
- */
- public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject()
- {
- return emailConnectorLogMendixObject;
- }
-
- /**
- * @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization.
- */
- public final com.mendix.systemwideinterfaces.core.IContext getContext()
- {
- return context;
- }
-
- @java.lang.Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj != null && getClass().equals(obj.getClass()))
- {
- final email_connector.proxies.EmailConnectorLog that = (email_connector.proxies.EmailConnectorLog) obj;
- return getMendixObject().equals(that.getMendixObject());
- }
- return false;
- }
-
- @java.lang.Override
- public int hashCode()
- {
- return getMendixObject().hashCode();
- }
-
- /**
- * @return String name of this class
- */
- public static java.lang.String getType()
- {
- return "Email_Connector.EmailConnectorLog";
- }
-
- /**
- * @return String GUID from this object, format: ID_0000000000
- * @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
- */
- @java.lang.Deprecated
- public java.lang.String getGUID()
- {
- return "ID_" + getMendixObject().getId().toLong();
- }
-}
diff --git a/javasource/email_connector/proxies/EmailMessage.java b/javasource/email_connector/proxies/EmailMessage.java
deleted file mode 100644
index e5679e7..0000000
--- a/javasource/email_connector/proxies/EmailMessage.java
+++ /dev/null
@@ -1,1080 +0,0 @@
-// This file was generated by Mendix Studio Pro.
-//
-// WARNING: Code you write here will be lost the next time you deploy the project.
-
-package email_connector.proxies;
-
-public class EmailMessage
-{
- private final com.mendix.systemwideinterfaces.core.IMendixObject emailMessageMendixObject;
-
- private final com.mendix.systemwideinterfaces.core.IContext context;
-
- /**
- * Internal name of this entity
- */
- public static final java.lang.String entityName = "Email_Connector.EmailMessage";
-
- /**
- * Enum describing members of this entity
- */
- public enum MemberNames
- {
- Subject("Subject"),
- SentDate("SentDate"),
- RetrieveDate("RetrieveDate"),
- From("From"),
- To("To"),
- CC("CC"),
- BCC("BCC"),
- Content("Content"),
- UseOnlyPlainText("UseOnlyPlainText"),
- hasAttachments("hasAttachments"),
- Size("Size"),
- FromDisplayName("FromDisplayName"),
- ReplyTo("ReplyTo"),
- PlainBody("PlainBody"),
- QueuedForSending("QueuedForSending"),
- ResendAttempts("ResendAttempts"),
- LastSendError("LastSendError"),
- LastSendAttemptAt("LastSendAttemptAt"),
- Status("Status"),
- isSigned("isSigned"),
- isEncrypted("isEncrypted"),
- RecipientsToggle("RecipientsToggle"),
- EmailMessage_EmailTemplate("Email_Connector.EmailMessage_EmailTemplate"),
- EmailMessage_EmailAccount("Email_Connector.EmailMessage_EmailAccount");
-
- private java.lang.String metaName;
-
- MemberNames(java.lang.String s)
- {
- metaName = s;
- }
-
- @java.lang.Override
- public java.lang.String toString()
- {
- return metaName;
- }
- }
-
- public EmailMessage(com.mendix.systemwideinterfaces.core.IContext context)
- {
- this(context, com.mendix.core.Core.instantiate(context, "Email_Connector.EmailMessage"));
- }
-
- protected EmailMessage(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject emailMessageMendixObject)
- {
- if (emailMessageMendixObject == null)
- throw new java.lang.IllegalArgumentException("The given object cannot be null.");
- if (!com.mendix.core.Core.isSubClassOf("Email_Connector.EmailMessage", emailMessageMendixObject.getType()))
- throw new java.lang.IllegalArgumentException("The given object is not a Email_Connector.EmailMessage");
-
- this.emailMessageMendixObject = emailMessageMendixObject;
- this.context = context;
- }
-
- /**
- * @deprecated Use 'EmailMessage.load(IContext, IMendixIdentifier)' instead.
- */
- @java.lang.Deprecated
- public static email_connector.proxies.EmailMessage initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- return email_connector.proxies.EmailMessage.load(context, mendixIdentifier);
- }
-
- /**
- * Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
- * The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
- */
- public static email_connector.proxies.EmailMessage initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
- {
- return new email_connector.proxies.EmailMessage(context, mendixObject);
- }
-
- public static email_connector.proxies.EmailMessage load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
- {
- com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
- return email_connector.proxies.EmailMessage.initialize(context, mendixObject);
- }
-
- public static java.util.List load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
- {
- java.util.List result = new java.util.ArrayList