@smart-cloud/wpsuite-core 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var l=(t,e)=>()=>(t&&(e=t(t=0)),e);var h=(t,e)=>{for(var n in e)b(t,n,{get:e[n],enumerable:!0})},H=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of N(e))!V.call(t,i)&&i!==n&&b(t,i,{get:()=>e[i],enumerable:!(r=G(e,i))||r.enumerable});return t};var J=t=>H(b({},"__esModule",{value:!0}),t);function m(t,e){return`wpsuite:${t}:${e}`}function $(t,e=8e3){return()=>new Promise(n=>{if(t.status==="available")return n("available");if(t.status==="error")return n("error");!t.status||t.status;let r=m(t.key,"ready"),i=m(t.key,"error"),s=()=>u("available"),o=()=>u("error"),a,u=p=>{window.removeEventListener(r,s),window.removeEventListener(i,o),a!==void 0&&window.clearTimeout(a),n(p)};window.addEventListener(r,s,{once:!0}),window.addEventListener(i,o,{once:!0}),a=window.setTimeout(()=>u("unavailable"),e)})}function Z(t){return e=>{window.addEventListener(m(t,"ready"),()=>e(),{once:!0})}}function _(t,e){let n=e?.timeoutMs??8e3;return t.availability??=$(t,n),t.onReady??=Z(t.key),t}var x=l(()=>{"use strict"});function d(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";return Uint8Array.from(atob(e),n=>n.charCodeAt(0))}var w,S=l(()=>{"use strict";w=(t,e)=>{let r=Uint8Array.from(atob(t),i=>i.charCodeAt(0)).map((i,s)=>i^e+s&255);return new TextDecoder().decode(r)}});var A,R,k=l(()=>{"use strict";S();A=w("t7e+qZCPj4zb07ObhonFlYaipJyEvMmPpZTJlaTMZHJaaGhrdFRabEAzaw==",226),R=w("tdemn6GUkqqFj4isjZqDnrCKhrG9uJOhiJ/EsrGeX05mYlx3Xk98fTp7WQ==",226)});var U={};h(U,{getConfig:()=>it});function P(t){try{return new URL(t.includes("://")?t:`http://${t}`).hostname.toLowerCase()}catch{return t.replace(/\/+$/,"").toLowerCase()}}function q(t){let e=P(t);return e.startsWith("www.")?e.slice(4):e}function B(t){let e=P(t);if(z.test(e)||F.test(e)||e==="localhost")return!0;let n=(0,L.parse)(e,{allowPrivateDomains:!0});return!!(!n.domain||!n.publicSuffix||j.includes(n.publicSuffix))}function Q(t){let e=P(t);return B(e)||C.test(e)?!0:e.split(".").some(n=>C.test(n))}function tt(t){return B(t)||Q(t)}function et(t,e){return e?q(t)===e:!1}function nt(t,e){return tt(t)?{free:!0,covered:!0}:{free:!1,covered:et(t,e)}}var f,L,T,W,c,v,C,j,z,F,it,K=l(()=>{"use strict";f=require("jose");k();S();D();L=require("tldts"),c=E();c?v=c.siteSettings:v={};C=/\b(dev|test|testing|staging|stage|qa|uat|preview|demo|sandbox|preprod|beta|canary)\b/i,j=["localhost","local","test","invalid","example","lan","internal"],z=/^(127\.)|^(10\.)|^(192\.168\.)|^(172\.(1[6-9]|2\d|3[0-1])\.)/,F=/^(::1$)|(^fc00:)|(^fd)/i;it=async()=>{let t=null;if(v.subscriber){let n=await(0,f.importJWK)({kty:"EC",x:T,y:W,crv:"P-256"},"ES256"),r=new Date().getFullYear(),i=Math.floor((Date.now()-new Date(r,0,1).getTime())/(1e3*60*60*24*7)),s=await fetch(c.uploadUrl+"lic.jws?t="+c.siteSettings.lastUpdate+"&y="+r+"&w="+i).then(o=>o.ok?o.text():null).catch(()=>null);if(s)try{let o=location.hostname.split(":")[0],{payload:a}=await(0,f.jwtVerify)(s,n,{algorithms:["ES256"]}),u=nt(o,a.domain);if(!u.free&&!u.covered)throw new Error("Invalid domain in JWT");let p=a.key.split(":"),O=d(p[0]),X=d(p[1]),y=(await fetch(c.uploadUrl+"config.enc?t="+c.siteSettings.lastUpdate).then(g=>g.ok?g.text():null).catch(()=>null))?.split(":");if(y?.length===2){let g=d(y[0]),I=d(y[1]),M=await crypto.subtle.importKey("raw",O,{name:"AES-GCM"},!1,["decrypt"]),Y=await crypto.subtle.decrypt({name:"AES-GCM",iv:X},M,new Uint8Array([...g,...I]));t=JSON.parse(new TextDecoder().decode(Y)),t.subscriptionType=a.subscriptionType}}catch(o){console.error(o.message)}}return t??null};T=A;W=R});var at={};h(at,{TEXT_DOMAIN:()=>ot,attachDefaultPluginRuntime:()=>_,getConfig:()=>st,getPlugin:()=>rt,getWpSuite:()=>E});module.exports=J(at);function E(){return globalThis.WpSuite}function rt(t){return globalThis.WpSuite?.plugins[t]}var ot,st,D=l(()=>{x();ot="hub-for-wpsuiteio",st=async t=>{let n=await(await Promise.resolve().then(()=>(K(),U))).getConfig();return n&&(n={...n[t],subscriptionType:n.subscriptionType}),n}});D();0&&(module.exports={TEXT_DOMAIN,attachDefaultPluginRuntime,getConfig,getPlugin,getWpSuite});
1
+ "use strict";var b=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var l=(e,t)=>()=>(e&&(t=e(e=0)),t);var x=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of V(t))!F.call(e,i)&&i!==n&&b(e,i,{get:()=>t[i],enumerable:!(r=N(t,i))||r.enumerable});return e};var J=e=>H(b({},"__esModule",{value:!0}),e);function d(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return Uint8Array.from(atob(t),n=>n.charCodeAt(0))}var w,E,f=l(()=>{"use strict";w=(e,t)=>{let r=Uint8Array.from(atob(e),i=>i.charCodeAt(0)).map((i,o)=>i^t+o&255);return new TextDecoder().decode(r)},E=async e=>{let t=globalThis.grecaptcha,n=e?t?.enterprise:void 0,r=n?.ready??t?.ready,i=n?.execute??t?.execute;if(typeof i!="function")return{execute:void 0};try{return typeof r=="function"&&await new Promise(o=>r(()=>o())),{execute:i}}catch{return{execute:void 0}}}});function v(e,t){return`wpsuite:${e}:${t}`}function $(e,t=8e3){return()=>new Promise(n=>{if(e.status==="available")return n("available");if(e.status==="error")return n("error");!e.status||e.status;let r=v(e.key,"ready"),i=v(e.key,"error"),o=()=>c("available"),s=()=>c("error"),a,c=p=>{window.removeEventListener(r,o),window.removeEventListener(i,s),a!==void 0&&window.clearTimeout(a),n(p)};window.addEventListener(r,o,{once:!0}),window.addEventListener(i,s,{once:!0}),a=window.setTimeout(()=>c("unavailable"),t)})}function Z(e){return t=>{window.addEventListener(v(e,"ready"),()=>t(),{once:!0})}}function _(e,t){let n=t?.timeoutMs??8e3;return e.availability??=$(e,n),e.onReady??=Z(e.key),e}var R=l(()=>{"use strict"});var A,k,C=l(()=>{"use strict";f();A=w("///24djH19SDi+vD3tGN3c7q7NTM9PG3nazxrZz0rLqSoKCjvJyCtJjrsw==",170),k=w("/Z/u1+ncyvLd19D01cLL1vjCzvn18KuZsKf8iomml4auqpS/loekpeKjgQ==",170)});var K={};x(K,{getConfig:()=>re});function h(e){try{return new URL(e.includes("://")?e:`http://${e}`).hostname.toLowerCase()}catch{return e.replace(/\/+$/,"").toLowerCase()}}function Q(e){let t=h(e);return t.startsWith("www.")?t.slice(4):t}function U(e){let t=h(e);if(z.test(t)||q.test(t)||t==="localhost")return!0;let n=(0,B.parse)(t,{allowPrivateDomains:!0});return!!(!n.domain||!n.publicSuffix||j.includes(n.publicSuffix))}function ee(e){let t=h(e);return U(t)||T.test(t)?!0:t.split(".").some(n=>T.test(n))}function te(e){return U(e)||ee(e)}function ne(e,t){return t?Q(e)===t:!1}function ie(e,t){return te(e)?{free:!0,covered:!0}:{free:!1,covered:ne(e,t)}}var y,B,W,L,u,S,T,j,z,q,re,D=l(()=>{"use strict";y=require("jose");C();f();O();B=require("tldts"),u=P();u?S=u.siteSettings:S={};T=/\b(dev|test|testing|staging|stage|qa|uat|preview|demo|sandbox|preprod|beta|canary)\b/i,j=["localhost","local","test","invalid","example","lan","internal"],z=/^(127\.)|^(10\.)|^(192\.168\.)|^(172\.(1[6-9]|2\d|3[0-1])\.)/,q=/^(::1$)|(^fc00:)|(^fd)/i;re=async()=>{let e=null;if(S.subscriber){let n=await(0,y.importJWK)({kty:"EC",x:W,y:L,crv:"P-256"},"ES256"),r=new Date().getFullYear(),i=Math.floor((Date.now()-new Date(r,0,1).getTime())/(1e3*60*60*24*7)),o=await fetch(u.uploadUrl+"lic.jws?t="+u.siteSettings.lastUpdate+"&y="+r+"&w="+i).then(s=>s.ok?s.text():null).catch(()=>null);if(o)try{let s=location.hostname.split(":")[0],{payload:a}=await(0,y.jwtVerify)(o,n,{algorithms:["ES256"]}),c=ie(s,a.domain);if(!c.free&&!c.covered)throw new Error("Invalid domain in JWT");let p=a.key.split(":"),X=d(p[0]),G=d(p[1]),m=(await fetch(u.uploadUrl+"config.enc?t="+u.siteSettings.lastUpdate).then(g=>g.ok?g.text():null).catch(()=>null))?.split(":");if(m?.length===2){let g=d(m[0]),I=d(m[1]),M=await crypto.subtle.importKey("raw",X,{name:"AES-GCM"},!1,["decrypt"]),Y=await crypto.subtle.decrypt({name:"AES-GCM",iv:G},M,new Uint8Array([...g,...I]));e=JSON.parse(new TextDecoder().decode(Y)),e.subscriptionType=a.subscriptionType}}catch(s){console.error(s.message)}}return e??null};W=A;L=k});var ce={};x(ce,{TEXT_DOMAIN:()=>se,attachDefaultPluginRuntime:()=>_,getConfig:()=>ae,getPlugin:()=>oe,getRecaptcha:()=>E,getWpSuite:()=>P});module.exports=J(ce);function P(){return globalThis.WpSuite}function oe(e){return globalThis.WpSuite?.plugins[e]}var se,ae,O=l(()=>{f();R();se="hub-for-wpsuiteio",ae=async e=>{let n=await(await Promise.resolve().then(()=>(D(),K))).getConfig();return n&&(n={...n[e],subscriptionType:n.subscriptionType}),n}});O();0&&(module.exports={TEXT_DOMAIN,attachDefaultPluginRuntime,getConfig,getPlugin,getRecaptcha,getWpSuite});
package/dist/index.d.cts CHANGED
@@ -1,3 +1,10 @@
1
+ type RecaptchaFunction = (reCaptchaSiteKey: string, options: {
2
+ action: string;
3
+ }) => Promise<string | undefined>;
4
+ declare const getRecaptcha: (useRecaptchaEnterprise: boolean) => Promise<{
5
+ execute: RecaptchaFunction | undefined;
6
+ }>;
7
+
1
8
  /** Attaches the default runtime functions to a plugin object */
2
9
  declare function attachDefaultPluginRuntime<T extends WpSuitePluginBase>(plugin: T, opts?: {
3
10
  timeoutMs?: number;
@@ -49,4 +56,4 @@ interface SiteSettings {
49
56
  type SubscriptionType = "PROFESSIONAL" | "AGENCY";
50
57
  declare const getConfig: (plugin: string) => Promise<Record<string, unknown> | null>;
51
58
 
52
- export { type PluginAvailability, type PluginStatus, type SiteSettings, type SubscriptionType, TEXT_DOMAIN, type WpSuiteEvents, type WpSuiteGlobal, type WpSuitePluginBase, type WpSuitePluginRegistry, type WpSuiteView, attachDefaultPluginRuntime, getConfig, getPlugin, getWpSuite };
59
+ export { type PluginAvailability, type PluginStatus, type RecaptchaFunction, type SiteSettings, type SubscriptionType, TEXT_DOMAIN, type WpSuiteEvents, type WpSuiteGlobal, type WpSuitePluginBase, type WpSuitePluginRegistry, type WpSuiteView, attachDefaultPluginRuntime, getConfig, getPlugin, getRecaptcha, getWpSuite };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ type RecaptchaFunction = (reCaptchaSiteKey: string, options: {
2
+ action: string;
3
+ }) => Promise<string | undefined>;
4
+ declare const getRecaptcha: (useRecaptchaEnterprise: boolean) => Promise<{
5
+ execute: RecaptchaFunction | undefined;
6
+ }>;
7
+
1
8
  /** Attaches the default runtime functions to a plugin object */
2
9
  declare function attachDefaultPluginRuntime<T extends WpSuitePluginBase>(plugin: T, opts?: {
3
10
  timeoutMs?: number;
@@ -49,4 +56,4 @@ interface SiteSettings {
49
56
  type SubscriptionType = "PROFESSIONAL" | "AGENCY";
50
57
  declare const getConfig: (plugin: string) => Promise<Record<string, unknown> | null>;
51
58
 
52
- export { type PluginAvailability, type PluginStatus, type SiteSettings, type SubscriptionType, TEXT_DOMAIN, type WpSuiteEvents, type WpSuiteGlobal, type WpSuitePluginBase, type WpSuitePluginRegistry, type WpSuiteView, attachDefaultPluginRuntime, getConfig, getPlugin, getWpSuite };
59
+ export { type PluginAvailability, type PluginStatus, type RecaptchaFunction, type SiteSettings, type SubscriptionType, TEXT_DOMAIN, type WpSuiteEvents, type WpSuiteGlobal, type WpSuitePluginBase, type WpSuitePluginRegistry, type WpSuiteView, attachDefaultPluginRuntime, getConfig, getPlugin, getRecaptcha, getWpSuite };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var O=Object.defineProperty;var l=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>{for(var n in e)O(t,n,{get:e[n],enumerable:!0})};function y(t,e){return`wpsuite:${t}:${e}`}function I(t,e=8e3){return()=>new Promise(n=>{if(t.status==="available")return n("available");if(t.status==="error")return n("error");!t.status||t.status;let o=y(t.key,"ready"),r=y(t.key,"error"),s=()=>u("available"),i=()=>u("error"),a,u=p=>{window.removeEventListener(o,s),window.removeEventListener(r,i),a!==void 0&&window.clearTimeout(a),n(p)};window.addEventListener(o,s,{once:!0}),window.addEventListener(r,i,{once:!0}),a=window.setTimeout(()=>u("unavailable"),e)})}function M(t){return e=>{window.addEventListener(y(t,"ready"),()=>e(),{once:!0})}}function Y(t,e){let n=e?.timeoutMs??8e3;return t.availability??=I(t,n),t.onReady??=M(t.key),t}var v=l(()=>{"use strict"});function d(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";return Uint8Array.from(atob(e),n=>n.charCodeAt(0))}var b,m=l(()=>{"use strict";b=(t,e)=>{let o=Uint8Array.from(atob(t),r=>r.charCodeAt(0)).map((r,s)=>r^e+s&255);return new TextDecoder().decode(o)}});var P,E,h=l(()=>{"use strict";m();P=b("t7e+qZCPj4zb07ObhonFlYaipJyEvMmPpZTJlaTMZHJaaGhrdFRabEAzaw==",226),E=b("tdemn6GUkqqFj4isjZqDnrCKhrG9uJOhiJ/EsrGeX05mYlx3Xk98fTp7WQ==",226)});var k={};X(k,{getConfig:()=>Q});import{importJWK as G,jwtVerify as N}from"jose";import{parse as V}from"tldts";function S(t){try{return new URL(t.includes("://")?t:`http://${t}`).hostname.toLowerCase()}catch{return t.replace(/\/+$/,"").toLowerCase()}}function Z(t){let e=S(t);return e.startsWith("www.")?e.slice(4):e}function R(t){let e=S(t);if(J.test(e)||$.test(e)||e==="localhost")return!0;let n=V(e,{allowPrivateDomains:!0});return!!(!n.domain||!n.publicSuffix||H.includes(n.publicSuffix))}function j(t){let e=S(t);return R(e)||_.test(e)?!0:e.split(".").some(n=>_.test(n))}function z(t){return R(t)||j(t)}function F(t,e){return e?Z(t)===e:!1}function q(t,e){return z(t)?{free:!0,covered:!0}:{free:!1,covered:F(t,e)}}var x,A,c,w,_,H,J,$,Q,C=l(()=>{"use strict";h();m();W();c=T();c?w=c.siteSettings:w={};_=/\b(dev|test|testing|staging|stage|qa|uat|preview|demo|sandbox|preprod|beta|canary)\b/i,H=["localhost","local","test","invalid","example","lan","internal"],J=/^(127\.)|^(10\.)|^(192\.168\.)|^(172\.(1[6-9]|2\d|3[0-1])\.)/,$=/^(::1$)|(^fc00:)|(^fd)/i;Q=async()=>{let t=null;if(w.subscriber){let n=await G({kty:"EC",x,y:A,crv:"P-256"},"ES256"),o=new Date().getFullYear(),r=Math.floor((Date.now()-new Date(o,0,1).getTime())/(1e3*60*60*24*7)),s=await fetch(c.uploadUrl+"lic.jws?t="+c.siteSettings.lastUpdate+"&y="+o+"&w="+r).then(i=>i.ok?i.text():null).catch(()=>null);if(s)try{let i=location.hostname.split(":")[0],{payload:a}=await N(s,n,{algorithms:["ES256"]}),u=q(i,a.domain);if(!u.free&&!u.covered)throw new Error("Invalid domain in JWT");let p=a.key.split(":"),L=d(p[0]),B=d(p[1]),f=(await fetch(c.uploadUrl+"config.enc?t="+c.siteSettings.lastUpdate).then(g=>g.ok?g.text():null).catch(()=>null))?.split(":");if(f?.length===2){let g=d(f[0]),U=d(f[1]),K=await crypto.subtle.importKey("raw",L,{name:"AES-GCM"},!1,["decrypt"]),D=await crypto.subtle.decrypt({name:"AES-GCM",iv:B},K,new Uint8Array([...g,...U]));t=JSON.parse(new TextDecoder().decode(D)),t.subscriptionType=a.subscriptionType}}catch(i){console.error(i.message)}}return t??null};x=P;A=E});function T(){return globalThis.WpSuite}function dt(t){return globalThis.WpSuite?.plugins[t]}var pt,gt,W=l(()=>{v();pt="hub-for-wpsuiteio",gt=async t=>{let n=await(await Promise.resolve().then(()=>(C(),k))).getConfig();return n&&(n={...n[t],subscriptionType:n.subscriptionType}),n}});W();export{pt as TEXT_DOMAIN,Y as attachDefaultPluginRuntime,gt as getConfig,dt as getPlugin,T as getWpSuite};
1
+ var O=Object.defineProperty;var l=(e,t)=>()=>(e&&(t=e(e=0)),t);var X=(e,t)=>{for(var n in t)O(e,n,{get:t[n],enumerable:!0})};function d(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return Uint8Array.from(atob(t),n=>n.charCodeAt(0))}var m,G,f=l(()=>{"use strict";m=(e,t)=>{let r=Uint8Array.from(atob(e),i=>i.charCodeAt(0)).map((i,o)=>i^t+o&255);return new TextDecoder().decode(r)},G=async e=>{let t=globalThis.grecaptcha,n=e?t?.enterprise:void 0,r=n?.ready??t?.ready,i=n?.execute??t?.execute;if(typeof i!="function")return{execute:void 0};try{return typeof r=="function"&&await new Promise(o=>r(()=>o())),{execute:i}}catch{return{execute:void 0}}}});function b(e,t){return`wpsuite:${e}:${t}`}function I(e,t=8e3){return()=>new Promise(n=>{if(e.status==="available")return n("available");if(e.status==="error")return n("error");!e.status||e.status;let r=b(e.key,"ready"),i=b(e.key,"error"),o=()=>c("available"),s=()=>c("error"),a,c=p=>{window.removeEventListener(r,o),window.removeEventListener(i,s),a!==void 0&&window.clearTimeout(a),n(p)};window.addEventListener(r,o,{once:!0}),window.addEventListener(i,s,{once:!0}),a=window.setTimeout(()=>c("unavailable"),t)})}function M(e){return t=>{window.addEventListener(b(e,"ready"),()=>t(),{once:!0})}}function Y(e,t){let n=t?.timeoutMs??8e3;return e.availability??=I(e,n),e.onReady??=M(e.key),e}var S=l(()=>{"use strict"});var h,P,x=l(()=>{"use strict";f();h=m("///24djH19SDi+vD3tGN3c7q7NTM9PG3nazxrZz0rLqSoKCjvJyCtJjrsw==",170),P=m("/Z/u1+ncyvLd19D01cLL1vjCzvn18KuZsKf8iomml4auqpS/loekpeKjgQ==",170)});var k={};X(k,{getConfig:()=>ee});import{importJWK as N,jwtVerify as V}from"jose";import{parse as F}from"tldts";function v(e){try{return new URL(e.includes("://")?e:`http://${e}`).hostname.toLowerCase()}catch{return e.replace(/\/+$/,"").toLowerCase()}}function Z(e){let t=v(e);return t.startsWith("www.")?t.slice(4):t}function A(e){let t=v(e);if(J.test(t)||$.test(t)||t==="localhost")return!0;let n=F(t,{allowPrivateDomains:!0});return!!(!n.domain||!n.publicSuffix||H.includes(n.publicSuffix))}function j(e){let t=v(e);return A(t)||E.test(t)?!0:t.split(".").some(n=>E.test(n))}function z(e){return A(e)||j(e)}function q(e,t){return t?Z(e)===t:!1}function Q(e,t){return z(e)?{free:!0,covered:!0}:{free:!1,covered:q(e,t)}}var _,R,u,w,E,H,J,$,ee,C=l(()=>{"use strict";x();f();W();u=T();u?w=u.siteSettings:w={};E=/\b(dev|test|testing|staging|stage|qa|uat|preview|demo|sandbox|preprod|beta|canary)\b/i,H=["localhost","local","test","invalid","example","lan","internal"],J=/^(127\.)|^(10\.)|^(192\.168\.)|^(172\.(1[6-9]|2\d|3[0-1])\.)/,$=/^(::1$)|(^fc00:)|(^fd)/i;ee=async()=>{let e=null;if(w.subscriber){let n=await N({kty:"EC",x:_,y:R,crv:"P-256"},"ES256"),r=new Date().getFullYear(),i=Math.floor((Date.now()-new Date(r,0,1).getTime())/(1e3*60*60*24*7)),o=await fetch(u.uploadUrl+"lic.jws?t="+u.siteSettings.lastUpdate+"&y="+r+"&w="+i).then(s=>s.ok?s.text():null).catch(()=>null);if(o)try{let s=location.hostname.split(":")[0],{payload:a}=await V(o,n,{algorithms:["ES256"]}),c=Q(s,a.domain);if(!c.free&&!c.covered)throw new Error("Invalid domain in JWT");let p=a.key.split(":"),L=d(p[0]),B=d(p[1]),y=(await fetch(u.uploadUrl+"config.enc?t="+u.siteSettings.lastUpdate).then(g=>g.ok?g.text():null).catch(()=>null))?.split(":");if(y?.length===2){let g=d(y[0]),U=d(y[1]),K=await crypto.subtle.importKey("raw",L,{name:"AES-GCM"},!1,["decrypt"]),D=await crypto.subtle.decrypt({name:"AES-GCM",iv:B},K,new Uint8Array([...g,...U]));e=JSON.parse(new TextDecoder().decode(D)),e.subscriptionType=a.subscriptionType}}catch(s){console.error(s.message)}}return e??null};_=h;R=P});function T(){return globalThis.WpSuite}function pe(e){return globalThis.WpSuite?.plugins[e]}var ge,fe,W=l(()=>{f();S();ge="hub-for-wpsuiteio",fe=async e=>{let n=await(await Promise.resolve().then(()=>(C(),k))).getConfig();return n&&(n={...n[e],subscriptionType:n.subscriptionType}),n}});W();export{ge as TEXT_DOMAIN,Y as attachDefaultPluginRuntime,fe as getConfig,pe as getPlugin,G as getRecaptcha,T as getWpSuite};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/wpsuite-core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "WP Suite Core package",
5
5
  "author": "Smart Cloud Solutions Inc.",
6
6
  "license": "MIT",