Socket
Socket
Sign inDemoInstall

@cocreate/instagram

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/instagram - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.0.5](https://github.com/CoCreate-app/CoCreate-instagram/compare/v1.0.4...v1.0.5) (2021-06-25)
### Bug Fixes
* latest version numbers applied to all cocreate packages ([695804d](https://github.com/CoCreate-app/CoCreate-instagram/commit/695804dec5d490a55a32f910621e0e11552d7ae5))
## [1.0.4](https://github.com/CoCreate-app/CoCreate-instagram/compare/v1.0.3...v1.0.4) (2021-06-24)

@@ -2,0 +9,0 @@

2

dist/CoCreate-instagram.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CoCreate=t():(e.CoCreate=e.CoCreate||{},e.CoCreate.instagram=t())}(this,(function(){return(()=>{var e={75:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var o=n(585),i=n.n(o);const r={attribute:"data-actions",actions:{},selectedStage:[],stageIndex:0,selectedElement:null,completedEventName:"completedEvent",__init:function(){this.actionButtonEvent()},actionButtonEvent:function(){const e=this;document.addEventListener("click",(function(t){let n=t.target;if(n.getAttribute("data-actions")||(n=t.target.closest("[data-actions]")),!n)return;t.preventDefault();let o=(n.getAttribute(e.attribute)||"").replace(/\s/g,"").split(",");0!=o.length&&(e.stageIndex=0,e.selectedStage=o,e.selectedElement=n,e.__runActionFunc())}))},init:function({action:e,callback:t,endEvent:n}){this.registerEvent(e,t,null,n)},registerEvent:function(e,t,n,o){if(this.actions[e])return;this.actions[e]={key:e,runFunc:t,instance:n||window,endEvent:o};for(let t in this.actions)if(t!=e&&this.actions[t].endEvent===o)return;const i=this;document.addEventListener(o,(function(e){i.__nextAction(o,e.detail)}))},__runActionFunc:function(e){if(this.stageIndex>=this.selectedStage.length)return void(this.stageIndex==this.selectedStage.length&&this.__runAtag(this.selectedElement));const t=this.selectedStage[this.stageIndex],n=this.actions[t];if(n)n.runFunc?n.runFunc.call(null,this.selectedElement,e):this.__nextAction(n.endEvent,{});else{"next"===this.__runSpecialAction(t,e)&&this.__moveNextAction()}},__nextAction:function(e,t){const n=this.selectedStage[this.stageIndex];n&&e===this.actions[n].endEvent&&this.__moveNextAction(t)},__runAtag:function(e){e.querySelector("a")},__runSpecialAction:function(e,t){let n=/(\w+)\{([a-zA-Z0-9_ \-#$.]+)\}/gm.exec(e);if(!n||n.length<3)return"next";let o=n[1],i=n[2].trim();if(!i)return"next";const r=this;switch(o){case"event":document.addEventListener(i,(e=>{r.__moveNextAction(e)}),{once:!0});break;case"timeout":parseInt(i)>0&&setTimeout((function(){r.__moveNextAction(t)}),parseInt(i));break;case"action":let e=document.querySelector(i);e&&e.click();break;default:return"next"}},__moveNextAction:function(e){this.stageIndex++,this.__runActionFunc(e)}};r.__init();const s=r,a={__getValueFromObject:function(e,t){try{if(void 0===e||!t)return!1;let n=e,o=t.split(".");for(let e=0;e<o.length;e++)if(n=n[o[e]],!n)return!1;return n}catch(e){return!1}},__getValue:function(e,t){let n=/{{\s*([\w\W]+)\s*}}/g.exec(t);return!!n&&this.__getValueFromObject(e,n[1].trim())},__createObject:function(e,t){try{if(!t)return e;let o=t.split("."),i=e;for(var n=o.length-1;n>=0;n--)i={[o[n]]:i};return i}catch(e){return!1}},__replaceValue:function(e,t){let n=!1,o=this,i=null,r=t.match(/{{([A-Za-z0-9_.,\- ]*)}}/g);return r&&(r.forEach((i=>{let r=o.__getValue(e,i);r&&"object"!=typeof r&&(n=!0,t=t.replace(i,r))})),n&&(i=t)),i},setArray:function(e,t){const n=e.getAttribute("data-render_array")||"data",o=e.getAttribute("data-render_key")||n,i=this,r=this.__getValueFromObject(t,n);n&&Array.isArray(r)&&r.forEach(((t,r)=>{let s=e.cloneNode(!0);s.classList.remove("template"),s.classList.add("clone_"+n),"object"!=typeof t?t={"--":t}:t.index=r;let a=i.__createObject(t,o);i.setValue([s],a),e.insertAdjacentHTML("beforebegin",s.outerHTML)}))},setValue:function(e,t,n,o){if(!t)return;const i=this;Array.from(e).forEach((e=>{let o=e.getAttribute("data-pass_id");if(!n||o==n){if(Array.from(e.attributes).forEach((n=>{let o=n.name.toLowerCase(),r=n.value;if(r=i.__replaceValue(t,r),r){if("value"==o){switch(e.tagName.toLowerCase()){case"input":e.setAttribute(o,r);break;case"textarea":e.setAttribute(o,r),e.textContent=r;break;default:0===e.children.length&&(e.innerHTML=r)}}e.setAttribute(o,r)}})),0==e.children.length&&e.textContent){let n=e.textContent;n=i.__replaceValue(t,n),n&&(e.textContent=n)}e.children.length>0&&(i.setValue(e.children,t),e.classList.contains("template")&&i.setArray(e,t))}}))},data:function({selector:e,data:t,elements:n,passTo:o}){e?this.render(e,t):n&&this.setValue(n,t,o)},render:function(e,t){let n=document.querySelector(e);n&&(Array.isArray(t)?(n.setAttribute("data-render_array","test"),this.setValue([n],{test:t})):this.setValue(n.children,t))}};let c=new(i())("api");const l={modules:{},init:function({name:e,module:t}){this.register(e,t)},register:function(e,t){const n=this;void 0===this.modules[e]&&(this.modules[e]=t,c.listen(e,(t=>{n.__responseProcess(e,t)})),Array.isArray(t.actions)&&t.actions.forEach((e=>{"function"!=typeof t[`action_${e}`]&&(t[`action_${e}`]=function(o){n.__commonAction(t.id,e,o)}),s.init({action:e,endEvent:e,callback:n=>{t[`action_${e}`](n)}})})))},__responseProcess:function(e,t){const{type:n,response:o}=t,i=this.modules[e];n&&o&&i&&("function"==typeof i[`render_${n}`]&&i[`render_${n}`](o),this.render(n,o),document.dispatchEvent(new CustomEvent(n,{detail:{data:o}})))},__commonAction:function(e,t,n){const o=n.closest("form")||document;let i=l.getFormData(e,t,o);l.send(e,t,i)},getFormData:function(e,t,n){const o=`data-${e}`,i=this,r=n.querySelectorAll(`[${o}^="${t}."]`);let s={};r.forEach((n=>{let r=n.getAttribute(o),a=n.getAttribute(o+"_array"),c=i.__getElValue(n);if(r){if(t){let e=new RegExp(`^${t}.`,"i");if(!e.test(r))return;r=r.replace(e,"")}a?(s[r]||(s[r]=[]),s[r].push(i.getFormData(e,a,n))):null!=c&&(s[r]=c)}}));let a=Object.keys(s),c={};return a.forEach((e=>{if(e.split(".").length>1){let t=i.__createObject(s[e],e);delete s[e],c=i.__mergeObject(c,t)}else c[e]=s[e]})),c},__getElValue:function(e){let t=null;if(void 0!==e.value)switch(e.type.toLocaleLowerCase()){case"checkbox":e.checked&&(t=e.value);break;default:t=e.value}else t=e.getAttribute("value"),t||(t=e.innerHTML);return t},__mergeObject:function(e,t){e=e||{};for(let n of Object.keys(t))t[n]instanceof Object&&Object.assign(t[n],this.__mergeObject(e[n],t[n]));return Object.assign(e||{},t),e},__createObject:function(e,t){if(!t)return e;let n=t.split("."),o=e;for(var i=n.length-1;i>=0;i--)o={[n[i]]:o};return o},send:function(e,t,n){let o=this.getCommonParamsExtend(n||{});o={...o,data:n},c.send(e,{type:t,data:o})},render:function(e,t){a.data({selector:`[data-template_id="${e}"]`,data:t})},createApiSocket:function(e,t){t?(c.create({namespace:t,room:null,host:e}),c.setGlobalScope(t)):c.create({namespace:null,room:null,host:e})},getCommonParamsExtend:function(e){return{apiKey:e.apiKey||config.apiKey,securityKey:e.securityKey||config.securityKey,organization_id:e.organization_id||config.organization_Id}}};l.createApiSocket(window.config.host?window.config.host:"server.cocreate.app",window.config.organization_Id);const u=l},946:function(e,t,n){var o,i;"undefined"!=typeof self&&self,o=[n(75)],void 0===(i=function(e){return e}.apply(t,o))||(e.exports=i)},446:function(e,t){var n;"undefined"!=typeof self&&self,void 0===(n=function(){return function(e){function t(){let t={};return e&&e.config&&(t=e.config),{apiKey:t.apiKey,securityKey:t.securityKey,organization_id:t.organization_Id}}function n(t){let n={};return e&&e.config&&(n=e.config),{apiKey:t.apiKey||n.apiKey,securityKey:t.securityKey||n.securityKey,organization_id:t.organization_id||n.organization_Id}}function o(t,n){let o={};e&&e.config&&(o=e.config);let i=t||o.organization_Id,r=n||"";return r?`${i}/${r}`:i}function i(e=36){let t=(new Date).getTime(),n=0,o="uxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";if(e<=o.length)o=o.substr(0,e);else{let t=e-o.length,n="-xxxyyxxx",i=Math.floor(t/n.length);for(let e=0;e<i;e++)o+=n;i=t-i*n.length,o+=n.substr(0,i)}return o.replace(/[xy]/g,(function(e){var o=16*Math.random();return t>0?(o=(t+o)%16|0,t=Math.floor(t/16)):(o=(n+o)%16|0,n=Math.floor(n/16)),("x"==e?o:7&o|8).toString(16)}))}return{getCommonParams:t,getCommonParamsExtend:n,generateSocketClient:o,GenerateUUID:i}}(window)}.apply(t,[]))||(e.exports=n)},585:function(e,t,n){var o,i;"undefined"!=typeof self&&self,o=[n(446)],void 0===(i=function(e){return function(e,t,n,o){class i{constructor(e="crud"){this.prefix=e||"crud",this.sockets=new Map,this.listeners=new Map,this.messageQueue=new Map,this.saveFileName="",this.globalScope=""}setGlobalScope(e){this.globalScope=`${this.prefix}/${e}`}getGlobalScope(){return this.globalScope}create(e){const{namespace:i,room:r}=e,s=this.getKey(i,r);let a,c=this;if(i&&this.setGlobalScope(i),this.sockets.get(s))return void(a=this.sockets.get(s));let l=t.location.protocol;"about:"===t.location.protocol&&(l=t.parent.location.protocol,e.host||(e.host=t.parent.location.host));let u="http:"===l?"ws":"wss";const d=e.port?e.port:8088;let f=`${u}://${t.location.host}:${d}/${s}`;e.host&&(f=e.host.includes("://")?`${e.host}/${s}`:e.host.includes(":")?`${u}://${e.host}/${s}`:`${u}://${e.host}:${d}/${s}`);try{a=new n(f)}catch(e){return}a.onopen=function(e){(c.messageQueue.get(s)||[]).forEach((e=>a.send(JSON.stringify(e)))),c.sockets.set(s,a),c.messageQueue.set(s,[])},a.onclose=function(t){switch(t.code){case 1e3:break;default:c.destroy(a,s),c.reconnect(a,e)}},a.onerror=function(t){c.destroy(a,s),c.reconnect(a,e)},a.onmessage=function(e){try{if(t.Blob&&e.data instanceof o)return void c.saveFile(e.data);let i=JSON.parse(e.data);if(i.data.event){if(t.CustomEvent){var n=new t.CustomEvent(i.data.event,{detail:i.data});return void t.document.dispatchEvent(n)}return void process.emit(i.data.event,i.data)}i.action;const r=c.listeners.get(i.action);if(!r)return;r.forEach((e=>{e(i.data,s)}))}catch(e){}}}send(t,n,o){const i={action:t,data:{...n,uid:e.GenerateUUID()}},r=this.getKeyByRoom(o),s=this.getByRoom(o);s?s.send(JSON.stringify(i)):this.messageQueue.get(r)?this.messageQueue.get(r).push(i):this.messageQueue.set(r,[i])}sendFile(e,t){const n=this.getByRoom(t);n&&n.send(e)}listen(e,t){this.listeners.get(e)?this.listeners.get(e).push(t):this.listeners.set(e,[t])}reconnect(e,t){let n=this;setTimeout((function(){n.create(t)}),1e3)}destroy(e,t){e&&(e.onerror=e.onopen=e.onclose=null,e.close(),e=null),this.sockets.get(t)&&this.sockets.delete(t)}destroyByKey(e){let t=this.sockets.get(e);t&&this.destroy(t,e)}getKey(e,t){let n=`${this.prefix}`;return e&&""!=e&&(n+=t&&""!=t?`/${e}/${t}`:`/${e}`),n}getByRoom(e){let t=this.getKeyByRoom(e);return this.sockets.get(t)}getKeyByRoom(e){let t=this.globalScope;return e&&(t=`${this.prefix}/${e}`),t}saveFile(e){if(t.document){const o=this.saveFileName||"downloadFile";var n=t.document.createElement("a");t.document.body.appendChild(n),n.style="display: none";let i=window.URL.createObjectURL(e);n.href=i,n.download=o,n.click(),t.URL.revokeObjectURL(i),this.saveFileName=""}}listenAsync(e){return new Promise(((n,o)=>{t.document?t.document.addEventListener(e,(function(e){n(e.detail)}),{once:!0}):process.once(e,(e=>{n(e)}))}))}}return i}(e,window,WebSocket,Blob)}.apply(t,o))||(e.exports=i)},417:(e,t,n)=>{"use strict";var o;const i={id:"instagram",actions:["getUserProfile"],render_getUserProfile:function(e){}};((o=n(946))&&o.__esModule?o:{default:o}).default.init({name:i.id,module:i})},352:(e,t,n)=>{"use strict";var o,i;"undefined"!=typeof self&&self,o=[n(417)],void 0===(i=function(e){return e}.apply(t,o))||(e.exports=i)}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=n(352);return o=o.default})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CoCreate=t():(e.CoCreate=e.CoCreate||{},e.CoCreate.instagram=t())}(this,(function(){return(()=>{var e={75:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var o=n(585),i=n.n(o);const r={attribute:"data-actions",actions:{},selectedStage:[],stageIndex:0,selectedElement:null,completedEventName:"completedEvent",__init:function(){this.actionButtonEvent()},actionButtonEvent:function(){const e=this;document.addEventListener("click",(function(t){let n=t.target;if(n.getAttribute("data-actions")||(n=t.target.closest("[data-actions]")),!n)return;t.preventDefault();let o=(n.getAttribute(e.attribute)||"").replace(/\s/g,"").split(",");0!=o.length&&(e.stageIndex=0,e.selectedStage=o,e.selectedElement=n,e.__runActionFunc())}))},init:function({action:e,callback:t,endEvent:n}){this.registerEvent(e,t,null,n)},registerEvent:function(e,t,n,o){if(this.actions[e])return;this.actions[e]={key:e,runFunc:t,instance:n||window,endEvent:o};for(let t in this.actions)if(t!=e&&this.actions[t].endEvent===o)return;const i=this;document.addEventListener(o,(function(e){i.__nextAction(o,e.detail)}))},__runActionFunc:function(e){if(this.stageIndex>=this.selectedStage.length)return void(this.stageIndex==this.selectedStage.length&&this.__runAtag(this.selectedElement));const t=this.selectedStage[this.stageIndex],n=this.actions[t];if(n)n.runFunc?n.runFunc.call(null,this.selectedElement,e):this.__nextAction(n.endEvent,{});else{"next"===this.__runSpecialAction(t,e)&&this.__moveNextAction()}},__nextAction:function(e,t){const n=this.selectedStage[this.stageIndex];n&&e===this.actions[n].endEvent&&this.__moveNextAction(t)},__runAtag:function(e){e.querySelector("a")},__runSpecialAction:function(e,t){let n=/(\w+)\{([a-zA-Z0-9_ \-#$.]+)\}/gm.exec(e);if(!n||n.length<3)return"next";let o=n[1],i=n[2].trim();if(!i)return"next";const r=this;switch(o){case"event":document.addEventListener(i,(e=>{r.__moveNextAction(e)}),{once:!0});break;case"timeout":parseInt(i)>0&&setTimeout((function(){r.__moveNextAction(t)}),parseInt(i));break;case"action":let e=document.querySelector(i);e&&e.click();break;default:return"next"}},__moveNextAction:function(e){this.stageIndex++,this.__runActionFunc(e)}};r.__init();const a=r,s={__getValueFromObject:function(e,t){try{if(void 0===e||!t)return!1;let n=e,o=t.split(".");for(let e=0;e<o.length;e++)if(n=n[o[e]],!n)return!1;return n}catch(e){return!1}},__getValue:function(e,t){let n=/{{\s*([\w\W]+)\s*}}/g.exec(t);return!!n&&this.__getValueFromObject(e,n[1].trim())},__createObject:function(e,t){try{if(!t)return e;let o=t.split("."),i=e;for(var n=o.length-1;n>=0;n--)i={[o[n]]:i};return i}catch(e){return!1}},__replaceValue:function(e,t){let n=!1,o=this,i=null,r=t.match(/{{([A-Za-z0-9_.,\[\]\- ]*)}}/g);return r&&(r.forEach((i=>{let r=o.__getValue(e,i);r&&"object"!=typeof r&&(n=!0,t=t.replace(i,r))})),n&&(i=t)),i},setArray:function(e,t){const n=e.getAttribute("data-render_array")||"data",o=e.getAttribute("data-render_key")||n,i=this,r=this.__getValueFromObject(t,n);n&&Array.isArray(r)&&r.forEach(((t,r)=>{let a=e.cloneNode(!0);a.classList.remove("template"),a.classList.add("clone_"+n);let s=o;"object"!=typeof t?s+="[]":t.index=r;let c=i.__createObject(t,s);i.setValue([a],c),e.insertAdjacentHTML("beforebegin",a.outerHTML)}))},setValue:function(e,t,n,o){if(!t)return;const i=this;Array.from(e).forEach((e=>{let o=e.getAttribute("data-pass_id");if(!n||o==n){if(Array.from(e.attributes).forEach((n=>{let o=n.name.toLowerCase(),r=n.value;if(r=i.__replaceValue(t,r),r){if("value"==o){switch(e.tagName.toLowerCase()){case"input":e.setAttribute(o,r);break;case"textarea":e.setAttribute(o,r),e.textContent=r;break;default:0===e.children.length&&(e.innerHTML=r)}}e.setAttribute(o,r)}})),0==e.children.length&&e.textContent){let n=e.textContent;n=i.__replaceValue(t,n),n&&(e.textContent=n)}e.children.length>0&&i.setValue(e.children,t),e.classList.contains("template")&&i.setArray(e,t)}}))},data:function({selector:e,data:t,elements:n,passTo:o}){e?this.render(e,t):n&&this.setValue(n,t,o)},render:function(e,t){let n=document.querySelector(e);n&&(Array.isArray(t)?(n.setAttribute("data-render_array","test"),this.setValue([n],{test:t})):this.setValue(n.children,t))}};let c=new(i())("api");const l={modules:{},init:function({name:e,module:t}){this.register(e,t)},register:function(e,t){const n=this;void 0===this.modules[e]&&(this.modules[e]=t,c.listen(e,(t=>{n.__responseProcess(e,t)})),Array.isArray(t.actions)&&t.actions.forEach((e=>{"function"!=typeof t[`action_${e}`]&&(t[`action_${e}`]=function(o){n.__commonAction(t.id,e,o)}),a.init({action:e,endEvent:e,callback:n=>{t[`action_${e}`](n)}})})))},__responseProcess:function(e,t){const{type:n,response:o}=t,i=this.modules[e];n&&o&&i&&("function"==typeof i[`render_${n}`]&&i[`render_${n}`](o),this.render(n,o),document.dispatchEvent(new CustomEvent(n,{detail:{data:o}})))},__commonAction:function(e,t,n){const o=n.closest("form")||document;let i=l.getFormData(e,t,o);l.send(e,t,i)},getFormData:function(e,t,n){const o=`data-${e}`,i=this,r=n.querySelectorAll(`[${o}^="${t}."]`);let a={};r.forEach((n=>{let r=n.getAttribute(o),s=n.getAttribute(o+"_array"),c=i.__getElValue(n);if(r){if(t){let e=new RegExp(`^${t}.`,"i");if(!e.test(r))return;r=r.replace(e,"")}s?(a[r]||(a[r]=[]),a[r].push(i.getFormData(e,s,n))):null!=c&&(a[r]=c)}}));let s=Object.keys(a),c={};return s.forEach((e=>{if(e.split(".").length>1){let t=i.__createObject(a[e],e);delete a[e],c=i.__mergeObject(c,t)}else c[e]=a[e]})),c},__getElValue:function(e){let t=null;if(void 0!==e.value)switch(e.type.toLocaleLowerCase()){case"checkbox":e.checked&&(t=e.value);break;default:t=e.value}else t=e.getAttribute("value"),t||(t=e.innerHTML);return t},__mergeObject:function(e,t){e=e||{};for(let n of Object.keys(t))t[n]instanceof Object&&Object.assign(t[n],this.__mergeObject(e[n],t[n]));return Object.assign(e||{},t),e},__createObject:function(e,t){if(!t)return e;let n=t.split("."),o=e;for(var i=n.length-1;i>=0;i--)o={[n[i]]:o};return o},send:function(e,t,n){let o=this.getCommonParamsExtend(n||{});o={...o,data:n},c.send(e,{type:t,data:o})},render:function(e,t){s.data({selector:`[data-template_id="${e}"]`,data:t})},createApiSocket:function(e,t){t?(c.create({namespace:t,room:null,host:e}),c.setGlobalScope(t)):c.create({namespace:null,room:null,host:e})},getCommonParamsExtend:function(e){return{apiKey:e.apiKey||config.apiKey,securityKey:e.securityKey||config.securityKey,organization_id:e.organization_id||config.organization_Id}}};l.createApiSocket(window.config.host?window.config.host:"server.cocreate.app",window.config.organization_Id);const u=l},946:function(e,t,n){var o,i;"undefined"!=typeof self&&self,o=[n(75)],void 0===(i=function(e){return e}.apply(t,o))||(e.exports=i)},446:function(e,t){var n;"undefined"!=typeof self&&self,void 0===(n=function(){return function(e){function t(){let t={};return e&&e.config&&(t=e.config),{apiKey:t.apiKey,organization_id:t.organization_Id}}function n(t){let n={};return e&&e.config&&(n=e.config),{apiKey:t.apiKey||n.apiKey,organization_id:t.organization_id||n.organization_Id}}function o(t,n){let o={};e&&e.config&&(o=e.config);let i=t||o.organization_Id,r=n||"";return r?`${i}/${r}`:i}return{getCommonParams:t,getCommonParamsExtend:n,generateSocketClient:o}}(window)}.apply(t,[]))||(e.exports=n)},585:function(e,t,n){var o,i;"undefined"!=typeof self&&self,o=[n(446),n(212)],void 0===(i=function(e,t){return function(e,t,n,o,i){class r{constructor(e="crud"){this.prefix=e||"crud",this.sockets=new Map,this.listeners=new Map,this.messageQueue=new Map,this.saveFileName="",this.globalScope=""}setGlobalScope(e){this.globalScope=`${this.prefix}/${e}`}getGlobalScope(){return this.globalScope}create(e){const{namespace:i,room:r}=e,a=this.getKey(i,r);let s,c=this;if(i&&this.setGlobalScope(i),this.sockets.get(a))return void(s=this.sockets.get(a));let l=t.location.protocol;"about:"===t.location.protocol&&(l=t.parent.location.protocol,e.host||(e.host=t.parent.location.host));let u="http:"===l?"ws":"wss";const d=e.port?e.port:8088;let f=`${u}://${t.location.host}:${d}/${a}`;e.host&&(f=e.host.includes("://")?`${e.host}/${a}`:e.host.includes(":")?`${u}://${e.host}/${a}`:`${u}://${e.host}:${d}/${a}`);try{let e=null;t.localStorage&&(e=t.localStorage.getItem("token")),s=new n(f,e),s.cocreate_connected=!1,this.sockets.set(a,s)}catch(e){return}s.onopen=function(e){s.cocreate_connected||(s.cocreate_connected=!0),(c.messageQueue.get(a)||[]).forEach((e=>s.send(JSON.stringify(e)))),c.messageQueue.set(a,[])},s.onclose=function(t){switch(t.code){case 1e3:break;default:c.destroy(s,a),c.reconnect(s,e)}},s.onerror=function(t){c.destroy(s,a),c.reconnect(s,e)},s.onmessage=function(e){try{if(t.Blob&&e.data instanceof o)return void c.saveFile(e.data);let n=JSON.parse(e.data);if(n.data&&(n.data.uid&&c.__fireEvent(n.data.uid,n.data),n.data.event))return void c.__fireEvent(n.data.event,n.data);n.action;const i=c.listeners.get(n.action);if(!i)return;i.forEach((e=>{e(n.data,a)}))}catch(e){}}}__fireEvent(e,n){if(t.CustomEvent){var o=new t.CustomEvent(e,{detail:n});t.document.dispatchEvent(o)}else process.emit(e,n)}send(e,t,n){const o=i.generate(),r={action:e,data:{...t,uid:o}},a=this.getKeyByRoom(n),s=this.getByRoom(n);return s&&s.cocreate_connected?s.send(JSON.stringify(r)):this.messageQueue.get(a)?this.messageQueue.get(a).push(r):this.messageQueue.set(a,[r]),o}sendFile(e,t){const n=this.getByRoom(t);n&&n.send(e)}listen(e,t){this.listeners.get(e)?this.listeners.get(e).push(t):this.listeners.set(e,[t])}reconnect(e,t){let n=this;setTimeout((function(){n.create(t)}),1e3)}destroy(e,t){e&&(e.onerror=e.onopen=e.onclose=null,e.close(),e=null),this.sockets.get(t)&&this.sockets.delete(t)}destroyByKey(e){let t=this.sockets.get(e);t&&this.destroy(t,e)}getKey(e,t){let n=`${this.prefix}`;return e&&""!=e&&(n+=t&&""!=t?`/${e}/${t}`:`/${e}`),n}getByRoom(e){let t=this.getKeyByRoom(e);return this.sockets.get(t)}getKeyByRoom(e){let t=this.globalScope;return e&&(t=`${this.prefix}/${e}`),t}saveFile(e){if(t.document){const o=this.saveFileName||"downloadFile";var n=t.document.createElement("a");t.document.body.appendChild(n),n.style="display: none";let i=window.URL.createObjectURL(e);n.href=i,n.download=o,n.click(),t.URL.revokeObjectURL(i),this.saveFileName=""}}listenAsync(e){return new Promise(((n,o)=>{let i=setTimeout((()=>{clearTimeout(i),n(null)}),5e3);t.document?t.document.addEventListener(e,(function(e){n(e.detail)}),{once:!0}):process.once(e,(e=>{n(e)}))}))}}return r}(0,window,WebSocket,Blob,t)}.apply(t,o))||(e.exports=i)},212:function(e,t){var n;"undefined"!=typeof self&&self,void 0===(n=function(){return function(e){const t={attribute:"data-uuid",init:function(t){if(!e.document)return;const n=t||e.document;if(!n.querySelectorAll)return;let o=n.querySelectorAll(`[${this.attribute}]`);const i=this;o.forEach((e=>{const t=parseInt(e.getAttribute(i.attribute))||36,n=i.generate(t);"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value=n:e.innerHTML=n}))},generate:function(t=36){let n=(new Date).getTime(),o=e.performance&&e.performance.now&&1e3*e.performance.now()||0,i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";if(t<=i.length)i=i.substr(0,t);else{let e=t-i.length,n="-xxxyyxxx",o=Math.floor(e/n.length);for(let e=0;e<o;e++)i+=n;o=e-o*n.length,i+=n.substr(0,o)}return i.replace(/[xy]/g,(function(e){var t=16*Math.random();return n>0?(t=(n+t)%16|0,n=Math.floor(n/16)):(t=(o+t)%16|0,o=Math.floor(o/16)),("x"==e?t:7&t|8).toString(16)}))}};return t.init(),t}(window)}.apply(t,[]))||(e.exports=n)},417:(e,t,n)=>{"use strict";var o;const i={id:"instagram",actions:["getUserProfile"],render_getUserProfile:function(e){}};((o=n(946))&&o.__esModule?o:{default:o}).default.init({name:i.id,module:i})},352:(e,t,n)=>{"use strict";var o,i;"undefined"!=typeof self&&self,o=[n(417)],void 0===(i=function(e){return e}.apply(t,o))||(e.exports=i)}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=n(352);return o=o.default})()}));
{
"name": "@cocreate/instagram",
"version": "1.0.4",
"version": "1.0.5",
"description": "A simple instagram component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -63,5 +63,5 @@ "keywords": [

"dependencies": {
"@cocreate/api": "^1.0.0",
"@cocreate/docs": "^1.0.0"
"@cocreate/api": "^1.0.17",
"@cocreate/docs": "^1.1.14"
}
}
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