(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-65b79a2c"],{"1cf3":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return t.show?a("div",{ref:"fittingsImgDialog",staticClass:"fittings-img-dialog"},[a("el-card",{staticClass:"fittings-img-dialog-card",attrs:{shadow:"always"}},[a("i",{staticClass:"el-icon-close close cursor-pointer",on:{click:function(e){return e.target!==e.currentTarget?null:t.hiddenDialog.apply(null,arguments)}}}),a("el-row",[a("el-col",{attrs:{span:16}},[a("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),a("el-col",{attrs:{span:8}},[a("el-row",[t._v(" View ")]),a("div",{staticClass:"fittings-imgs"},t._l(t.fittings.customizeInfos,(function(e,n){return a("div",{key:e.bottomImageUrl+t.currentCustomizeInfoIndex,staticClass:"fittings-img",on:{click:function(e){t.currentCustomizeInfoIndex=n}}},[a("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=a("e112"),r={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)}}},s=r,l=(a("a156"),a("2877")),c=Object(l["a"])(s,n,o,!1,null,"5181141c",null);e["a"]=c.exports},"1faf":function(t,e,a){"use strict";a.d(e,"a",(function(){return o})),a.d(e,"b",(function(){return i})),a.d(e,"d",(function(){return r})),a.d(e,"c",(function(){return s}));var n=a("66a5");const o=t=>Object(n["a"])({url:"/shopapi/pay/shopify/application_charge/status",method:"post",data:t}),i=t=>Object(n["a"])({url:"/shopapi/pay/shopify/subscription/change",method:"post",data:t}),r=t=>Object(n["a"])({url:"/shopapi/pay/shopify/subscription/status",method:"post",data:t}),s=t=>Object(n["a"])({url:"/shopapi/pay/shopify/subscription/cancel",method:"post",data:t})},"3c20":function(t,e,a){},"4a47":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{visible:t.dialogVisible,"close-on-click-modal":!1,top:"30vh"},on:{"update:visible":function(e){t.dialogVisible=e},close:t.close}},[a("PaypalSubscriptionButton",{ref:"PaypalButton"})],1)},o=[],i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticStyle:{"text-align":"center"},attrs:{id:"paypal-button-container3"}})},r=[],s=a("7b32"),l=a("6b29"),c=a("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(s["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,a){return t.ceatePayPals().then(t=>a.subscription.create({plan_id:t.planId,custom_id:t.customId,subscriber:{email:t.email}}))},onApprove:(e,a)=>{t.queryStatus(e.subscriptionID)},onError:t=>{console.log(t,"paypal err")}}).render("#paypal-button-container3")},async ceatePayPals(){const t=await Object(l["b"])({});return t.data},async queryStatus(t){var e={};e.subscriptionID=t;var a=this,n=await Object(l["e"])(e);if(200===n.code){if(2===n.data.status)return a.$message.success("Change subscription success!"),void setTimeout(()=>{a.reload()},500);if(3===n.data.status)return a.$message.error(n.data.failReason),void this.reload();1===n.data.status&&(await Object(c["e"])(2e3),a.queryStatus(t))}}}},d=u,p=a("2877"),h=Object(p["a"])(d,i,r,!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,n,o,!1,null,"2cd31193",null);e["a"]=b.exports},"6b29":function(t,e,a){"use strict";a.d(e,"a",(function(){return o})),a.d(e,"c",(function(){return i})),a.d(e,"b",(function(){return r})),a.d(e,"e",(function(){return s})),a.d(e,"d",(function(){return l}));var n=a("66a5");const o=t=>Object(n["a"])({url:"/shopapi/pay/paypal/create",method:"post",data:t}),i=t=>Object(n["a"])({url:"/shopapi/pay/paypal/execute",method:"post",data:t}),r=t=>Object(n["a"])({url:"/shopapi/pay/paypal/subscription/create/param",method:"post",data:t}),s=t=>Object(n["a"])({url:"/shopapi/pay/paypal/subscription/status",method:"post",data:t}),l=t=>Object(n["a"])({url:"/shopapi/pay/paypal/subscription/cancel",method:"post",data:t})},"7b32":function(t,e,a){"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 n(t,e){var a=document.querySelector('script[src="'.concat(t,'"]'));if(null===a)return null;var n=l(t,e),o=a.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(n.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==n.dataset[t]&&(i=!1)})),i?a:null}function o(t){var e=t.url,a=t.attributes,n=t.onSuccess,o=t.onError,i=l(e,a);i.onerror=o,i.onload=n,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),c(t);var a=Object.keys(t).filter((function(e){return"undefined"!==typeof t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,a){var n=t[a].toString();return"data-"===a.substring(0,5)?e.dataAttributes[a]=n:e.queryParams[a]=n,e}),{queryParams:{},dataAttributes:{}}),n=a.queryParams,o=a.dataAttributes;return{url:"".concat(e,"?").concat(r(n)),dataAttributes:o}}function r(t){var e="";return Object.keys(t).forEach((function(a){0!==e.length&&(e+="&"),e+=a+"="+t[a]})),e}function s(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}function l(t,e){void 0===e&&(e={});var a=document.createElement("script");return a.src=t,Object.keys(e).forEach((function(t){a.setAttribute(t,e[t]),"data-csp-nonce"===t&&a.setAttribute("nonce",e["data-csp-nonce"])})),a}function c(t){var e=t["merchant-id"],a=t["data-merchant-id"],n="",o="";return Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"===typeof e&&e.length>0?n=e:"string"===typeof a&&a.length>0&&(n="*",o=a),t["merchant-id"]=n,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 a=i(t),o=a.url,r=a.dataAttributes,s=r["data-namespace"]||"paypal",l=h(s);return n(o,r)&&l?e.resolve(l):d({url:o,attributes:r},e).then((function(){var t=h(s);if(t)return t;throw new Error("The window.".concat(s," global variable is not available."))}))}function d(t,e){void 0===e&&(e=p()),f(t,e);var a=t.url,n=t.attributes;if("string"!==typeof a||0===a.length)throw new Error("Invalid url.");if("undefined"!==typeof n&&"object"!==typeof n)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"===typeof window)return t();o({url:a,attributes:n,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(a,'" failed to load.'));return window.fetch?fetch(a).then((function(a){return 200===a.status&&e(t),a.text()})).then((function(t){var a=s(t);e(new Error(a))})).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.")}a.d(e,"a",(function(){return u}))},"7f5a":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("paypal-subscription-dialog",{model:{value:t.showPaypal,callback:function(e){t.showPaypal=e},expression:"showPaypal"}})],1)},o=[],i=a("1faf"),r=a("86b8"),s=a("2f62"),l=a("4a47"),c={name:"SubscriptionAction",components:{PaypalSubscriptionDialog:l["a"]},inject:["reload"],data(){return{showPaypal:!1}},computed:{...Object(s["b"])("user",{currentShop:"getCurrentShop",fittingsLevel:"getFittingsLevel"}),...Object(s["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 a=t.data;if(1===a.status)return this.$message.success("Change subscription success!"),void setTimeout(()=>{e.reload()},500);2===a.status&&this.toShopifyConfirmationUrl(a.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=r["Redirect"].create(this.app);e.dispatch(r["Redirect"].Action.REMOTE,{url:t,newContext:!1})}else location.href=t}}},u=c,d=a("2877"),p=Object(d["a"])(u,n,o,!1,null,"0db2ce20",null);e["a"]=p.exports},a156:function(t,e,a){"use strict";a("3c20")},e112:function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("canvas",{directives:[{name:"loading",rawName:"v-loading",value:t.paintLock,expression:"paintLock"}],attrs:{id:t.id}})])},o=[],i=a("e1bd"),r=a("7a94"),s={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,canvasWidth:200,canvasHeight:200}},watch:{logoUrl(){this.paint()},bottomImageUrl(){this.paint()}},mounted(){this.canvasWidth=document.body.clientWidth/1600*this.width,this.canvasHeight=document.body.clientHeight/1600*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 r["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 a=t.logoX*t.canvas.width,n=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&&(n+=t.logoH/2*t.canvas.height-e.height*o/2),e.width