Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gaoding/editor-sdk

Package Overview
Dependencies
Maintainers
15
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gaoding/editor-sdk - npm Package Compare versions

Comparing version 2.2.4 to 2.2.5

2

dist/editor-sdk.umd.js

@@ -1,2 +0,2 @@

(function(T,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(T=typeof globalThis!="undefined"?globalThis:T||self,b(T.gaoding={}))})(this,function(T){"use strict";var b;(function(t){t.Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack"})(b||(b={}));var N;(function(t){t.Fulfilled="fulfilled",t.Rejected="rejected"})(N||(N={}));var M;(function(t){t.ConnectionDestroyed="ConnectionDestroyed",t.ConnectionTimeout="ConnectionTimeout",t.NotInIframe="NotInIframe",t.NoIframeSrc="NoIframeSrc"})(M||(M={}));var X;(function(t){t.DataCloneError="DataCloneError"})(X||(X={}));var A;(function(t){t.Message="message"})(A||(A={}));var je=()=>{const t=[];let e=!1;return{destroy(r){e=!0,t.forEach(n=>{n(r)})},onDestroy(r){e?r():t.push(r)}}},ze=t=>(...e)=>{t&&console.log("[Penpal]",...e)};const qe={"http:":"80","https:":"443"},Ke=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,He=["file:","data:"];var Ve=t=>{if(t&&He.find(u=>t.startsWith(u)))return"null";const e=document.location,r=Ke.exec(t);let n,a,s;r?(n=r[1]?r[1]:e.protocol,a=r[2],s=r[4]):(n=e.protocol,a=e.hostname,s=e.port);const o=s&&s!==qe[n]?`:${s}`:"";return`${n}//${a}${o}`};const he=({name:t,message:e,stack:r})=>({name:t,message:e,stack:r}),Je=t=>{const e=new Error;return Object.keys(t).forEach(r=>e[r]=t[r]),e};var Ge=(t,e,r)=>{const{localName:n,local:a,remote:s,originForSending:o,originForReceiving:u}=t;let i=!1;const d=y=>{if(y.source!==s||y.data.penpal!==b.Call)return;if(y.origin!==u){r(`${n} received message from origin ${y.origin} which did not match expected origin ${u}`);return}const h=y.data,{methodName:l,args:f,id:p}=h;r(`${n}: Received ${l}() call`);const m=c=>v=>{if(r(`${n}: Sending ${l}() reply`),i){r(`${n}: Unable to send ${l}() reply due to destroyed connection`);return}const g={penpal:b.Reply,id:p,resolution:c,returnValue:v};c===N.Rejected&&v instanceof Error&&(g.returnValue=he(v),g.returnValueIsError=!0);try{s.postMessage(g,o)}catch(k){if(k.name===X.DataCloneError){const $={penpal:b.Reply,id:p,resolution:N.Rejected,returnValue:he(k),returnValueIsError:!0};s.postMessage($,o)}throw k}};new Promise(c=>c(e[l].apply(e,f))).then(m(N.Fulfilled),m(N.Rejected))};return a.addEventListener(A.Message,d),()=>{i=!0,a.removeEventListener(A.Message,d)}};let We=0;var Xe=()=>++We,Ye=(t,e,r,n,a)=>{const{localName:s,local:o,remote:u,originForSending:i,originForReceiving:d}=e;let y=!1;a(`${s}: Connecting call sender`);const h=l=>(...f)=>{a(`${s}: Sending ${l}() call`);let p;try{u.closed&&(p=!0)}catch{p=!0}if(p&&n(),y){const m=new Error(`Unable to send ${l}() call due to destroyed connection`);throw m.code=M.ConnectionDestroyed,m}return new Promise((m,c)=>{const v=Xe(),g=$=>{if($.source!==u||$.data.penpal!==b.Reply||$.data.id!==v)return;if($.origin!==d){a(`${s} received message from origin ${$.origin} which did not match expected origin ${d}`);return}const de=$.data;a(`${s}: Received ${l}() reply`),o.removeEventListener(A.Message,g);let fe=de.returnValue;de.returnValueIsError&&(fe=Je(fe)),(de.resolution===N.Fulfilled?m:c)(fe)};o.addEventListener(A.Message,g);const k={penpal:b.Call,id:v,methodName:l,args:f};u.postMessage(k,i)})};return r.reduce((l,f)=>(l[f]=h(f),l),t),()=>{y=!0}},Ze=(t,e,r,n,a)=>{const{destroy:s,onDestroy:o}=n;let u,i;const d={};return y=>{if(y.origin!==e){a(`Parent: Handshake - Received ACK message from origin ${y.origin} which did not match expected origin ${e}`);return}a("Parent: Handshake - Received ACK");const h={localName:"Parent",local:window,remote:y.source,originForSending:r,originForReceiving:e};u&&u(),u=Ge(h,t,a),o(u),i&&i.forEach(f=>{delete d[f]}),i=y.data.methodNames;const l=Ye(d,h,i,s,a);return o(l),d}},Qe=(t,e,r,n)=>a=>{if(a.origin!==r){t(`Parent: Handshake - Received SYN message from origin ${a.origin} which did not match expected origin ${r}`);return}t("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:b.SynAck,methodNames:Object.keys(e)};a.source.postMessage(s,n)};const et=6e4;var tt=(t,e)=>{const{destroy:r,onDestroy:n}=e,a=setInterval(()=>{t.isConnected||(clearInterval(a),r())},et);n(()=>{clearInterval(a)})},rt=(t,e)=>{let r;return t!==void 0&&(r=window.setTimeout(()=>{const n=new Error(`Connection timed out after ${t}ms`);n.code=M.ConnectionTimeout,e(n)},t)),()=>{clearTimeout(r)}},nt=t=>{if(!t.src&&!t.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=M.NoIframeSrc,e}},at=t=>{let{iframe:e,methods:r={},childOrigin:n,timeout:a,debug:s=!1}=t;const o=ze(s),u=je(),{onDestroy:i,destroy:d}=u;n||(nt(e),n=Ve(e.src));const y=n==="null"?"*":n,h=Qe(o,r,n,y),l=Ze(r,n,y,u,o);return{promise:new Promise((p,m)=>{const c=rt(a,d),v=g=>{if(!(g.source!==e.contentWindow||!g.data)){if(g.data.penpal===b.Syn){h(g);return}if(g.data.penpal===b.Ack){const k=l(g);k&&(c(),p(k));return}}};window.addEventListener(A.Message,v),o("Parent: Awaiting handshake"),tt(e,u),i(g=>{window.removeEventListener(A.Message,v),g||(g=new Error("Connection destroyed"),g.code=M.ConnectionDestroyed),m(g)})}),destroy(){d()}}};const it="2.2.4",E={TEMPLATE_EDITOR_URL:"https://open.gaoding.com/design",MOBILE_TEMPLATE_EDITOR_URL:"https://open.gaoding.com/h5/design",KOUTU_EDITOR_URL:"https://open.gaoding.com/clip",IMAGE_EDITOR_URL:"https://open.gaoding.com/design/image",OPEN_PLATFORM_ORIGIN:"https://open.gaoding.com",get VERSION(){return it}};var Y=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function pe(t,e){const r=document.createElement("div");r.style.cssText=`
(function(T,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(T=typeof globalThis!="undefined"?globalThis:T||self,b(T.gaoding={}))})(this,function(T){"use strict";var b;(function(t){t.Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack"})(b||(b={}));var N;(function(t){t.Fulfilled="fulfilled",t.Rejected="rejected"})(N||(N={}));var M;(function(t){t.ConnectionDestroyed="ConnectionDestroyed",t.ConnectionTimeout="ConnectionTimeout",t.NotInIframe="NotInIframe",t.NoIframeSrc="NoIframeSrc"})(M||(M={}));var X;(function(t){t.DataCloneError="DataCloneError"})(X||(X={}));var A;(function(t){t.Message="message"})(A||(A={}));var je=()=>{const t=[];let e=!1;return{destroy(r){e=!0,t.forEach(n=>{n(r)})},onDestroy(r){e?r():t.push(r)}}},ze=t=>(...e)=>{t&&console.log("[Penpal]",...e)};const qe={"http:":"80","https:":"443"},Ke=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,He=["file:","data:"];var Ve=t=>{if(t&&He.find(u=>t.startsWith(u)))return"null";const e=document.location,r=Ke.exec(t);let n,a,s;r?(n=r[1]?r[1]:e.protocol,a=r[2],s=r[4]):(n=e.protocol,a=e.hostname,s=e.port);const o=s&&s!==qe[n]?`:${s}`:"";return`${n}//${a}${o}`};const he=({name:t,message:e,stack:r})=>({name:t,message:e,stack:r}),Je=t=>{const e=new Error;return Object.keys(t).forEach(r=>e[r]=t[r]),e};var Ge=(t,e,r)=>{const{localName:n,local:a,remote:s,originForSending:o,originForReceiving:u}=t;let i=!1;const d=y=>{if(y.source!==s||y.data.penpal!==b.Call)return;if(y.origin!==u){r(`${n} received message from origin ${y.origin} which did not match expected origin ${u}`);return}const h=y.data,{methodName:l,args:f,id:p}=h;r(`${n}: Received ${l}() call`);const m=c=>v=>{if(r(`${n}: Sending ${l}() reply`),i){r(`${n}: Unable to send ${l}() reply due to destroyed connection`);return}const g={penpal:b.Reply,id:p,resolution:c,returnValue:v};c===N.Rejected&&v instanceof Error&&(g.returnValue=he(v),g.returnValueIsError=!0);try{s.postMessage(g,o)}catch(k){if(k.name===X.DataCloneError){const $={penpal:b.Reply,id:p,resolution:N.Rejected,returnValue:he(k),returnValueIsError:!0};s.postMessage($,o)}throw k}};new Promise(c=>c(e[l].apply(e,f))).then(m(N.Fulfilled),m(N.Rejected))};return a.addEventListener(A.Message,d),()=>{i=!0,a.removeEventListener(A.Message,d)}};let We=0;var Xe=()=>++We,Ye=(t,e,r,n,a)=>{const{localName:s,local:o,remote:u,originForSending:i,originForReceiving:d}=e;let y=!1;a(`${s}: Connecting call sender`);const h=l=>(...f)=>{a(`${s}: Sending ${l}() call`);let p;try{u.closed&&(p=!0)}catch{p=!0}if(p&&n(),y){const m=new Error(`Unable to send ${l}() call due to destroyed connection`);throw m.code=M.ConnectionDestroyed,m}return new Promise((m,c)=>{const v=Xe(),g=$=>{if($.source!==u||$.data.penpal!==b.Reply||$.data.id!==v)return;if($.origin!==d){a(`${s} received message from origin ${$.origin} which did not match expected origin ${d}`);return}const de=$.data;a(`${s}: Received ${l}() reply`),o.removeEventListener(A.Message,g);let fe=de.returnValue;de.returnValueIsError&&(fe=Je(fe)),(de.resolution===N.Fulfilled?m:c)(fe)};o.addEventListener(A.Message,g);const k={penpal:b.Call,id:v,methodName:l,args:f};u.postMessage(k,i)})};return r.reduce((l,f)=>(l[f]=h(f),l),t),()=>{y=!0}},Ze=(t,e,r,n,a)=>{const{destroy:s,onDestroy:o}=n;let u,i;const d={};return y=>{if(y.origin!==e){a(`Parent: Handshake - Received ACK message from origin ${y.origin} which did not match expected origin ${e}`);return}a("Parent: Handshake - Received ACK");const h={localName:"Parent",local:window,remote:y.source,originForSending:r,originForReceiving:e};u&&u(),u=Ge(h,t,a),o(u),i&&i.forEach(f=>{delete d[f]}),i=y.data.methodNames;const l=Ye(d,h,i,s,a);return o(l),d}},Qe=(t,e,r,n)=>a=>{if(a.origin!==r){t(`Parent: Handshake - Received SYN message from origin ${a.origin} which did not match expected origin ${r}`);return}t("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:b.SynAck,methodNames:Object.keys(e)};a.source.postMessage(s,n)};const et=6e4;var tt=(t,e)=>{const{destroy:r,onDestroy:n}=e,a=setInterval(()=>{t.isConnected||(clearInterval(a),r())},et);n(()=>{clearInterval(a)})},rt=(t,e)=>{let r;return t!==void 0&&(r=window.setTimeout(()=>{const n=new Error(`Connection timed out after ${t}ms`);n.code=M.ConnectionTimeout,e(n)},t)),()=>{clearTimeout(r)}},nt=t=>{if(!t.src&&!t.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=M.NoIframeSrc,e}},at=t=>{let{iframe:e,methods:r={},childOrigin:n,timeout:a,debug:s=!1}=t;const o=ze(s),u=je(),{onDestroy:i,destroy:d}=u;n||(nt(e),n=Ve(e.src));const y=n==="null"?"*":n,h=Qe(o,r,n,y),l=Ze(r,n,y,u,o);return{promise:new Promise((p,m)=>{const c=rt(a,d),v=g=>{if(!(g.source!==e.contentWindow||!g.data)){if(g.data.penpal===b.Syn){h(g);return}if(g.data.penpal===b.Ack){const k=l(g);k&&(c(),p(k));return}}};window.addEventListener(A.Message,v),o("Parent: Awaiting handshake"),tt(e,u),i(g=>{window.removeEventListener(A.Message,v),g||(g=new Error("Connection destroyed"),g.code=M.ConnectionDestroyed),m(g)})}),destroy(){d()}}};const it="2.2.5",E={TEMPLATE_EDITOR_URL:"https://open.gaoding.com/design",MOBILE_TEMPLATE_EDITOR_URL:"https://open.gaoding.com/h5/design",KOUTU_EDITOR_URL:"https://open.gaoding.com/clip",IMAGE_EDITOR_URL:"https://open.gaoding.com/design/image",OPEN_PLATFORM_ORIGIN:"https://open.gaoding.com",get VERSION(){return it}};var Y=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function pe(t,e){const r=document.createElement("div");r.style.cssText=`
position: relative;

@@ -3,0 +3,0 @@ width: calc(100vw - 100px);

{
"name": "@gaoding/editor-sdk",
"version": "2.2.4",
"version": "2.2.5",
"description": "稿定编辑器对外 SDK",

@@ -5,0 +5,0 @@ "main": "dist/editor-sdk.umd.js",

@@ -35,2 +35,4 @@ interface Config {

type: string;
indexes?: number[];
sourceIndexes?: number[];
}) => void) => void;

@@ -37,0 +39,0 @@ onClose: (fn: () => any) => void;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc