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
0
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.1.13 to 1.1.14

68

dist/main.es.js

@@ -29,3 +29,3 @@ var __defProp = Object.defineProperty;

};
var _apiUrl, _designerUrl, _designerInstance, _uploaderInstance, _productForm, _registerListener, registerListener_fn, _initializeProductTools, initializeProductTools_fn, _openSelectModal, openSelectModal_fn, _openModal, openModal_fn, _closeModal, closeModal_fn, _registerCloseModal, registerCloseModal_fn, _modalTrap, modalTrap_fn, _handleUploadSuccess, handleUploadSuccess_fn, _handleDesignSuccess, handleDesignSuccess_fn, _registerUploaderEvents, registerUploaderEvents_fn, _registerDesignerEvents, registerDesignerEvents_fn, _getUnauthToken, getUnauthToken_fn, _getScriptSrc, getScriptSrc_fn, _addStyle, addStyle_fn, _getPrintcartProduct, getPrintcartProduct_fn, _createBtn, createBtn_fn, _createProjectPrintcart, createProjectPrintcart_fn;
var _apiUrl, _designerUrl, _designerInstance, _uploaderInstance, _productForm, _getStoreDetail, getStoreDetail_fn, _registerListener, registerListener_fn, _initializeProductTools, initializeProductTools_fn, _openSelectModal, openSelectModal_fn, _openModal, openModal_fn, _closeModal, closeModal_fn, _registerCloseModal, registerCloseModal_fn, _modalTrap, modalTrap_fn, _handleUploadSuccess, handleUploadSuccess_fn, _handleDesignSuccess, handleDesignSuccess_fn, _registerUploaderEvents, registerUploaderEvents_fn, _registerDesignerEvents, registerDesignerEvents_fn, _getUnauthToken, getUnauthToken_fn, _getScriptSrc, getScriptSrc_fn, _addStyle, addStyle_fn, _getPrintcartProduct, getPrintcartProduct_fn, _createBtn, createBtn_fn, _createProjectPrintcart, createProjectPrintcart_fn;
const PrintcartDesigner = function() {

@@ -580,2 +580,3 @@ var He = Object.defineProperty;

constructor() {
__privateAdd(this, _getStoreDetail);
__privateAdd(this, _registerListener);

@@ -610,2 +611,3 @@ __privateAdd(this, _initializeProductTools);

__publicField(this, "registerListener");
__publicField(this, "textReplace");
this.token = __privateMethod(this, _getUnauthToken, getUnauthToken_fn).call(this);

@@ -617,2 +619,13 @@ this.productIdPC = null;

__privateSet(this, _productForm, null);
this.textReplace = {
start_design: "Start Design",
pc_select_header: "Choose a way to design this product",
upload_a_full_design: "Upload a full design",
upload_design_file: "Upload Design file",
have_a_complete_design: "Have a complete design",
have_your_own_design: "Have your own designer",
design_here_online: "Design here online",
already_have_a_design: "Already have your concept",
customize_every_details: "Customize every details"
};
this.options = window.PrintcartDesignerShopifyOptions;

@@ -636,2 +649,44 @@ __privateSet(this, _apiUrl, "https://api.printcart.com/v1");

_productForm = new WeakMap();
_getStoreDetail = new WeakSet();
getStoreDetail_fn = async function() {
var _a, _b, _c, _d;
try {
const printcartApiUrl = `${__privateGet(this, _apiUrl)}/stores/store-details`;
const token = this.token;
if (!token) {
throw new Error("Missing Printcart Unauth Token");
}
const printcartPromise = await fetch(printcartApiUrl, {
headers: {
"X-PrintCart-Unauth-Token": token
}
});
const storeDetail = await printcartPromise.json();
const cssString = (_b = (_a = storeDetail == null ? void 0 : storeDetail.data) == null ? void 0 : _a.setting_defaults) == null ? void 0 : _b.customCss.value;
const textReplace = (_d = (_c = storeDetail == null ? void 0 : storeDetail.data) == null ? void 0 : _c.setting_defaults) == null ? void 0 : _d.textReplace;
this.textReplace = {
start_design: (textReplace == null ? void 0 : textReplace.start_design) ? textReplace.start_design : "Start Design",
pc_select_header: (textReplace == null ? void 0 : textReplace.pc_select_header) ? textReplace.pc_select_header : "Choose a way to design this product",
upload_a_full_design: (textReplace == null ? void 0 : textReplace.upload_a_full_design) ? textReplace.upload_a_full_design : "Upload a full design",
upload_design_file: (textReplace == null ? void 0 : textReplace.upload_design_file) ? textReplace.upload_design_file : "Upload Design file",
have_a_complete_design: (textReplace == null ? void 0 : textReplace.have_a_complete_design) ? textReplace.have_a_complete_design : "Have a complete design",
have_your_own_design: (textReplace == null ? void 0 : textReplace.have_your_own_design) ? textReplace.have_your_own_design : "Have your own designer",
design_here_online: (textReplace == null ? void 0 : textReplace.design_here_online) ? textReplace.design_here_online : "Design here online",
already_have_a_design: (textReplace == null ? void 0 : textReplace.already_have_a_design) ? textReplace.already_have_a_design : "Already have your concept",
customize_every_details: (textReplace == null ? void 0 : textReplace.customize_every_details) ? textReplace.customize_every_details : "Customize every details"
};
if (cssString) {
const styleElement = document.createElement("style");
styleElement.textContent = cssString;
styleElement.type = "text/css";
document.head.appendChild(styleElement);
}
return storeDetail;
} catch (error) {
console.error(
"There has been a problem with your fetch operation:",
error
);
}
};
_registerListener = new WeakSet();

@@ -689,2 +744,3 @@ registerListener_fn = function(par) {

__privateSet(this, _productForm, document.querySelector("[data-hook='product-options']"));
__privateMethod(this, _getStoreDetail, getStoreDetail_fn).call(this);
if (!__privateGet(this, _productForm)) {

@@ -757,3 +813,3 @@ throw new Error(

const designImgSrc = "https://files.printcart.com/common/design.svg";
const inner = `<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button><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></div>`;
const inner = `<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button><div class="pc-select-wrap" id="pc-content-overlay"><div class="pc-select-inner"><div id="pc-select_header">${this.textReplace.pc_select_header}</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">${this.textReplace.upload_a_full_design}</h2><ul><li>${this.textReplace.have_a_complete_design}</li><li>${this.textReplace.have_your_own_design}</li></ul></div></div></div><div class="visually-hidden">${this.textReplace.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">${this.textReplace.design_here_online}</h2><ul><li>${this.textReplace.already_have_a_design}</li><li>${this.textReplace.customize_every_details}</li></ul></div></div></div><div class="visually-hidden">${this.textReplace.upload_design_file}</div></button></div></div></div>`;
const wrap = document.createElement("div");

@@ -1012,7 +1068,3 @@ wrap.id = "pc-select_wrap";

getUnauthToken_fn = function() {
const src = __privateMethod(this, _getScriptSrc, getScriptSrc_fn).call(this);
const url = new URL(src);
const params = new URLSearchParams(url.search);
const token = params.get("shopT");
return token;
return "1ed23e41e296c45b0c6c9cd722398b90a3cc906301bdebfaac4751cf2df8d06d";
};

@@ -1073,3 +1125,3 @@ _getScriptSrc = new WeakSet();

button.className = ((_a = this.options) == null ? void 0 : _a.designClassName) ? (_b = this.options) == null ? void 0 : _b.designClassName : "";
button.innerHTML = ((_c = this.options) == null ? void 0 : _c.designBtnText) ? this.options.designBtnText : "Start Design";
button.innerHTML = ((_c = this.options) == null ? void 0 : _c.designBtnText) ? this.options.designBtnText : this.textReplace.start_design;
button.disabled = true;

@@ -1076,0 +1128,0 @@ wrap.appendChild(button);

2

dist/main.js

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

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

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

],
"version": "1.1.13",
"version": "1.1.14",
"scripts": {

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

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