New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@printcart/wix-integration

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@printcart/wix-integration - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

82

dist/main.es.js

@@ -1204,34 +1204,46 @@ var __defProp = Object.defineProperty;

<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button>
<div id="pc-select_header">Choose a way to design this product</div>
<div id="pc-select_container">
<button class="pc-select_btn" id="pc-select_btn_upload">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<img src="${uploadImgSrc}" alt="Printcart Uploader" />
</div>
<div class="pc-select_btn_content">
<h2>Upload a full design</h2>
<ul>
<li>Have a complete design</li>
<li>Have your own designer</li>
</ul>
</div>
<div class="pc-select-wrap" id="pc-content-overlay">
<div class="pc-select-inner">
<div id="pc-select_header">Choose a way to design this product</div>
<div id="pc-select_container">
<button class="pc-select_btn" id="pc-select_btn_upload">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<div class="pc-select_btn_img_inner">
<img src="${uploadImgSrc}" alt="Printcart Uploader" />
</div>
</div>
<div class="pc-select_btn_content">
<div class="pc-select_btn_content_inner">
<h2 class="pc-title">Upload a full design</h2>
<ul>
<li>Have a complete design</li>
<li>Have your own designer</li>
</ul>
</div>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
<button class="pc-select_btn" id="pc-select_btn_design">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<div class="pc-select_btn_img_inner">
<img src="${designImgSrc}" alt="Printcart Designer" />
</div>
</div>
<div class="pc-select_btn_content">
<div class="pc-select_btn_content_inner">
<h2 class="pc-title">Design here online</h2>
<ul>
<li>Already have your concept</li>
<li>Customize every details</li>
</ul>
</div>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
<button class="pc-select_btn" id="pc-select_btn_design">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<img src="${designImgSrc}" alt="Printcart Designer" />
</div>
<div class="pc-select_btn_content">
<h2>Design here online</h2>
<ul>
<li>Already have your concept</li>
<li>Customize every details</li>
</ul>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
</div>
</div>

@@ -1287,2 +1299,3 @@ `;

const closeModalBtn = document.getElementById("pc-select_close-btn");
const backdropCloseModal = document.getElementById("pc-content-overlay");
const handleClose = (e) => {

@@ -1295,2 +1308,3 @@ if (e.key === "Escape") {

closeModalBtn == null ? void 0 : closeModalBtn.addEventListener("click", () => __privateMethod(this, _closeModal, closeModal_fn).call(this));
backdropCloseModal == null ? void 0 : backdropCloseModal.addEventListener("click", () => __privateMethod(this, _closeModal, closeModal_fn).call(this));
};

@@ -1337,2 +1351,6 @@ _modalTrap = new WeakSet();

previewWrap.className = "pc-preview-wrap";
if (localStorage.getItem("pc-design-ids")) {
localStorage.removeItem("pc-design-ids");
}
localStorage.setItem("pc-design-ids", JSON.stringify(ids));
data.forEach((design) => {

@@ -1485,3 +1503,3 @@ var _a2;

addStyle_fn = function() {
const sdkUrl = {}.VITE_SDK_URL ? {}.VITE_SDK_URL : "https://unpkg.com/@printcart/shopify-integration/dist";
const sdkUrl = {}.VITE_SDK_URL ? {}.VITE_SDK_URL : "https://unpkg.com/@printcart/wix-integration/dist";
const link = document.createElement("link");

@@ -1488,0 +1506,0 @@ link.rel = "stylesheet";

@@ -1,36 +0,48 @@

var At=Object.defineProperty;var Dt=(p,d,h)=>d in p?At(p,d,{enumerable:!0,configurable:!0,writable:!0,value:h}):p[d]=h;var M=(p,d,h)=>(Dt(p,typeof d!="symbol"?d+"":d,h),h),Ue=(p,d,h)=>{if(!d.has(p))throw TypeError("Cannot "+h)};var c=(p,d,h)=>(Ue(p,d,"read from private field"),h?h.call(p):d.get(p)),g=(p,d,h)=>{if(d.has(p))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(p):d.set(p,h)},O=(p,d,h,N)=>(Ue(p,d,"write to private field"),N?N.call(p,h):d.set(p,h),h);var y=(p,d,h)=>(Ue(p,d,"access private method"),h);(function(p,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d():typeof define=="function"&&define.amd?define(d):(p=typeof globalThis!="undefined"?globalThis:p||self,p.PrintcartDesignerWix=d())})(this,function(){var q,ee,_,L,P,de,st,le,ot,U,te,ue,at,pe,ct,fe,dt,he,lt,ve,ut,me,pt,ge,ft,ye,ht,_e,vt,we,mt,Le,gt,Ee,yt;"use strict";var p=Object.defineProperty,d=(n,e,t)=>e in n?p(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,h=(n,e,t)=>(d(n,typeof e!="symbol"?e+"":e,t),t),N=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},z=(n,e,t)=>(N(n,e,"read from private field"),t?t.call(n):e.get(n)),W=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Oe=(n,e,t,i)=>(N(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),b=(n,e,t)=>(N(n,e,"access private method"),t),$,X,Ie,Ne,Ce,We,ne,xe,I,C,Pe={exports:{}},A=typeof Reflect=="object"?Reflect:null,$e=A&&typeof A.apply=="function"?A.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},ie;A&&typeof A.ownKeys=="function"?ie=A.ownKeys:Object.getOwnPropertySymbols?ie=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ie=function(e){return Object.getOwnPropertyNames(e)};function _t(n){console&&console.warn&&console.warn(n)}var Ae=Number.isNaN||function(e){return e!==e};function l(){l.init.call(this)}Pe.exports=l,Pe.exports.once=bt,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var De=10;function re(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return De},set:function(n){if(typeof n!="number"||n<0||Ae(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");De=n}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ae(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Be(n){return n._maxListeners===void 0?l.defaultMaxListeners:n._maxListeners}l.prototype.getMaxListeners=function(){return Be(this)},l.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")$e(f,this,t);else for(var m=f.length,v=Ke(f,m),i=0;i<m;++i)$e(v[i],this,t);return!0};function je(n,e,t,i){var r,o,s;if(re(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),s=o[e]),s===void 0)s=o[e]=t,++n._eventsCount;else if(typeof s=="function"?s=o[e]=i?[t,s]:[s,t]:i?s.unshift(t):s.push(t),r=Be(n),r>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=s.length,_t(a)}return n}l.prototype.addListener=function(e,t){return je(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return je(this,e,t,!0)};function wt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Fe(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=wt.bind(i);return r.listener=t,i.wrapFn=r,r}l.prototype.once=function(e,t){return re(t),this.on(e,Fe(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return re(t),this.prependListener(e,Fe(this,e,t)),this},l.prototype.removeListener=function(e,t){var i,r,o,s,a;if(re(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():Lt(i,o),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r<o.length;++r)s=o[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function He(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?Et(r):Ke(r,r.length)}l.prototype.listeners=function(e){return He(this,e,!0)},l.prototype.rawListeners=function(e){return He(this,e,!1)},l.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):qe.call(n,e)},l.prototype.listenerCount=qe;function qe(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?ie(this._events):[]};function Ke(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function Lt(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Et(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function bt(n,e){return new Promise(function(t,i){function r(s){n.removeListener(e,o),i(s)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}Ve(n,e,o,{once:!0}),e!=="error"&&It(n,r,{once:!0})})}function It(n,e,t){typeof n.on=="function"&&Ve(n,"error",e,t)}function Ve(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(o){i.once&&n.removeEventListener(e,r),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Ct=Pe.exports;const Z="pc-designer-iframe-wrapper",se="pc-designer-iframe";class xt{constructor(e){W(this,Ie),W(this,Ce),W(this,ne),W(this,I),h(this,"token"),h(this,"productId"),h(this,"options"),W(this,$,void 0),W(this,X,void 0);var t;if(this.token=e.token,this.productId=e.productId,this.options=e.options,Oe(this,$,(t=this.options)!=null&&t.designerUrl?this.options.designerUrl:{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),Oe(this,X,new Ct),!this.token||!this.productId){console.error("Missing Config Params");return}b(this,Ie,Ne).call(this),b(this,Ce,We).call(this)}render(){const e=document.getElementById(Z),t=document.getElementById(se);if(!t||!(t instanceof HTMLIFrameElement)||!e){console.error("Can not find iframe element");return}const i=b(this,ne,xe).call(this);t.src=i.href,e.style.opacity="1",e.style.visibility="visible",b(this,I,C).call(this,"rendered")}close(){const e=document.getElementById(Z);if(!e){console.error("Can not find iframe element");return}e.style.opacity="0",e.style.visibility="hidden",b(this,I,C).call(this,"closed")}editDesign(e){const t=b(this,ne,xe).call(this);t.searchParams.set("design_id",e),t.searchParams.set("task","edit");const i=document.getElementById(Z),r=document.getElementById(se);if(!r||!(r instanceof HTMLIFrameElement)||!i){console.error("Can not find iframe element");return}r.src=t.href,i.style.opacity="1",i.style.visibility="visible",b(this,I,C).call(this,"edit")}on(e,t){return z(this,X).on(e,t),this}}$=new WeakMap,X=new WeakMap,Ie=new WeakSet,Ne=function(){const n=document.createElement("div");n.id=Z,n.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";const e=document.createElement("iframe");e.id=se,e.width="100%",e.height="100%",n.appendChild(e),document.body.appendChild(n)},Ce=new WeakSet,We=function(){window.addEventListener("message",n=>{if(n.origin===z(this,$)&&n.data.message==="closeDesignTool"){const e=document.getElementById(Z);if(!e)return;e.style.opacity="0",e.style.visibility="hidden",b(this,I,C).call(this,"closed")}if(n.data.message==="finishLoad"){const e=document.getElementById(se);b(this,I,C).call(this,"render-finish"),e&&e instanceof HTMLIFrameElement&&e.contentWindow&&e.contentWindow.postMessage({message:"customSettings",settings:this.options},z(this,$))}n.data.message==="finishProcess"&&b(this,I,C).call(this,"upload-success",n.data.data.data),n.data.message==="finishUpdate"&&b(this,I,C).call(this,"edit-success",n.data.data.data),n.data.message==="uploadError"&&b(this,I,C).call(this,"upload-error",n.data)},!1)},ne=new WeakSet,xe=function(){const n=new URL(z(this,$));return n.searchParams.set("api_key",this.token),n.searchParams.set("product_id",this.productId),n.searchParams.set("parentUrl",window.location.href),n},I=new WeakSet,C=function(n,...e){z(this,X).emit(n,...e)};var Te=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},w=(n,e,t)=>(Te(n,e,"read from private field"),t?t.call(n):e.get(n)),x=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},D=(n,e,t,i)=>(Te(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),S=(n,e,t)=>(Te(n,e,"access private method"),t),J,B,j,G,Y,Q,R,F,ke,ze,Me,Xe,Se={exports:{}},H=typeof Reflect=="object"?Reflect:null,Ze=H&&typeof H.apply=="function"?H.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},oe;H&&typeof H.ownKeys=="function"?oe=H.ownKeys:Object.getOwnPropertySymbols?oe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:oe=function(e){return Object.getOwnPropertyNames(e)};function Pt(n){console&&console.warn&&console.warn(n)}var Je=Number.isNaN||function(e){return e!==e};function u(){u.init.call(this)}Se.exports=u,Se.exports.once=St,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var Ge=10;function ae(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return Ge},set:function(n){if(typeof n!="number"||n<0||Je(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");Ge=n}}),u.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Je(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Ye(n){return n._maxListeners===void 0?u.defaultMaxListeners:n._maxListeners}u.prototype.getMaxListeners=function(){return Ye(this)},u.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")Ze(f,this,t);else for(var m=f.length,v=it(f,m),i=0;i<m;++i)Ze(v[i],this,t);return!0};function Qe(n,e,t,i){var r,o,s;if(ae(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),s=o[e]),s===void 0)s=o[e]=t,++n._eventsCount;else if(typeof s=="function"?s=o[e]=i?[t,s]:[s,t]:i?s.unshift(t):s.push(t),r=Ye(n),r>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=s.length,Pt(a)}return n}u.prototype.addListener=function(e,t){return Qe(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return Qe(this,e,t,!0)};function Tt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function et(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=Tt.bind(i);return r.listener=t,i.wrapFn=r,r}u.prototype.once=function(e,t){return ae(t),this.on(e,et(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return ae(t),this.prependListener(e,et(this,e,t)),this},u.prototype.removeListener=function(e,t){var i,r,o,s,a;if(ae(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():kt(i,o),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r<o.length;++r)s=o[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function tt(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?Mt(r):it(r,r.length)}u.prototype.listeners=function(e){return tt(this,e,!0)},u.prototype.rawListeners=function(e){return tt(this,e,!1)},u.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):nt.call(n,e)},u.prototype.listenerCount=nt;function nt(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}u.prototype.eventNames=function(){return this._eventsCount>0?oe(this._events):[]};function it(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function kt(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Mt(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function St(n,e){return new Promise(function(t,i){function r(s){n.removeListener(e,o),i(s)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}rt(n,e,o,{once:!0}),e!=="error"&&Rt(n,r,{once:!0})})}function Rt(n,e,t){typeof n.on=="function"&&rt(n,"error",e,t)}function rt(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(o){i.once&&n.removeEventListener(e,r),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Ut=Se.exports;const ce="pc-uploader-iframe-wrapper",Re="pc-uploader-iframe";class Ot{constructor(e){if(x(this,R),x(this,ke),x(this,Me),x(this,J,void 0),x(this,B,void 0),x(this,j,void 0),x(this,G,void 0),x(this,Y,void 0),x(this,Q,void 0),D(this,J,e.token),D(this,B,e.sideId||e.productId),D(this,Q,e.productId?"product":"side"),D(this,j,e.uploaderUrl?e.uploaderUrl:"https://upload-tool.pages.dev"),D(this,G,new Ut),D(this,Y,e.locale),!w(this,J)||!w(this,B)){console.warn("Missing Config Params.");return}S(this,ke,ze).call(this),S(this,Me,Xe).call(this)}get locale(){return w(this,Y)}open(){let e=document.getElementById(ce),t=document.getElementById(Re);const i=new URL(w(this,j));if(i.searchParams.set("token",w(this,J)),w(this,Q)==="side"?i.searchParams.set("sideId",w(this,B)):w(this,Q)==="product"&&i.searchParams.set("productId",w(this,B)),i.searchParams.set("parentUrl",window.location.href),!t||!(t instanceof HTMLIFrameElement)||!e){console.warn("Can not find iframe element.");return}t.src=i.href,e.style.opacity="1",e.style.visibility="visible",S(this,R,F).call(this,"open")}close(){let e=document.getElementById(ce);if(!e){console.error("Can not find iframe element");return}e.style.opacity="0",e.style.visibility="hidden"}on(e,t){return w(this,G).on(e,t),this}}J=new WeakMap,B=new WeakMap,j=new WeakMap,G=new WeakMap,Y=new WeakMap,Q=new WeakMap,R=new WeakSet,F=function(n,...e){w(this,G).emit(n,...e)},ke=new WeakSet,ze=function(){let n=document.createElement("div");n.id=ce,n.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";let e=document.createElement("iframe");e.id=Re,e.width="100%",e.height="100%",e.style.borderWidth="0",n.appendChild(e),document.body.appendChild(n)},Me=new WeakSet,Xe=function(){let n=document.getElementById(ce);window.addEventListener("message",e=>{var t;const i=new URL(e.origin),r=new URL(w(this,j));if(i.host===r.host){e.data.uploaderEvent==="close"&&n&&(n.style.opacity="0",n.style.visibility="hidden",S(this,R,F).call(this,"close")),e.data.uploaderEvent==="upload-success"&&S(this,R,F).call(this,"upload-success",e.data.data),e.data.uploaderEvent==="upload-error"&&S(this,R,F).call(this,"upload-error",e.data.error);const o=w(this,Y),s=document.getElementById(Re);s&&s instanceof HTMLIFrameElement&&(S(this,R,F).call(this,"onload"),o&&e.data.uploaderEvent==="loaded"&&e.data.finished&&(console.log("test"),s.focus(),(t=s.contentWindow)==null||t.postMessage({locale:o},w(this,j))))}},!1)};var Bt="";class Nt{constructor(e,t,i,r){g(this,de);g(this,le);g(this,U);g(this,ue);g(this,pe);g(this,fe);g(this,he);g(this,ve);g(this,me);g(this,ge);g(this,ye);g(this,_e);g(this,we);g(this,Le);g(this,Ee);g(this,q,void 0);M(this,"token");M(this,"eventName");M(this,"productIdPrintcart");M(this,"productIdWix");M(this,"orderIdWix");M(this,"orderNumberWix");M(this,"options");g(this,ee,void 0);g(this,_,void 0);g(this,L,void 0);g(this,P,void 0);if(this.token=y(this,ge,ft).call(this),this.eventName=e,this.productIdPrintcart=null,this.productIdWix=t,this.orderIdWix=i,this.orderNumberWix=r,O(this,P,null),this.options=window.PrintcartDesignerShopifyOptions,O(this,q,{}.VITE_API_URL?{}.VITE_API_URL:"https://api.printcart.com/v1"),O(this,ee,{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),this.eventName==="productPageLoaded"||this.eventName==="CustomizeProduct"){if(O(this,P,document.querySelector("[data-hook='product-options']")),!c(this,P))throw new Error("This script can only be used inside a Wix Product Page.");if(!this.productIdWix)throw new Error("Can not find product ID WIX");y(this,we,mt).call(this).then(o=>{var v,E;if(this.productIdPrintcart=(v=o==null?void 0:o.data)==null?void 0:v.id,!this.productIdPrintcart)throw new Error("Can not find product ID Printcart");y(this,_e,vt).call(this),y(this,Le,gt).call(this),y(this,de,st).call(this),y(this,ue,at).call(this),y(this,pe,ct).call(this);const s=document.querySelector("button#pc-btn"),a=o.data.enable_design,f=o.data.enable_upload;a&&(O(this,_,new xt({token:this.token,productId:this.productIdPrintcart,options:{...(E=this.options)==null?void 0:E.designerOptions,designerUrl:c(this,ee)}})),y(this,me,pt).call(this),s&&s instanceof HTMLButtonElement&&(s.disabled=!1)),f&&(O(this,L,new Ot({token:this.token,productId:this.productIdPrintcart})),y(this,ve,ut).call(this),s&&s instanceof HTMLButtonElement&&(s.disabled=!1));const m=()=>{c(this,_)&&!c(this,L)&&c(this,_).render(),!c(this,_)&&c(this,L)&&c(this,L).open(),c(this,_)&&c(this,L)&&y(this,le,ot).call(this)};s&&s instanceof HTMLButtonElement&&(s.onclick=m)})}if(this.eventName==="Purchase"){if(!localStorage.getItem("pc-design-ids"))return;const o=localStorage.getItem("pc-design-ids");if(!this.orderIdWix)throw new Error("Can not find order ID WIX");if(!this.orderNumberWix)throw new Error("Can not find order number WIX");if(!o)throw new Error("Can not find design Ids");y(this,Ee,yt).call(this,this.orderNumberWix,this.orderIdWix,JSON.parse(o))}}}return q=new WeakMap,ee=new WeakMap,_=new WeakMap,L=new WeakMap,P=new WeakMap,de=new WeakSet,st=function(){const i=`
var At=Object.defineProperty;var Dt=(p,d,h)=>d in p?At(p,d,{enumerable:!0,configurable:!0,writable:!0,value:h}):p[d]=h;var M=(p,d,h)=>(Dt(p,typeof d!="symbol"?d+"":d,h),h),Oe=(p,d,h)=>{if(!d.has(p))throw TypeError("Cannot "+h)};var c=(p,d,h)=>(Oe(p,d,"read from private field"),h?h.call(p):d.get(p)),g=(p,d,h)=>{if(d.has(p))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(p):d.set(p,h)},U=(p,d,h,N)=>(Oe(p,d,"write to private field"),N?N.call(p,h):d.set(p,h),h);var y=(p,d,h)=>(Oe(p,d,"access private method"),h);(function(p,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d():typeof define=="function"&&define.amd?define(d):(p=typeof globalThis!="undefined"?globalThis:p||self,p.PrintcartDesignerWix=d())})(this,function(){var q,te,_,L,P,de,st,le,ot,k,z,ue,at,pe,ct,fe,dt,he,lt,ve,ut,me,pt,ge,ft,ye,ht,_e,vt,we,mt,Le,gt,Ee,yt;"use strict";var p=Object.defineProperty,d=(n,e,t)=>e in n?p(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,h=(n,e,t)=>(d(n,typeof e!="symbol"?e+"":e,t),t),N=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},X=(n,e,t)=>(N(n,e,"read from private field"),t?t.call(n):e.get(n)),W=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Ue=(n,e,t,i)=>(N(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),b=(n,e,t)=>(N(n,e,"access private method"),t),$,J,Ie,Ne,Ce,We,ne,xe,I,C,Pe={exports:{}},A=typeof Reflect=="object"?Reflect:null,$e=A&&typeof A.apply=="function"?A.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},ie;A&&typeof A.ownKeys=="function"?ie=A.ownKeys:Object.getOwnPropertySymbols?ie=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ie=function(e){return Object.getOwnPropertyNames(e)};function _t(n){console&&console.warn&&console.warn(n)}var Ae=Number.isNaN||function(e){return e!==e};function l(){l.init.call(this)}Pe.exports=l,Pe.exports.once=bt,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var De=10;function re(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return De},set:function(n){if(typeof n!="number"||n<0||Ae(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");De=n}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ae(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Be(n){return n._maxListeners===void 0?l.defaultMaxListeners:n._maxListeners}l.prototype.getMaxListeners=function(){return Be(this)},l.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")$e(f,this,t);else for(var m=f.length,v=Ke(f,m),i=0;i<m;++i)$e(v[i],this,t);return!0};function je(n,e,t,i){var r,o,s;if(re(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),s=o[e]),s===void 0)s=o[e]=t,++n._eventsCount;else if(typeof s=="function"?s=o[e]=i?[t,s]:[s,t]:i?s.unshift(t):s.push(t),r=Be(n),r>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=s.length,_t(a)}return n}l.prototype.addListener=function(e,t){return je(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return je(this,e,t,!0)};function wt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Fe(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=wt.bind(i);return r.listener=t,i.wrapFn=r,r}l.prototype.once=function(e,t){return re(t),this.on(e,Fe(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return re(t),this.prependListener(e,Fe(this,e,t)),this},l.prototype.removeListener=function(e,t){var i,r,o,s,a;if(re(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():Lt(i,o),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r<o.length;++r)s=o[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function He(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?Et(r):Ke(r,r.length)}l.prototype.listeners=function(e){return He(this,e,!0)},l.prototype.rawListeners=function(e){return He(this,e,!1)},l.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):qe.call(n,e)},l.prototype.listenerCount=qe;function qe(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?ie(this._events):[]};function Ke(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function Lt(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Et(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function bt(n,e){return new Promise(function(t,i){function r(s){n.removeListener(e,o),i(s)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}Ve(n,e,o,{once:!0}),e!=="error"&&It(n,r,{once:!0})})}function It(n,e,t){typeof n.on=="function"&&Ve(n,"error",e,t)}function Ve(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(o){i.once&&n.removeEventListener(e,r),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Ct=Pe.exports;const Z="pc-designer-iframe-wrapper",se="pc-designer-iframe";class xt{constructor(e){W(this,Ie),W(this,Ce),W(this,ne),W(this,I),h(this,"token"),h(this,"productId"),h(this,"options"),W(this,$,void 0),W(this,J,void 0);var t;if(this.token=e.token,this.productId=e.productId,this.options=e.options,Ue(this,$,(t=this.options)!=null&&t.designerUrl?this.options.designerUrl:{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),Ue(this,J,new Ct),!this.token||!this.productId){console.error("Missing Config Params");return}b(this,Ie,Ne).call(this),b(this,Ce,We).call(this)}render(){const e=document.getElementById(Z),t=document.getElementById(se);if(!t||!(t instanceof HTMLIFrameElement)||!e){console.error("Can not find iframe element");return}const i=b(this,ne,xe).call(this);t.src=i.href,e.style.opacity="1",e.style.visibility="visible",b(this,I,C).call(this,"rendered")}close(){const e=document.getElementById(Z);if(!e){console.error("Can not find iframe element");return}e.style.opacity="0",e.style.visibility="hidden",b(this,I,C).call(this,"closed")}editDesign(e){const t=b(this,ne,xe).call(this);t.searchParams.set("design_id",e),t.searchParams.set("task","edit");const i=document.getElementById(Z),r=document.getElementById(se);if(!r||!(r instanceof HTMLIFrameElement)||!i){console.error("Can not find iframe element");return}r.src=t.href,i.style.opacity="1",i.style.visibility="visible",b(this,I,C).call(this,"edit")}on(e,t){return X(this,J).on(e,t),this}}$=new WeakMap,J=new WeakMap,Ie=new WeakSet,Ne=function(){const n=document.createElement("div");n.id=Z,n.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";const e=document.createElement("iframe");e.id=se,e.width="100%",e.height="100%",n.appendChild(e),document.body.appendChild(n)},Ce=new WeakSet,We=function(){window.addEventListener("message",n=>{if(n.origin===X(this,$)&&n.data.message==="closeDesignTool"){const e=document.getElementById(Z);if(!e)return;e.style.opacity="0",e.style.visibility="hidden",b(this,I,C).call(this,"closed")}if(n.data.message==="finishLoad"){const e=document.getElementById(se);b(this,I,C).call(this,"render-finish"),e&&e instanceof HTMLIFrameElement&&e.contentWindow&&e.contentWindow.postMessage({message:"customSettings",settings:this.options},X(this,$))}n.data.message==="finishProcess"&&b(this,I,C).call(this,"upload-success",n.data.data.data),n.data.message==="finishUpdate"&&b(this,I,C).call(this,"edit-success",n.data.data.data),n.data.message==="uploadError"&&b(this,I,C).call(this,"upload-error",n.data)},!1)},ne=new WeakSet,xe=function(){const n=new URL(X(this,$));return n.searchParams.set("api_key",this.token),n.searchParams.set("product_id",this.productId),n.searchParams.set("parentUrl",window.location.href),n},I=new WeakSet,C=function(n,...e){X(this,J).emit(n,...e)};var Te=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},w=(n,e,t)=>(Te(n,e,"read from private field"),t?t.call(n):e.get(n)),x=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},D=(n,e,t,i)=>(Te(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),R=(n,e,t)=>(Te(n,e,"access private method"),t),G,B,j,Y,Q,ee,O,F,Se,ze,ke,Xe,Me={exports:{}},H=typeof Reflect=="object"?Reflect:null,Je=H&&typeof H.apply=="function"?H.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},oe;H&&typeof H.ownKeys=="function"?oe=H.ownKeys:Object.getOwnPropertySymbols?oe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:oe=function(e){return Object.getOwnPropertyNames(e)};function Pt(n){console&&console.warn&&console.warn(n)}var Ze=Number.isNaN||function(e){return e!==e};function u(){u.init.call(this)}Me.exports=u,Me.exports.once=Mt,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var Ge=10;function ae(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return Ge},set:function(n){if(typeof n!="number"||n<0||Ze(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");Ge=n}}),u.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ze(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Ye(n){return n._maxListeners===void 0?u.defaultMaxListeners:n._maxListeners}u.prototype.getMaxListeners=function(){return Ye(this)},u.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")Je(f,this,t);else for(var m=f.length,v=it(f,m),i=0;i<m;++i)Je(v[i],this,t);return!0};function Qe(n,e,t,i){var r,o,s;if(ae(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),s=o[e]),s===void 0)s=o[e]=t,++n._eventsCount;else if(typeof s=="function"?s=o[e]=i?[t,s]:[s,t]:i?s.unshift(t):s.push(t),r=Ye(n),r>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=s.length,Pt(a)}return n}u.prototype.addListener=function(e,t){return Qe(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return Qe(this,e,t,!0)};function Tt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function et(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=Tt.bind(i);return r.listener=t,i.wrapFn=r,r}u.prototype.once=function(e,t){return ae(t),this.on(e,et(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return ae(t),this.prependListener(e,et(this,e,t)),this},u.prototype.removeListener=function(e,t){var i,r,o,s,a;if(ae(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():St(i,o),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r<o.length;++r)s=o[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function tt(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?kt(r):it(r,r.length)}u.prototype.listeners=function(e){return tt(this,e,!0)},u.prototype.rawListeners=function(e){return tt(this,e,!1)},u.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):nt.call(n,e)},u.prototype.listenerCount=nt;function nt(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}u.prototype.eventNames=function(){return this._eventsCount>0?oe(this._events):[]};function it(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function St(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function kt(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Mt(n,e){return new Promise(function(t,i){function r(s){n.removeListener(e,o),i(s)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}rt(n,e,o,{once:!0}),e!=="error"&&Rt(n,r,{once:!0})})}function Rt(n,e,t){typeof n.on=="function"&&rt(n,"error",e,t)}function rt(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(o){i.once&&n.removeEventListener(e,r),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Ot=Me.exports;const ce="pc-uploader-iframe-wrapper",Re="pc-uploader-iframe";class Ut{constructor(e){if(x(this,O),x(this,Se),x(this,ke),x(this,G,void 0),x(this,B,void 0),x(this,j,void 0),x(this,Y,void 0),x(this,Q,void 0),x(this,ee,void 0),D(this,G,e.token),D(this,B,e.sideId||e.productId),D(this,ee,e.productId?"product":"side"),D(this,j,e.uploaderUrl?e.uploaderUrl:"https://upload-tool.pages.dev"),D(this,Y,new Ot),D(this,Q,e.locale),!w(this,G)||!w(this,B)){console.warn("Missing Config Params.");return}R(this,Se,ze).call(this),R(this,ke,Xe).call(this)}get locale(){return w(this,Q)}open(){let e=document.getElementById(ce),t=document.getElementById(Re);const i=new URL(w(this,j));if(i.searchParams.set("token",w(this,G)),w(this,ee)==="side"?i.searchParams.set("sideId",w(this,B)):w(this,ee)==="product"&&i.searchParams.set("productId",w(this,B)),i.searchParams.set("parentUrl",window.location.href),!t||!(t instanceof HTMLIFrameElement)||!e){console.warn("Can not find iframe element.");return}t.src=i.href,e.style.opacity="1",e.style.visibility="visible",R(this,O,F).call(this,"open")}close(){let e=document.getElementById(ce);if(!e){console.error("Can not find iframe element");return}e.style.opacity="0",e.style.visibility="hidden"}on(e,t){return w(this,Y).on(e,t),this}}G=new WeakMap,B=new WeakMap,j=new WeakMap,Y=new WeakMap,Q=new WeakMap,ee=new WeakMap,O=new WeakSet,F=function(n,...e){w(this,Y).emit(n,...e)},Se=new WeakSet,ze=function(){let n=document.createElement("div");n.id=ce,n.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";let e=document.createElement("iframe");e.id=Re,e.width="100%",e.height="100%",e.style.borderWidth="0",n.appendChild(e),document.body.appendChild(n)},ke=new WeakSet,Xe=function(){let n=document.getElementById(ce);window.addEventListener("message",e=>{var t;const i=new URL(e.origin),r=new URL(w(this,j));if(i.host===r.host){e.data.uploaderEvent==="close"&&n&&(n.style.opacity="0",n.style.visibility="hidden",R(this,O,F).call(this,"close")),e.data.uploaderEvent==="upload-success"&&R(this,O,F).call(this,"upload-success",e.data.data),e.data.uploaderEvent==="upload-error"&&R(this,O,F).call(this,"upload-error",e.data.error);const o=w(this,Q),s=document.getElementById(Re);s&&s instanceof HTMLIFrameElement&&(R(this,O,F).call(this,"onload"),o&&e.data.uploaderEvent==="loaded"&&e.data.finished&&(console.log("test"),s.focus(),(t=s.contentWindow)==null||t.postMessage({locale:o},w(this,j))))}},!1)};var Bt="";class Nt{constructor(e,t,i,r){g(this,de);g(this,le);g(this,k);g(this,ue);g(this,pe);g(this,fe);g(this,he);g(this,ve);g(this,me);g(this,ge);g(this,ye);g(this,_e);g(this,we);g(this,Le);g(this,Ee);g(this,q,void 0);M(this,"token");M(this,"eventName");M(this,"productIdPrintcart");M(this,"productIdWix");M(this,"orderIdWix");M(this,"orderNumberWix");M(this,"options");g(this,te,void 0);g(this,_,void 0);g(this,L,void 0);g(this,P,void 0);if(this.token=y(this,ge,ft).call(this),this.eventName=e,this.productIdPrintcart=null,this.productIdWix=t,this.orderIdWix=i,this.orderNumberWix=r,U(this,P,null),this.options=window.PrintcartDesignerShopifyOptions,U(this,q,{}.VITE_API_URL?{}.VITE_API_URL:"https://api.printcart.com/v1"),U(this,te,{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),this.eventName==="productPageLoaded"||this.eventName==="CustomizeProduct"){if(U(this,P,document.querySelector("[data-hook='product-options']")),!c(this,P))throw new Error("This script can only be used inside a Wix Product Page.");if(!this.productIdWix)throw new Error("Can not find product ID WIX");y(this,we,mt).call(this).then(o=>{var v,E;if(this.productIdPrintcart=(v=o==null?void 0:o.data)==null?void 0:v.id,!this.productIdPrintcart)throw new Error("Can not find product ID Printcart");y(this,_e,vt).call(this),y(this,Le,gt).call(this),y(this,de,st).call(this),y(this,ue,at).call(this),y(this,pe,ct).call(this);const s=document.querySelector("button#pc-btn"),a=o.data.enable_design,f=o.data.enable_upload;a&&(U(this,_,new xt({token:this.token,productId:this.productIdPrintcart,options:{...(E=this.options)==null?void 0:E.designerOptions,designerUrl:c(this,te)}})),y(this,me,pt).call(this),s&&s instanceof HTMLButtonElement&&(s.disabled=!1)),f&&(U(this,L,new Ut({token:this.token,productId:this.productIdPrintcart})),y(this,ve,ut).call(this),s&&s instanceof HTMLButtonElement&&(s.disabled=!1));const m=()=>{c(this,_)&&!c(this,L)&&c(this,_).render(),!c(this,_)&&c(this,L)&&c(this,L).open(),c(this,_)&&c(this,L)&&y(this,le,ot).call(this)};s&&s instanceof HTMLButtonElement&&(s.onclick=m)})}if(this.eventName==="Purchase"){if(!localStorage.getItem("pc-design-ids"))return;const o=localStorage.getItem("pc-design-ids");if(!this.orderIdWix)throw new Error("Can not find order ID WIX");if(!this.orderNumberWix)throw new Error("Can not find order number WIX");if(!o)throw new Error("Can not find design Ids");y(this,Ee,yt).call(this,this.orderNumberWix,this.orderIdWix,JSON.parse(o))}}}return q=new WeakMap,te=new WeakMap,_=new WeakMap,L=new WeakMap,P=new WeakMap,de=new WeakSet,st=function(){const i=`
<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button>
<div id="pc-select_header">Choose a way to design this product</div>
<div id="pc-select_container">
<button class="pc-select_btn" id="pc-select_btn_upload">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<img src="https://files.printcart.com/common/upload.svg" alt="Printcart Uploader" />
</div>
<div class="pc-select_btn_content">
<h2>Upload a full design</h2>
<ul>
<li>Have a complete design</li>
<li>Have your own designer</li>
</ul>
</div>
<div class="pc-select-wrap" id="pc-content-overlay">
<div class="pc-select-inner">
<div id="pc-select_header">Choose a way to design this product</div>
<div id="pc-select_container">
<button class="pc-select_btn" id="pc-select_btn_upload">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<div class="pc-select_btn_img_inner">
<img src="https://files.printcart.com/common/upload.svg" alt="Printcart Uploader" />
</div>
</div>
<div class="pc-select_btn_content">
<div class="pc-select_btn_content_inner">
<h2 class="pc-title">Upload a full design</h2>
<ul>
<li>Have a complete design</li>
<li>Have your own designer</li>
</ul>
</div>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
<button class="pc-select_btn" id="pc-select_btn_design">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<div class="pc-select_btn_img_inner">
<img src="https://files.printcart.com/common/design.svg" alt="Printcart Designer" />
</div>
</div>
<div class="pc-select_btn_content">
<div class="pc-select_btn_content_inner">
<h2 class="pc-title">Design here online</h2>
<ul>
<li>Already have your concept</li>
<li>Customize every details</li>
</ul>
</div>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
<button class="pc-select_btn" id="pc-select_btn_design">
<div aria-hidden="true" class="pc-select_btn_wrap">
<div class="pc-select_btn_img">
<img src="https://files.printcart.com/common/design.svg" alt="Printcart Designer" />
</div>
<div class="pc-select_btn_content">
<h2>Design here online</h2>
<ul>
<li>Already have your concept</li>
<li>Customize every details</li>
</ul>
</div>
</div>
<div class="visually-hidden">Upload Design file</div>
</button>
</div>
</div>
`,r=document.createElement("div");r.id="pc-select_wrap",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("tabIndex","-1"),r.innerHTML=i,document.body.appendChild(r);const o=()=>{c(this,_)&&(y(this,U,te).call(this),c(this,_).render())},s=()=>{c(this,L)&&(y(this,U,te).call(this),c(this,L).open())},a=document.getElementById("pc-select_btn_upload"),f=document.getElementById("pc-select_btn_design");a&&(a==null||a.addEventListener("click",s)),f&&(f==null||f.addEventListener("click",o))},le=new WeakSet,ot=function(){const e=document.getElementById("pc-select_wrap");e&&(e.style.display="flex",document.body.classList.toggle("pc-overflow"));const t=e==null?void 0:e.querySelector("#pc-select_close-btn");t&&t instanceof HTMLButtonElement&&t.focus()},U=new WeakSet,te=function(){const e=document.getElementById("pc-select_wrap");e&&(e.style.display="none",document.body.classList.toggle("pc-overflow"))},ue=new WeakSet,at=function(){const e=document.getElementById("pc-select_close-btn"),t=i=>{i.key==="Escape"&&y(this,U,te).call(this)};window.addEventListener("keydown",t),e==null||e.addEventListener("click",()=>y(this,U,te).call(this))},pe=new WeakSet,ct=function(){const e=document.getElementById("pc-select_wrap"),t=e==null?void 0:e.querySelectorAll("button"),i=t&&t[0],r=t&&t[t.length-1],o=s=>{s.key==="Tab"&&(s.shiftKey?r&&document.activeElement===i&&(r.focus(),s.preventDefault()):i&&document.activeElement===r&&(i.focus(),s.preventDefault()))};window.addEventListener("keydown",o)},fe=new WeakSet,dt=function(e){var a,f;const t=e.map(m=>m.data.id);let i=document.querySelector('input[name="properties[_pcDesignIds]"]');i?i.value+=`,${t.join()}`:(i=document.createElement("input"),i.type="hidden",i.name="properties[_pcDesignIds]",i.className="pc-designer_input",i.value=t.join(),(a=c(this,P))==null||a.appendChild(i));const r=document.querySelector(".pc-preview-wrap")||document.createElement("div");r.className="pc-preview-wrap",e.forEach(m=>{var K;if(!m.data.design_image.url)return;const v=document.createElement("div");v.className="pc-preview",v.setAttribute("data-pc-design-id",m.data.id);const E=document.createElement("button");E.className="pc-btn pc-danger-btn",E.innerHTML=(K=this.options)!=null&&K.removeUploaderBtnText?this.options.removeUploaderBtnText:"Remove",E.onclick=()=>{const V=i.value.split(",").filter(be=>be!==m.data.id);i.value=V.join(),v.remove()};const T=document.createElement("img");T.src=m.data.design_image.url,T.className="pc-uploader-image";const k=document.createElement("div");k.className="pc-preview-overlay",k.appendChild(E),v.appendChild(k),v.appendChild(T),r.appendChild(v)});const o=document.querySelector("div#pc-designer_wrap");if(!document.querySelector(".princart-preview-heading")){const m=document.createElement("h5");m.className="princart-preview-heading",m.innerHTML="Your artworks",o==null||o.appendChild(m)}o==null||o.appendChild(r);const s=(f=this.options)==null?void 0:f.onUploadSuccess;s&&s(e,c(this,L))},he=new WeakSet,lt=function(e){var f,m;const t=this,i=e.map(v=>v.id);let r=document.querySelector('input[name="properties[_pcDesignIds]"]');r?r.value+=`,${i.join()}`:(r=document.createElement("input"),r.type="hidden",r.name="properties[_pcDesignIds]",r.className="pc-designer_input",r.value=i.join(),(f=c(this,P))==null||f.appendChild(r));const o=document.querySelector(".pc-preview-wrap")||document.createElement("div");o.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(i)),e.forEach(v=>{var be;if(!v.design_image.url)return;const E=document.createElement("div");E.className="pc-preview",E.setAttribute("data-pc-design-id",v.id);const T=document.createElement("button");T.className="pc-btn pc-primary-btn",T.style.borderRadius="5px",T.innerHTML="Edit",T.onclick=()=>{c(t,_).editDesign(v.id)};const k=document.createElement("button");k.className="pc-btn pc-danger-btn",k.style.borderRadius="5px",k.innerHTML="Remove",k.onclick=()=>{const Wt=r.value.split(",").filter($t=>$t!==v.id);r.value=Wt.join(),E.remove()};const K=document.createElement("img");K.src=((be=v.preview_image)==null?void 0:be.url)||v.design_image.url,K.className="pc-uploader-image";const V=document.createElement("div");V.className="pc-preview-overlay",V.appendChild(T),V.appendChild(k),E.appendChild(V),E.appendChild(K),o.appendChild(E)});const s=document.querySelector("div#pc-designer_wrap");s==null||s.appendChild(o);const a=(m=this.options)==null?void 0:m.onDesignCreateSuccess;a&&a(e,c(this,_))},ve=new WeakSet,ut=function(){c(this,L)&&c(this,L).on("upload-success",e=>{y(this,fe,dt).call(this,e),c(this,L).close()})},me=new WeakSet,pt=function(){c(this,_)&&(c(this,_).on("upload-success",e=>{y(this,he,lt).call(this,e),c(this,_).close()}),c(this,_).on("edit-success",e=>{var r;if(!e.design_image.url)return;const t=document.querySelector(`[data-pc-design-id="${e.id}"] img`);if(!t||!(t instanceof HTMLImageElement))throw new Error("Can't find image element");t.src=e.design_image.url;const i=(r=this.options)==null?void 0:r.onDesignEditSuccess;c(this,_).close(),i&&i(e,c(this,_))}))},ge=new WeakSet,ft=function(){const e=y(this,ye,ht).call(this),t=new URL(e);return new URLSearchParams(t.search).get("shopT")},ye=new WeakSet,ht=function(){return document.querySelector("[id='pc-wix-integration-sdk']").src},_e=new WeakSet,vt=function(){const e={}.VITE_SDK_URL?{}.VITE_SDK_URL:"https://unpkg.com/@printcart/shopify-integration/dist",t=document.createElement("link");t.rel="stylesheet",t.href=`${e}/style.css`,document.head.appendChild(t)},we=new WeakSet,mt=async function(){try{const e=`${c(this,q)}/integration/wix/products/${this.productIdWix}`,t=this.token;if(!t)throw new Error("Missing Printcart Unauth Token");return await(await fetch(e,{headers:{"X-PrintCart-Unauth-Token":t}})).json()}catch(e){console.error("There has been a problem with your fetch operation:",e);return}},Le=new WeakSet,gt=function(){var r;const e=c(this,P);if(!(e!=null&&e.parentNode)){console.log("Can not find cart form");return}if(document.getElementById("pc-designer_wrap")!==null)return;const t=document.createElement("div");t.id="pc-designer_wrap";const i=document.createElement("button");i.id="pc-btn",i.className="button CoreButtonNext3690398815__root Focusable4066241217__root Button3176414074__root StatesButton3612784068__root _36nLbs",i.innerHTML=(r=this.options)!=null&&r.designBtnText?this.options.designBtnText:"Start Design",i.style.marginTop="1.8rem",i.disabled=!0,t.appendChild(i),e.appendChild(t)},Ee=new WeakSet,yt=async function(e,t,i){try{const r=`${c(this,q)}/projects`,o=this.token;if(!o)throw new Error("Missing Printcart Unauth Token");const s={name:`${e}`,status:"processing",design_ids:i,order_detail:{id:t}};await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-PrintCart-Unauth-Token":o},body:JSON.stringify(s)})}catch(r){console.error("There has been a problem with your fetch operation:",r);return}},Nt});
`,r=document.createElement("div");r.id="pc-select_wrap",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("tabIndex","-1"),r.innerHTML=i,document.body.appendChild(r);const o=()=>{c(this,_)&&(y(this,k,z).call(this),c(this,_).render())},s=()=>{c(this,L)&&(y(this,k,z).call(this),c(this,L).open())},a=document.getElementById("pc-select_btn_upload"),f=document.getElementById("pc-select_btn_design");a&&(a==null||a.addEventListener("click",s)),f&&(f==null||f.addEventListener("click",o))},le=new WeakSet,ot=function(){const e=document.getElementById("pc-select_wrap");e&&(e.style.display="flex",document.body.classList.toggle("pc-overflow"));const t=e==null?void 0:e.querySelector("#pc-select_close-btn");t&&t instanceof HTMLButtonElement&&t.focus()},k=new WeakSet,z=function(){const e=document.getElementById("pc-select_wrap");e&&(e.style.display="none",document.body.classList.toggle("pc-overflow"))},ue=new WeakSet,at=function(){const e=document.getElementById("pc-select_close-btn"),t=document.getElementById("pc-content-overlay"),i=r=>{r.key==="Escape"&&y(this,k,z).call(this)};window.addEventListener("keydown",i),e==null||e.addEventListener("click",()=>y(this,k,z).call(this)),t==null||t.addEventListener("click",()=>y(this,k,z).call(this))},pe=new WeakSet,ct=function(){const e=document.getElementById("pc-select_wrap"),t=e==null?void 0:e.querySelectorAll("button"),i=t&&t[0],r=t&&t[t.length-1],o=s=>{s.key==="Tab"&&(s.shiftKey?r&&document.activeElement===i&&(r.focus(),s.preventDefault()):i&&document.activeElement===r&&(i.focus(),s.preventDefault()))};window.addEventListener("keydown",o)},fe=new WeakSet,dt=function(e){var a,f;const t=e.map(m=>m.data.id);let i=document.querySelector('input[name="properties[_pcDesignIds]"]');i?i.value+=`,${t.join()}`:(i=document.createElement("input"),i.type="hidden",i.name="properties[_pcDesignIds]",i.className="pc-designer_input",i.value=t.join(),(a=c(this,P))==null||a.appendChild(i));const r=document.querySelector(".pc-preview-wrap")||document.createElement("div");r.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(t)),e.forEach(m=>{var K;if(!m.data.design_image.url)return;const v=document.createElement("div");v.className="pc-preview",v.setAttribute("data-pc-design-id",m.data.id);const E=document.createElement("button");E.className="pc-btn pc-danger-btn",E.innerHTML=(K=this.options)!=null&&K.removeUploaderBtnText?this.options.removeUploaderBtnText:"Remove",E.onclick=()=>{const V=i.value.split(",").filter(be=>be!==m.data.id);i.value=V.join(),v.remove()};const T=document.createElement("img");T.src=m.data.design_image.url,T.className="pc-uploader-image";const S=document.createElement("div");S.className="pc-preview-overlay",S.appendChild(E),v.appendChild(S),v.appendChild(T),r.appendChild(v)});const o=document.querySelector("div#pc-designer_wrap");if(!document.querySelector(".princart-preview-heading")){const m=document.createElement("h5");m.className="princart-preview-heading",m.innerHTML="Your artworks",o==null||o.appendChild(m)}o==null||o.appendChild(r);const s=(f=this.options)==null?void 0:f.onUploadSuccess;s&&s(e,c(this,L))},he=new WeakSet,lt=function(e){var f,m;const t=this,i=e.map(v=>v.id);let r=document.querySelector('input[name="properties[_pcDesignIds]"]');r?r.value+=`,${i.join()}`:(r=document.createElement("input"),r.type="hidden",r.name="properties[_pcDesignIds]",r.className="pc-designer_input",r.value=i.join(),(f=c(this,P))==null||f.appendChild(r));const o=document.querySelector(".pc-preview-wrap")||document.createElement("div");o.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(i)),e.forEach(v=>{var be;if(!v.design_image.url)return;const E=document.createElement("div");E.className="pc-preview",E.setAttribute("data-pc-design-id",v.id);const T=document.createElement("button");T.className="pc-btn pc-primary-btn",T.style.borderRadius="5px",T.innerHTML="Edit",T.onclick=()=>{c(t,_).editDesign(v.id)};const S=document.createElement("button");S.className="pc-btn pc-danger-btn",S.style.borderRadius="5px",S.innerHTML="Remove",S.onclick=()=>{const Wt=r.value.split(",").filter($t=>$t!==v.id);r.value=Wt.join(),E.remove()};const K=document.createElement("img");K.src=((be=v.preview_image)==null?void 0:be.url)||v.design_image.url,K.className="pc-uploader-image";const V=document.createElement("div");V.className="pc-preview-overlay",V.appendChild(T),V.appendChild(S),E.appendChild(V),E.appendChild(K),o.appendChild(E)});const s=document.querySelector("div#pc-designer_wrap");s==null||s.appendChild(o);const a=(m=this.options)==null?void 0:m.onDesignCreateSuccess;a&&a(e,c(this,_))},ve=new WeakSet,ut=function(){c(this,L)&&c(this,L).on("upload-success",e=>{y(this,fe,dt).call(this,e),c(this,L).close()})},me=new WeakSet,pt=function(){c(this,_)&&(c(this,_).on("upload-success",e=>{y(this,he,lt).call(this,e),c(this,_).close()}),c(this,_).on("edit-success",e=>{var r;if(!e.design_image.url)return;const t=document.querySelector(`[data-pc-design-id="${e.id}"] img`);if(!t||!(t instanceof HTMLImageElement))throw new Error("Can't find image element");t.src=e.design_image.url;const i=(r=this.options)==null?void 0:r.onDesignEditSuccess;c(this,_).close(),i&&i(e,c(this,_))}))},ge=new WeakSet,ft=function(){const e=y(this,ye,ht).call(this),t=new URL(e);return new URLSearchParams(t.search).get("shopT")},ye=new WeakSet,ht=function(){return document.querySelector("[id='pc-wix-integration-sdk']").src},_e=new WeakSet,vt=function(){const e={}.VITE_SDK_URL?{}.VITE_SDK_URL:"https://unpkg.com/@printcart/wix-integration/dist",t=document.createElement("link");t.rel="stylesheet",t.href=`${e}/style.css`,document.head.appendChild(t)},we=new WeakSet,mt=async function(){try{const e=`${c(this,q)}/integration/wix/products/${this.productIdWix}`,t=this.token;if(!t)throw new Error("Missing Printcart Unauth Token");return await(await fetch(e,{headers:{"X-PrintCart-Unauth-Token":t}})).json()}catch(e){console.error("There has been a problem with your fetch operation:",e);return}},Le=new WeakSet,gt=function(){var r;const e=c(this,P);if(!(e!=null&&e.parentNode)){console.log("Can not find cart form");return}if(document.getElementById("pc-designer_wrap")!==null)return;const t=document.createElement("div");t.id="pc-designer_wrap";const i=document.createElement("button");i.id="pc-btn",i.className="button CoreButtonNext3690398815__root Focusable4066241217__root Button3176414074__root StatesButton3612784068__root _36nLbs",i.innerHTML=(r=this.options)!=null&&r.designBtnText?this.options.designBtnText:"Start Design",i.style.marginTop="1.8rem",i.disabled=!0,t.appendChild(i),e.appendChild(t)},Ee=new WeakSet,yt=async function(e,t,i){try{const r=`${c(this,q)}/projects`,o=this.token;if(!o)throw new Error("Missing Printcart Unauth Token");const s={name:`${e}`,status:"processing",design_ids:i,order_detail:{id:t}};await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-PrintCart-Unauth-Token":o},body:JSON.stringify(s)})}catch(r){console.error("There has been a problem with your fetch operation:",r);return}},Nt});

@@ -7,3 +7,3 @@ {

],
"version": "1.0.2",
"version": "1.0.3",
"scripts": {

@@ -10,0 +10,0 @@ "dev": "vite --port 3102",

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