PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.93
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.93
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / assets / _commonjsHelpers.js

_commonjsHelpers.js in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.93, at assets/_commonjsHelpers.js

2 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function d(e,s=""){let o={};return Object.keys(e).forEach(l=>{typeof e[l]=="object"?o=Object.assign(o,d(e[l],`${s}[${l}]`)):o[`${s}[${l}]`]=e[l]}),o}const a=function(e,s,o={}){const l=`${window.fluentComAdmin.rest.url}/${s}`,i={"X-WP-Nonce":window.fluentComAdmin.rest.nonce};return["PUT","PATCH","DELETE"].indexOf(e.toUpperCase())!==-1&&(i["X-HTTP-Method-Override"]=e,e="POST"),o.query_timestamp=Date.now(),new Promise((c,r)=>{const t=new XMLHttpRequest;let f=l;if(e.toUpperCase()==="GET"){let n={};Object.keys(o).forEach(u=>{o[u]===null||o[u]===!1?delete o[u]:typeof o[u]=="object"?n=Object.assign(n,d(o[u],u)):n[u]=o[u]});let p=new URLSearchParams(n).toString();f.indexOf("?")!==-1?f+="&"+p:f+="?"+p}t.open(e,f,!0),Object.keys(i).forEach(n=>{t.setRequestHeader(n,i[n])}),t.onload=function(){if(this.status>=200&&this.status<300)c(JSON.parse(t.responseText));else{let n;try{n=JSON.parse(t.responseText)}catch{n=null}n?(typeof n=="object"&&(n.xhr_status=t.status),r(n)):(window.fluentFrameworkApp.$notify({message:'Unexpected error from server. Please check browser console. <button class="el-button el-button--small el-button--danger">Click to view details.</button>',type:"error",dangerouslyUseHTMLString:!0,customClass:"fc_bottom-right",position:"bottom-right",onClick:()=>{window.fluentFrameworkApp.$messageBox(t.responseText)},duration:1e4}),console.info("Your server firewall blocked the request or it's a plugin conflict. Please check the detailed error."),console.log({status:t.status,statusText:t.statusText,responseText:t.responseText}))}},t.onerror=function(){console.info("Your server firewall blocked the request or it's a plugin conflict. Please check the detailed error."),console.log({status:t.status,statusText:t.statusText,responseText:t.responseText}),r({status:t.status,statusText:t.statusText})},e.toUpperCase()==="GET"?t.send():(t.setRequestHeader("Content-Type","application/json;charset=UTF-8"),t.send(JSON.stringify(o)))})},T={get(e,s={}){return a("GET",e,s)},post(e,s={}){return a("POST",e,s)},delete(e,s={}){return a("DELETE",e,s)},put(e,s={}){return a("PUT",e,s)},patch(e,s={}){return a("PATCH",e,s)},uploadFile(e,s={}){const o=`${window.fluentComAdmin.rest.url}/${e}`,l={"X-WP-Nonce":window.fluentComAdmin.rest.nonce};return new Promise((i,c)=>{const r=new XMLHttpRequest;r.open("POST",o,!0),Object.keys(l).forEach(t=>{r.setRequestHeader(t,l[t])}),r.onload=function(){this.status>=200&&this.status<300?i(JSON.parse(r.responseText)):c(JSON.parse(r.responseText))},r.onerror=function(){c({status:r.status,statusText:r.statusText})},r.send(s)})}};var w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}export{T as R,w as c,h as g};
2