@usecsv/vuejs 1.0.2 → 1.0.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.3](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.0.2...v1.0.3) (2022-02-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update props ([a8c47a1](https://github.com/layercodedev/usecsv-vuejs-plugin/commit/a8c47a1d2743ac2ea41c3f590a60080cd92634af))
7
+
1
8
  ## [1.0.2](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.0.1...v1.0.2) (2022-02-15)
2
9
 
3
10
 
@@ -592,6 +592,11 @@ var useCsvPlugin = function (_a) {
592
592
 
593
593
  var script = /*#__PURE__*/Vue.extend({
594
594
  name: "usecsv-button",
595
+ props: {
596
+ importerKey: {},
597
+ user: {},
598
+ metadata: {}
599
+ },
595
600
 
596
601
  data() {
597
602
  return {
@@ -603,13 +608,12 @@ var script = /*#__PURE__*/Vue.extend({
603
608
  openModal() {
604
609
  useCsvPlugin({
605
610
  importerKey: this.importerKey,
606
- user: this.importerKey,
611
+ user: this.user,
607
612
  metadata: this.metadata
608
613
  });
609
614
  },
610
615
 
611
616
  hasScopedSlot() {
612
- console.log(this.$scopedSlots.default && this.$scopedSlots.default.name);
613
617
  return (this.$scopedSlots.default && this.$scopedSlots.default.name) === "normalized";
614
618
  }
615
619
 
@@ -777,8 +781,8 @@ var __vue_staticRenderFns__ = [];
777
781
 
778
782
  const __vue_inject_styles__ = function (inject) {
779
783
  if (!inject) return;
780
- inject("data-v-33b17e68_0", {
781
- source: "#usecsv-button[data-v-33b17e68]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
784
+ inject("data-v-0af7725f_0", {
785
+ source: "#usecsv-button[data-v-0af7725f]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
782
786
  map: undefined,
783
787
  media: undefined
784
788
  });
@@ -786,7 +790,7 @@ const __vue_inject_styles__ = function (inject) {
786
790
  /* scoped */
787
791
 
788
792
 
789
- const __vue_scope_id__ = "data-v-33b17e68";
793
+ const __vue_scope_id__ = "data-v-0af7725f";
790
794
  /* module identifier */
791
795
 
792
796
  const __vue_module_identifier__ = undefined;
@@ -3,4 +3,4 @@ var UseCSVButton=function(e){"use strict";function t(e){return e&&"object"==type
3
3
  * @usecsv/js v0.1.0
4
4
  * (c) layercode
5
5
  * Released under the MIT License.
6
- */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=[],s=[];function a(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),a=i.indexOf(r);return-1===a&&(a=i.push(r)-1,s[a]={}),void 0!==s[a]&&void 0!==s[a][o]?n=s[a][o]:(n=s[a][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var c,d,l,u,f,m=a;a.insertCss=m,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(c||(c={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(d||(d={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(l||(l={})),function(e){e.DataCloneError="DataCloneError"}(u||(u={})),function(e){e.Message="message"}(f||(f={}));const p={"http:":"80","https:":"443"},h=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,v=["file:","data:"];const g=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let y=0;var b=()=>++y,S=(e,t,n,o,r)=>{const{localName:i,local:s,remote:a,originForSending:u,originForReceiving:m}=t;let p=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{a.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),p){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=l.ConnectionDestroyed,t}return new Promise(((n,o)=>{const l=b(),p=t=>{if(t.source!==a||t.data.penpal!==c.Reply||t.data.id!==l)return;if(t.origin!==m)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const u=t.data;r(`${i}: Received ${e}() reply`),s.removeEventListener(f.Message,p);let h=u.returnValue;u.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(u.resolution===d.Fulfilled?n:o)(h)};s.addEventListener(f.Message,p);const h={penpal:c.Call,id:l,methodName:e,args:t};a.postMessage(h,u)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{p=!0}},C=(e,t,n,o,r)=>{const{destroy:i,onDestroy:s}=o;let a,l;const m={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};a&&a(),a=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:s,originForReceiving:a}=e;let l=!1;const m=e=>{if(e.source!==i||e.data.penpal!==c.Call)return;if(e.origin!==a)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${a}`);const r=e.data,{methodName:f,args:m,id:p}=r;n(`${o}: Received ${f}() call`);const h=e=>t=>{if(n(`${o}: Sending ${f}() reply`),l)return void n(`${o}: Unable to send ${f}() reply due to destroyed connection`);const r={penpal:c.Reply,id:p,resolution:e,returnValue:t};e===d.Rejected&&t instanceof Error&&(r.returnValue=g(t),r.returnValueIsError=!0);try{i.postMessage(r,s)}catch(e){if(e.name===u.DataCloneError){const t={penpal:c.Reply,id:p,resolution:d.Rejected,returnValue:g(e),returnValueIsError:!0};i.postMessage(t,s)}throw e}};new Promise((e=>e(t[f].apply(t,m)))).then(h(d.Fulfilled),h(d.Rejected))};return r.addEventListener(f.Message,m),()=>{l=!0,r.removeEventListener(f.Message,m)}})(p,e,r),s(a),l&&l.forEach((e=>{delete m[e]})),l=o.data.methodNames;const h=S(m,p,l,i,r);return s(h),m}};var $=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),a=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",s),{onDestroy:d,destroy:u}=a;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=l.NoIframeSrc,e}})(t),o=(e=>{if(e&&v.find((t=>e.startsWith(t))))return"null";const t=document.location,n=h.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==p[o]?`:${i}`:""}`})(t.src));const m="null"===o?"*":o,g=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:c.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(s,n,o,m),y=C(n,o,m,a,s),b=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=l.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,u),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==c.Syn)if(n.data.penpal!==c.Ack);else{const t=y(n);t&&(o(),e(t))}else g(n)};window.addEventListener(f.Message,i),s("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,a),d((e=>{window.removeEventListener(f.Message,i),e&&n(e)}))}));return{promise:b,destroy(){u()}}},w=["interactive","complete"],E=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==w.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};E.resume=function(e){return function(t){return E(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r="usecsv-".concat(Math.round(1e8*Math.random()));return E().then((function(){var e=function(e){var t;m("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n"),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading">\n</div>'));var n=document.createElement("iframe");return n.setAttribute("src","https://app.usecsv.com/importer"),null===(t=document.getElementById(e))||void 0===t||t.appendChild(n),n}(r),i=$({iframe:e,methods:{closeIframe:function(){var e;null===(e=document.getElementById(r))||void 0===e||e.remove()}}});return i.promise.then((function(e){var i;null===(i=document.getElementById(r))||void 0===i||i.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),i}))},R=n.default.extend({name:"usecsv-button",data:function(){return{hasSlot:!!this.$slots.default}},methods:{openModal:function(){_({importerKey:this.importerKey,user:this.importerKey,metadata:this.metadata})},hasScopedSlot:function(){return console.log(this.$scopedSlots.default&&this.$scopedSlots.default.name),"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function x(e,t,n,o,r,i,s,a,c,d){"boolean"!=typeof s&&(c=a,a=s,s=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(e){return(e,t)=>function(e,t){const n=A?t.media||"default":e,o=I[n]||(I[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===N&&(N=document.head||document.getElementsByTagName("head")[0]),N.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let N;const I={};var k=x({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",null,{openModal:e.openModal})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.openModal}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-33b17e68_0",{source:"#usecsv-button[data-v-33b17e68]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),R,"data-v-33b17e68",false,undefined,!1,M,void 0,void 0),j=function(){var e=k;return e.install=function(t){t.component("usecsv-button",e)},e}(),T=Object.freeze({__proto__:null,default:j});return Object.entries(T).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(j[n]=r)})),j}(Vue);
6
+ */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=[],s=[];function a(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),a=i.indexOf(r);return-1===a&&(a=i.push(r)-1,s[a]={}),void 0!==s[a]&&void 0!==s[a][o]?n=s[a][o]:(n=s[a][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var c,d,l,u,f,m=a;a.insertCss=m,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(c||(c={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(d||(d={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(l||(l={})),function(e){e.DataCloneError="DataCloneError"}(u||(u={})),function(e){e.Message="message"}(f||(f={}));const p={"http:":"80","https:":"443"},h=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,v=["file:","data:"];const g=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let y=0;var S=()=>++y,b=(e,t,n,o,r)=>{const{localName:i,local:s,remote:a,originForSending:u,originForReceiving:m}=t;let p=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{a.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),p){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=l.ConnectionDestroyed,t}return new Promise(((n,o)=>{const l=S(),p=t=>{if(t.source!==a||t.data.penpal!==c.Reply||t.data.id!==l)return;if(t.origin!==m)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const u=t.data;r(`${i}: Received ${e}() reply`),s.removeEventListener(f.Message,p);let h=u.returnValue;u.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(u.resolution===d.Fulfilled?n:o)(h)};s.addEventListener(f.Message,p);const h={penpal:c.Call,id:l,methodName:e,args:t};a.postMessage(h,u)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{p=!0}},C=(e,t,n,o,r)=>{const{destroy:i,onDestroy:s}=o;let a,l;const m={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};a&&a(),a=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:s,originForReceiving:a}=e;let l=!1;const m=e=>{if(e.source!==i||e.data.penpal!==c.Call)return;if(e.origin!==a)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${a}`);const r=e.data,{methodName:f,args:m,id:p}=r;n(`${o}: Received ${f}() call`);const h=e=>t=>{if(n(`${o}: Sending ${f}() reply`),l)return void n(`${o}: Unable to send ${f}() reply due to destroyed connection`);const r={penpal:c.Reply,id:p,resolution:e,returnValue:t};e===d.Rejected&&t instanceof Error&&(r.returnValue=g(t),r.returnValueIsError=!0);try{i.postMessage(r,s)}catch(e){if(e.name===u.DataCloneError){const t={penpal:c.Reply,id:p,resolution:d.Rejected,returnValue:g(e),returnValueIsError:!0};i.postMessage(t,s)}throw e}};new Promise((e=>e(t[f].apply(t,m)))).then(h(d.Fulfilled),h(d.Rejected))};return r.addEventListener(f.Message,m),()=>{l=!0,r.removeEventListener(f.Message,m)}})(p,e,r),s(a),l&&l.forEach((e=>{delete m[e]})),l=o.data.methodNames;const h=b(m,p,l,i,r);return s(h),m}};var w=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),a=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",s),{onDestroy:d,destroy:u}=a;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=l.NoIframeSrc,e}})(t),o=(e=>{if(e&&v.find((t=>e.startsWith(t))))return"null";const t=document.location,n=h.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==p[o]?`:${i}`:""}`})(t.src));const m="null"===o?"*":o,g=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:c.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(s,n,o,m),y=C(n,o,m,a,s),S=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=l.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,u),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==c.Syn)if(n.data.penpal!==c.Ack);else{const t=y(n);t&&(o(),e(t))}else g(n)};window.addEventListener(f.Message,i),s("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,a),d((e=>{window.removeEventListener(f.Message,i),e&&n(e)}))}));return{promise:S,destroy(){u()}}},$=["interactive","complete"],E=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==$.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};E.resume=function(e){return function(t){return E(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r="usecsv-".concat(Math.round(1e8*Math.random()));return E().then((function(){var e=function(e){var t;m("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n"),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading">\n</div>'));var n=document.createElement("iframe");return n.setAttribute("src","https://app.usecsv.com/importer"),null===(t=document.getElementById(e))||void 0===t||t.appendChild(n),n}(r),i=w({iframe:e,methods:{closeIframe:function(){var e;null===(e=document.getElementById(r))||void 0===e||e.remove()}}});return i.promise.then((function(e){var i;null===(i=document.getElementById(r))||void 0===i||i.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),i}))},R=n.default.extend({name:"usecsv-button",props:{importerKey:{},user:{},metadata:{}},data:function(){return{hasSlot:!!this.$slots.default}},methods:{openModal:function(){_({importerKey:this.importerKey,user:this.user,metadata:this.metadata})},hasScopedSlot:function(){return"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function x(e,t,n,o,r,i,s,a,c,d){"boolean"!=typeof s&&(c=a,a=s,s=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(e){return(e,t)=>function(e,t){const n=A?t.media||"default":e,o=I[n]||(I[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===N&&(N=document.head||document.getElementsByTagName("head")[0]),N.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let N;const I={};var k=x({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",null,{openModal:e.openModal})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.openModal}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-0af7725f_0",{source:"#usecsv-button[data-v-0af7725f]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),R,"data-v-0af7725f",false,undefined,!1,M,void 0,void 0),j=function(){var e=k;return e.install=function(t){t.component("usecsv-button",e)},e}(),T=Object.freeze({__proto__:null,default:j});return Object.entries(T).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(j[n]=r)})),j}(Vue);
@@ -646,6 +646,11 @@ var useCsvPlugin = function (_a) {
646
646
  };var script = /*#__PURE__*/Vue__default["default"].extend({
647
647
  name: "usecsv-button",
648
648
  // vue component name
649
+ props: {
650
+ importerKey: {},
651
+ user: {},
652
+ metadata: {}
653
+ },
649
654
  data: function data() {
650
655
  return {
651
656
  hasSlot: !!this.$slots.default
@@ -655,12 +660,11 @@ var useCsvPlugin = function (_a) {
655
660
  openModal: function openModal() {
656
661
  useCsvPlugin({
657
662
  importerKey: this.importerKey,
658
- user: this.importerKey,
663
+ user: this.user,
659
664
  metadata: this.metadata
660
665
  });
661
666
  },
662
667
  hasScopedSlot: function hasScopedSlot() {
663
- console.log(this.$scopedSlots.default && this.$scopedSlots.default.name);
664
668
  return (this.$scopedSlots.default && this.$scopedSlots.default.name) === "normalized";
665
669
  }
666
670
  }
@@ -790,9 +794,9 @@ var __vue_render__ = function __vue_render__() {
790
794
 
791
795
  return _c('div', {
792
796
  staticClass: "usecsv"
793
- }, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-33b17e68>", "</div>", [_vm._t("default", null, {
797
+ }, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-0af7725f>", "</div>", [_vm._t("default", null, {
794
798
  "openModal": _vm.openModal
795
- })], 2) : _vm._ssrNode("<div data-v-33b17e68>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-33b17e68>", "</button>", [_vm._t("default", function () {
799
+ })], 2) : _vm._ssrNode("<div data-v-0af7725f>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-0af7725f>", "</button>", [_vm._t("default", function () {
796
800
  return [_vm._v(" open usecsv ")];
797
801
  })], 2)])]);
798
802
  };
@@ -802,8 +806,8 @@ var __vue_staticRenderFns__ = [];
802
806
 
803
807
  var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
804
808
  if (!inject) return;
805
- inject("data-v-33b17e68_0", {
806
- source: "#usecsv-button[data-v-33b17e68]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
809
+ inject("data-v-0af7725f_0", {
810
+ source: "#usecsv-button[data-v-0af7725f]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
807
811
  map: undefined,
808
812
  media: undefined
809
813
  });
@@ -811,10 +815,10 @@ var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
811
815
  /* scoped */
812
816
 
813
817
 
814
- var __vue_scope_id__ = "data-v-33b17e68";
818
+ var __vue_scope_id__ = "data-v-0af7725f";
815
819
  /* module identifier */
816
820
 
817
- var __vue_module_identifier__ = "data-v-33b17e68";
821
+ var __vue_module_identifier__ = "data-v-0af7725f";
818
822
  /* functional template */
819
823
 
820
824
  var __vue_is_functional_template__ = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usecsv/vuejs",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/UseCSVButton.ssr.js",
6
6
  "browser": "dist/UseCSVButton.esm.js",
@@ -13,6 +13,11 @@ interface IUsecsv {
13
13
 
14
14
  export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{openModal:()=>void,hasScopedSlot:()=>boolean},any,IUsecsv>({
15
15
  name: "usecsv-button", // vue component name
16
+ props:{
17
+ importerKey:{},
18
+ user:{},
19
+ metadata:{}
20
+ },
16
21
  data() {
17
22
  return {
18
23
  hasSlot: !!this.$slots.default,
@@ -22,12 +27,11 @@ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{openModal:()=>void,ha
22
27
  openModal(): void {
23
28
  useCsvPlugin({
24
29
  importerKey: this.importerKey,
25
- user: this.importerKey,
30
+ user: this.user,
26
31
  metadata: this.metadata,
27
32
  });
28
33
  },
29
34
  hasScopedSlot(): boolean {
30
- console.log(this.$scopedSlots.default && this.$scopedSlots.default.name);
31
35
  return (
32
36
  (this.$scopedSlots.default && this.$scopedSlots.default.name) ===
33
37
  "normalized"