import{x as I,_ as W}from"./index-r_E2mS1x.js";import{B as V,b as g,D as _,G as t,U as n,u as r,V as i,H as d,P as l,ah as b,I as f,C as h,Z as x,Y as P,F as S}from"./vue-DweYBrEc.js";const A={class:"default-main program-widget-page"},E={class:"panel"},U={class:"panel-title"},B={class:"code-section"},D={class:"section-heading"},H={class:"section-help"},z={class:"section-actions"},T={class:"code-section function-section"},F={class:"section-heading"},L={class:"section-help"},N={class:"section-actions"},$={class:"preview-grid"},M=["onClick"],O={class:"preview-note"},J=V({name:"embed/programWidget",__name:"programWidget",setup(K){const{t:o}=I.useI18n(),p=g(!1),w=[{page:2,label:"LW",image:"https://static.gwvkyk.com/media/39bea8462f7961673f860.gif"},{page:5,label:"GE",image:"https://static.gwvkyk.com/media/989cd0562f796ef90eb9d.gif"},{page:6,label:"DM",image:"https://static.gwvkyk.com/media/5ab815562f7961db8a170.gif"},{page:7,label:"PK",image:"https://static.gwvkyk.com/media/fa67bd562f79668049b3b.gif"}],c=g(`<div class='promo-container'>
    <div class='lw-wrapper promo-wrapper'><button class='lw-button promo-button' onclick='programPage(2);'>Click</button></div>
    <div class='ge-wrapper promo-wrapper'><button class='ge-button promo-button' onclick='programPage(5);'>Click</button></div>
    <div class='dm-wrapper promo-wrapper'><button class='dm-button promo-button' onclick='programPage(6);'>Click</button></div>
    <div class='pk-wrapper promo-wrapper'><button class='pk-button promo-button' onclick='programPage(7);'>Click</button></div>
</div>
<style>
    .lw-button { background-image: url(https://static.gwvkyk.com/media/39bea8462f7961673f860.gif); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .ge-button { background-image: url(https://static.gwvkyk.com/media/989cd0562f796ef90eb9d.gif); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .dm-button { background-image: url(https://static.gwvkyk.com/media/5ab815562f7961db8a170.gif); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .pk-button { background-image: url(https://static.gwvkyk.com/media/fa67bd562f79668049b3b.gif); width: 100%; height: 100%; padding: 38% 5% 7% 11%; }
    .promo-wrapper { background-size: 100% 100%; background-repeat: no-repeat; background-position: center; background-color: transparent; margin: 10px 0; }
    .promo-button { background-size: 100% 100%; background-repeat: no-repeat; background-position: center; background-color: transparent; font-size: 0; border: 0; cursor: pointer; }
</style>`),u=g(`<script>
    function programPage(page) {
        let userId = '';
        let merchantId = (typeof _ !== 'undefined' && typeof _.getVar === 'function') ? (_.getVar('merchantId') ?? '') : '';
        if (!merchantId) { alert('merchantId not found'); return; }

        var refValue = 'jdkUserId';
        if (!localStorage.getItem('USER')) { alert('Please login first!'); return; }
        userId = JSON.parse(localStorage.getItem('USER')).id;
        if (typeof userId == 'undefined' || userId == '') { alert('Please login first!'); return; }
        if (userId === null) { alert('user id is null'); return; }

        var content = refValue + '=' + userId;
        var encodedContent = btoa(content);
        var form = document.createElement('form');
        form.setAttribute('method', 'POST');
        form.setAttribute('action', 'https://1xaud.g2ma.co/p' + page + '.aspx');

        var input1 = document.createElement('input');
        input1.setAttribute('type', 'hidden');
        input1.setAttribute('name', 'userData');
        input1.setAttribute('value', encodedContent);

        var input2 = document.createElement('input');
        input2.setAttribute('type', 'hidden');
        input2.setAttribute('name', 'clientMerchant');
        input2.setAttribute('value', merchantId);

        form.appendChild(input1);
        form.appendChild(input2);
        document.body.appendChild(form);
        form.submit();
        form.remove();
    }
<\/script>`),v=async s=>{try{await navigator.clipboard.writeText(s),b.success(o("embed.programWidget.copied"))}catch{b.error(o("embed.programWidget.copyFailed"))}},y=s=>{b.info(o("embed.programWidget.previewProgram",{page:s}))};return(s,e)=>{const k=f("el-input"),m=f("el-button"),C=f("el-dialog");return h(),_("div",A,[t("section",E,[t("div",U,n(r(o)("embed.programWidget.title")),1),t("div",B,[t("div",D,n(r(o)("embed.programWidget.bannerCode"))+":",1),t("p",H,[i(n(r(o)("embed.programWidget.bannerHelpPrefix"))+" ",1),e[6]||(e[6]=t("strong",null,"JDK Back-end > DISPLAY > SEO > Heading 1",-1)),i(" "+n(r(o)("embed.programWidget.bannerHelpSuffix")),1)]),d(k,{modelValue:c.value,"onUpdate:modelValue":e[0]||(e[0]=a=>c.value=a),type:"textarea",rows:7,readonly:"",resize:"vertical"},null,8,["modelValue"]),t("div",z,[d(m,{onClick:e[1]||(e[1]=a=>p.value=!0)},{default:l(()=>[i(n(r(o)("embed.programWidget.preview")),1)]),_:1}),d(m,{type:"primary",plain:"",onClick:e[2]||(e[2]=a=>v(c.value))},{default:l(()=>[i(n(r(o)("embed.programWidget.copyBanner")),1)]),_:1})])]),t("div",T,[t("div",F,n(r(o)("embed.programWidget.functionCode"))+":",1),t("p",L,[i(n(r(o)("embed.programWidget.functionHelpPrefix"))+" ",1),e[7]||(e[7]=t("strong",null,"JDK Back-end > LAYOUT > Home Page · Floating Widget > HTML",-1))]),d(k,{modelValue:u.value,"onUpdate:modelValue":e[3]||(e[3]=a=>u.value=a),type:"textarea",rows:7,readonly:"",resize:"vertical"},null,8,["modelValue"]),t("div",N,[d(m,{type:"primary",plain:"",onClick:e[4]||(e[4]=a=>v(u.value))},{default:l(()=>[i(n(r(o)("embed.programWidget.copyFunction")),1)]),_:1})])])]),d(C,{modelValue:p.value,"onUpdate:modelValue":e[5]||(e[5]=a=>p.value=a),title:r(o)("embed.programWidget.previewTitle"),width:"760px"},{default:l(()=>[t("div",$,[(h(),_(x,null,P(w,a=>t("button",{key:a.page,type:"button",class:"program-banner",style:S({backgroundImage:`url(${a.image})`}),onClick:Y=>y(a.page)},[t("span",null,n(a.label),1)],12,M)),64))]),t("p",O,n(r(o)("embed.programWidget.previewNote")),1)]),_:1},8,["modelValue","title"])])}}}),R=W(J,[["__scopeId","data-v-2e52bcfc"]]);export{R as default};
