(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6ca4348c"],{"1cf3":function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.show?n("div",{ref:"fittingsImgDialog",staticClass:"fittings-img-dialog"},[n("el-card",{staticClass:"fittings-img-dialog-card",attrs:{shadow:"always"}},[n("i",{staticClass:"el-icon-close close cursor-pointer",on:{click:function(e){return e.target!==e.currentTarget?null:t.hiddenDialog.apply(null,arguments)}}}),n("el-row",[n("el-col",{attrs:{span:16}},[n("fittings-img",{attrs:{"bottom-image-url":t.currentCustomizeInfo.bottomImageUrl,height:600,width:600,"logo-url":t.logoUrl,"logo-h":t.currentCustomizeInfo.logoH,"logo-w":t.currentCustomizeInfo.logoW,"logo-x":t.currentCustomizeInfo.logoX,"logo-y":t.currentCustomizeInfo.logoY}})],1),n("el-col",{attrs:{span:8}},[n("el-row",[t._v(" View ")]),n("div",{staticClass:"fittings-imgs"},t._l(t.fittings.customizeInfos,(function(e,a){return n("div",{key:e.bottomImageUrl+t.currentCustomizeInfoIndex,staticClass:"fittings-img",on:{click:function(e){t.currentCustomizeInfoIndex=a}}},[n("fittings-img",{attrs:{"bottom-image-url":e.bottomImageUrl,"logo-url":t.logoUrl,"logo-h":e.logoH,"logo-w":e.logoW,"logo-x":e.logoX,"logo-y":e.logoY}})],1)})),0)],1)],1)],1)],1):t._e()},o=[],i=n("e112"),s={name:"FittingsImgDialog",components:{FittingsImg:i["a"]},props:{show:{type:Boolean,default:!1},fittings:{type:Object,default:null},logoUrl:{type:String,default:null}},data(){return{currentCustomizeInfoIndex:null}},computed:{currentCustomizeInfo(){return null===this.currentCustomizeInfoIndex?null:this.fittings.customizeInfos[this.currentCustomizeInfoIndex]}},watch:{fittings(){this.fittings?this.currentCustomizeInfoIndex=0:this.currentCustomizeInfoIndex=null}},methods:{hiddenDialog(){this.$refs.fittingsImgDialog.className+=" hidden-dialog",setTimeout(()=>{this.$emit("update:show",!1)},500)}}},r=s,c=(n("a156"),n("2877")),l=Object(c["a"])(r,a,o,!1,null,"5181141c",null);e["a"]=l.exports},"1faf":function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"d",(function(){return r}));var a=n("66a5");const o=t=>Object(a["a"])({url:"/shopapi/pay/shopify/application_charge/status",method:"post",data:t}),i=t=>Object(a["a"])({url:"/shopapi/pay/shopify/subscription/change",method:"post",data:t}),s=t=>Object(a["a"])({url:"/shopapi/pay/shopify/subscription/status",method:"post",data:t}),r=t=>Object(a["a"])({url:"/shopapi/pay/subscription/cancel",method:"post",data:t})},"21a6":function(t,e,n){(function(n){var a,o,i;(function(n,s){o=[],a=s,i="function"===typeof a?a.apply(e,o):a,void 0===i||(t.exports=i)})(0,(function(){"use strict";function e(t,e){return"undefined"==typeof e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}function a(t,e,n){var a=new XMLHttpRequest;a.open("GET",t),a.responseType="blob",a.onload=function(){c(a.response,e,n)},a.onerror=function(){console.error("could not download file")},a.send()}function o(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(a){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n&&n.global===n?n:void 0,r=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!r?function(t,e,n){var r=s.URL||s.webkitURL,c=document.createElement("a");e=e||t.name||"download",c.download=e,c.rel="noopener","string"==typeof t?(c.href=t,c.origin===location.origin?i(c):o(c.href)?a(t,e,n):i(c,c.target="_blank")):(c.href=r.createObjectURL(t),setTimeout((function(){r.revokeObjectURL(c.href)}),4e4),setTimeout((function(){i(c)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,n,s){if(n=n||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(e(t,s),n);else if(o(t))a(t,n,s);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout((function(){i(r)}))}}:function(t,e,n,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return a(t,e,n);var i="application/octet-stream"===t.type,c=/constructor/i.test(s.HTMLElement)||s.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||i&&c||r)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var t=u.result;t=l?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},u.readAsDataURL(t)}else{var d=s.URL||s.webkitURL,p=d.createObjectURL(t);o?o.location=p:location.href=p,o=null,setTimeout((function(){d.revokeObjectURL(p)}),4e4)}});s.saveAs=c.saveAs=c,t.exports=c}))}).call(this,n("c8ba"))},"3c20":function(t,e,n){},"4a47":function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("el-dialog",{attrs:{visible:t.dialogVisible,"close-on-click-modal":!1,top:"30vh"},on:{"update:visible":function(e){t.dialogVisible=e},close:t.close}},[n("PaypalSubscriptionButton",{ref:"PaypalButton"})],1)},o=[],i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{"text-align":"center"},attrs:{id:"paypal-button-container3"}})},s=[],r=n("7b32"),c=n("6b29"),l=n("ed08"),u={name:"PaypalSubscriptionButton",data(){return{paypal:null}},inject:["reload"],watch:{},created(){},mounted(){this.paypalReady()},methods:{close(){const t=document.querySelector("#paypal-button-container3");t.removeChild(t.lastElementChild)},async paypalReady(){var t=this;try{this.paypal=await Object(r["a"])({"client-id":"Ad_2nWfHg-jljIyJdtNKa_8Vt9CzTPSn99w5REF3BFBV13lrA1QUF7HV5uSN3dwfV1Gag-YUMKfQyl2B",intent:"subscription",vault:!0})}catch(e){console.error("failed to load the PayPal JS SDK script",e)}this.paypal&&await this.paypal.Buttons({env:"production",commit:!0,style:{size:"large",color:"blue",shape:"rect",label:"subscribe"},locale:"en_US",createSubscription:function(e,n){return t.ceatePayPals().then(t=>n.subscription.create({plan_id:t.planId,custom_id:t.customId,subscriber:{email:t.email}}))},onApprove:(e,n)=>{t.queryStatus(e.subscriptionID)},onError:t=>{console.log(t,"paypal err")}}).render("#paypal-button-container3")},async ceatePayPals(){const t=await Object(c["b"])({});return t.data},async queryStatus(t){var e={};e.subscriptionID=t;var n=this,a=await Object(c["d"])(e);if(200===a.code){if(2===a.data.status)return n.$message.success("Change subscription success!"),void setTimeout(()=>{n.reload()},500);if(3===a.data.status)return n.$message.error(a.data.failReason),void this.reload();1===a.data.status&&(await Object(l["e"])(2e3),n.queryStatus(t))}}}},d=u,p=n("2877"),h=Object(p["a"])(d,i,s,!1,null,"4c3d627c",null),f=h.exports,g={name:"PaypalSubscriptionDialog",components:{PaypalSubscriptionButton:f},props:{value:{type:Boolean,default:!1}},data(){return{dialogVisible:!1}},watch:{value:{handler(t){this.dialogVisible=t},immediate:!0},dialogVisible:{handler(t){this.$emit("input",t)},immediate:!0}},mounted(){},methods:{close(){this.dialogVisible=!1}}},m=g,b=Object(p["a"])(m,a,o,!1,null,"2cd31193",null);e["a"]=b.exports},"629a":function(t,e,n){},"6b29":function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return s})),n.d(e,"d",(function(){return r}));var a=n("66a5");const o=t=>Object(a["a"])({url:"/shopapi/pay/paypal/create",method:"post",data:t}),i=t=>Object(a["a"])({url:"/shopapi/pay/paypal/execute",method:"post",data:t}),s=t=>Object(a["a"])({url:"/shopapi/pay/paypal/subscription/create/param",method:"post",data:t}),r=t=>Object(a["a"])({url:"/shopapi/pay/paypal/subscription/status",method:"post",data:t})},"7b32":function(t,e,n){"use strict"; /*! * paypal-js v5.1.4 (2022-11-29T23:08:21.847Z) * Copyright 2020-present, PayPal, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function a(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var a=c(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(a.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==a.dataset[t]&&(i=!1)})),i?n:null}function o(t){var e=t.url,n=t.attributes,a=t.onSuccess,o=t.onError,i=c(e,n);i.onerror=o,i.onload=a,document.head.insertBefore(i,document.head.firstElementChild)}function i(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),l(t);var n=Object.keys(t).filter((function(e){return"undefined"!==typeof t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,n){var a=t[n].toString();return"data-"===n.substring(0,5)?e.dataAttributes[n]=a:e.queryParams[n]=a,e}),{queryParams:{},dataAttributes:{}}),a=n.queryParams,o=n.dataAttributes;return{url:"".concat(e,"?").concat(s(a)),dataAttributes:o}}function s(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function r(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}function c(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function l(t){var e=t["merchant-id"],n=t["data-merchant-id"],a="",o="";return Array.isArray(e)?e.length>1?(a="*",o=e.toString()):a=e.toString():"string"===typeof e&&e.length>0?a=e:"string"===typeof n&&n.length>0&&(a="*",o=n),t["merchant-id"]=a,t["data-merchant-id"]=o,t}function u(t,e){if(void 0===e&&(e=p()),f(t,e),"undefined"===typeof window)return e.resolve(null);var n=i(t),o=n.url,s=n.dataAttributes,r=s["data-namespace"]||"paypal",c=h(r);return a(o,s)&&c?e.resolve(c):d({url:o,attributes:s},e).then((function(){var t=h(r);if(t)return t;throw new Error("The window.".concat(r," global variable is not available."))}))}function d(t,e){void 0===e&&(e=p()),f(t,e);var n=t.url,a=t.attributes;if("string"!==typeof n||0===n.length)throw new Error("Invalid url.");if("undefined"!==typeof a&&"object"!==typeof a)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"===typeof window)return t();o({url:n,attributes:a,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&e(t),n.text()})).then((function(t){var n=r(t);e(new Error(n))})).catch((function(t){e(t)})):e(t)}})}))}function p(){if("undefined"===typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function h(t){return window[t]}function f(t,e){if("object"!==typeof t||null===t)throw new Error("Expected an options object.");if("undefined"!==typeof e&&"function"!==typeof e)throw new Error("Expected PromisePonyfill to be a function.")}n.d(e,"a",(function(){return u}))},"7f5a":function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("paypal-subscription-dialog",{model:{value:t.showPaypal,callback:function(e){t.showPaypal=e},expression:"showPaypal"}})],1)},o=[],i=n("1faf"),s=n("86b8"),r=n("2f62"),c=n("4a47"),l={name:"SubscriptionAction",components:{PaypalSubscriptionDialog:c["a"]},inject:["reload"],data(){return{showPaypal:!1}},computed:{...Object(r["b"])("user",{currentShop:"getCurrentShop",fittingsLevel:"getFittingsLevel"}),...Object(r["b"])("shopify",{app:"getApp",shop:"getShop"})},methods:{SelectSubscription(t){var e=this;1===this.currentShop.shopType?(this.loadingInstance=this.$loading(),Object(i["b"])({level:t,returnUrl:this.getReturnUrl()}).then(t=>{if(200===t.code){var n=t.data;if(1===n.status)return this.$message.success("Change subscription success!"),void setTimeout(()=>{e.reload()},500);2===n.status&&this.toShopifyConfirmationUrl(n.confirmationUrl)}else this.$message.error(t.msg)}).finally(()=>{this.loadingInstance.close()})):(console.log("show paypal"),this.showPaypal=!0)},getReturnUrl(){if(this.app){var t="e0080c246e19620838062418c3259ac2",e=this.shop;return`https://${e}/admin/apps/${t}/PaymentStatus`}return"https://"+location.host+"/PaymentStatus"},toShopifyConfirmationUrl(t){if(this.app){const e=s["Redirect"].create(this.app);e.dispatch(s["Redirect"].Action.REMOTE,{url:t,newContext:!1})}else location.href=t}}},u=l,d=n("2877"),p=Object(d["a"])(u,a,o,!1,null,"0db2ce20",null);e["a"]=p.exports},a156:function(t,e,n){"use strict";n("3c20")},c502:function(t,e,n){"use strict";n("629a")},e112:function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"fittingsImageContainer"},[n("canvas",{directives:[{name:"loading",rawName:"v-loading",value:t.paintLock,expression:"paintLock"}],attrs:{id:t.id}}),n("div",{staticClass:"downloadBtnDiv"},[n("el-button",{staticClass:"downloadBtn",attrs:{type:"primary"},on:{click:t.downloadImg}},[t._v("download")])],1)])},o=[],i=n("e1bd"),s=n("7a94"),r=n("21a6"),c=n("ed08"),l={name:"FittingsImg",props:{bottomImageUrl:{type:String,default:null},logoX:{type:Number,default:null},logoY:{type:Number,default:null},logoH:{type:Number,default:null},logoW:{type:Number,default:null},logoUrl:{type:String,default:null},width:{type:Number,default:150},height:{type:Number,default:150}},data(){return{canvas:null,id:"fittings_img_"+Object(i["a"])(),paintLock:!1,loading:!1,canvasWidth:200,canvasHeight:200}},watch:{logoUrl(){this.paint()},bottomImageUrl(){this.paint()}},mounted(){this.canvasWidth=document.body.clientWidth/1920*this.width,this.canvasHeight=document.body.clientHeight/1920*this.height,this.paint()},methods:{paint(){if(!this.paintLock){this.paintLock=!0;try{this.doPaint()}finally{this.paintLock=!1}}},doPaint(){this.canvas||(this.canvas=new s["fabric"].Canvas(this.id,{selectable:!1}));var t=this;if(t.canvas.setWidth(t.canvasWidth),t.canvas.setHeight(t.canvasWidth),this.canvas.clear(),this.bottomImageUrl){const e=new Image;e.setAttribute("crossOrigin","anonymous"),e.src=this.bottomImageUrl,e.onload=()=>(t.setBg(t.canvas,t.bottomImageUrl,e.width,e.height),!0)}if(this.logoUrl){const e=new Image;e.setAttribute("crossOrigin","anonymous"),e.src=this.logoUrl,e.onload=()=>{var n=t.logoX*t.canvas.width,a=t.logoY*t.canvas.height,o=0;return o=Math.min(t.canvas.height/e.height*t.logoH,t.canvas.width/e.width*t.logoW),t.logoHe.height&&(a+=t.logoH/2*t.canvas.height-e.height*o/2),e.width