PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.2.5
Pay with Vipps and MobilePay for WooCommerce v6.2.5
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 All 187 releases
← All changes | payment/admin/settings/dist/plugin.js +3 -3 5.4.2 → 6.2.5 View file →
@@ -1,3 +1,3 @@
1 -(function(h,J){"use strict";var A=document.createElement("style");A.textContent=`.vipps-mobilepay-react-admin-page{color:#161225;font-family:Vipps Text,Roboto,Helvetica,Arial,sans-serif}.vipps-mobilepay-react-loading{display:inline-block;position:relative;width:20px;height:20px}.vipps-mobilepay-react-loading div{box-sizing:border-box;display:block;position:absolute;width:16px;height:16px;margin:2px;border:2px solid #666;border-radius:50%;animation:vipps-mobilepay-react-loading 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#666 transparent transparent transparent}.vipps-mobilepay-react-loading div:nth-child(1){animation-delay:-.45s}.vipps-mobilepay-react-loading div:nth-child(2){animation-delay:-.3s}.vipps-mobilepay-react-loading div:nth-child(3){animation-delay:-.15s}@keyframes vipps-mobilepay-react-loading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.vipps-mobilepay-react-form-field{margin-bottom:2rem;display:flex;gap:2rem}.vipps-mobilepay-react-form-field>label{width:20%;overflow-wrap:break-word}@media (min-width: 860px){.vipps-mobilepay-react-form-field>label{overflow-wrap:normal}}.vipps-mobilepay-react-form-field>div{width:85%}.vipps-mobilepay-react-col{display:flex;flex-direction:column;gap:.5rem}.vipps-mobilepay-react-label{font-weight:600;color:#1d2327;font-size:14px}.vipps-mobilepay-react-tab-description{margin-bottom:1rem}.vipps-mobilepay-react-field-description{color:#666}.vipps-mobilepay-react-button-actions{display:flex;column-gap:1rem}.vipps-mobilepay-react-notification-banner{padding:1rem;min-height:40px;font-size:1rem;display:flex;align-items:center}.vipps-mobilepay-react-notification-banner-error{background-color:#f8d7da;color:#721c24;border:1px solid #f5c6cb}.vipps-mobilepay-react-notification-banner-warning{background-color:#fff3cd;color:#856404;border:1px solid #ffeeba}.vipps-mobilepay-react-notification-banner-success{background-color:#d4edda;color:#155724;border:1px solid #c3e6cb}.vipps-mobilepay-react-save-section{display:flex;align-items:center;gap:1rem}.vipps-mobilepay-react-save-confirmation{display:flex;align-items:center;gap:.5rem;color:#2a8947;font-weight:500}.vipps-mobilepay-react-save-confirmation .dashicons{font-size:1.2rem;width:auto;height:auto}.vipps-mobilepay-form-container{display:flex;flex-direction:column;align-items:flex-start;gap:3rem}@media (min-width: 420px){.vipps-mobilepay-form-container{display:flex;flex-direction:column;align-items:center;gap:3rem}}@media (min-width: 700px){.vipps-mobilepay-form-container{align-items:flex-start;flex-direction:row;gap:1rem,}}@media (min-width: 1280px){.vipps-mobilepay-form-container{gap:3rem}}.vipps-mobilepay-react-form-field{display:flex;flex-direction:row;justify-content:flex-start}.vipps-mobilepay-form-help-box{background-color:#fff;border-color:#8c8f94;border-radius:4px;border:1px solid #8c8f94;padding:30px;width:13rem;margin-left:auto;margin-right:auto}@media (min-width: 420px){.vipps-mobilepay-form-help-box{margin-left:0;margin-right:0}}.vipps-mobilepay-form-help-box a{text-wrap:nowrap}.vipps-mobilepay-react-checkout-confirm .body{display:flex;flex-direction:column;gap:5rem;margin-bottom:2rem}@media (min-width: 870px){.vipps-mobilepay-react-checkout-confirm .body{display:flex;flex-direction:row;gap:5rem}}.vipps-mobilepay-react-checkout-confirm .title{margin-bottom:1em;font-weight:700}.vipps-mobilepay-react-checkout-confirm li{list-style:inside;margin-left:1em}.vipps-mobilepay-react-checkout-confirm img{margin-right:50px;width:20rem;display:flex;align-items:center;justify-content:center}@media (min-width: 1280px){.vipps-mobilepay-react-checkout-confirm img{width:30rem}}.vipps-mobilepay-react-checkout .title{margin-bottom:1em;font-weight:700}
2 -/*$vite$:1*/`,document.head.appendChild(A);var P={},M=J;P.createRoot=M.createRoot,P.hydrateRoot=M.hydrateRoot;const x=window;if(!x.VippsMobilePayReactTranslations)throw new Error("VippsMobilePayReactTranslations not found, make sure to include this using wp_localize_script()");if(!x.VippsMobilePayReactOptions)throw new Error("VippsMobilePayReactOptions not found, make sure to include this using wp_localize_script()");if(!x.VippsMobilePayReactMetadata)throw new Error("VippsMobilePayReactMetadata not found, make sure to include this using wp_localize_script()");function t(e){let a=x.VippsMobilePayReactTranslations;const n=e.split(".");for(const i of n)if(typeof a=="object"&&a!==null)a=a[i];else break;return a!==void 0?a:e}function w(e){var a;return((a=x.VippsMobilePayReactMetadata)==null?void 0:a[e])??null}const{VippsMobilePayReactOptions:Z}=x;function G({tabs:e,onTabChange:a,activeTab:n}){return React.createElement("div",{className:"vippstabholder",id:"vippstabholder"},e.map((i,l)=>React.createElement("h3",{key:l,id:`woocommerce_vipps_${i}_options`,"aria-selected":i===n?"true":"false",className:`wc-settings-sub-title tab ${i===n?"active":""}`,title:i,onClick:()=>a(i),style:{cursor:"pointer"}},i)))}function V(e){switch(e){case"NO":return"Vipps";case"SE":return"Vipps";case"FI":return"MobilePay";case"DK":return"MobilePay"}return"MobilePay"}function j(e){switch(e){case"Vipps":return["NOK","SEK"];case"MobilePay":return["DKK","EUR"];default:return[]}}function U(e,a){return a?j(e).includes(a):!1}const W=h.createContext(null);function Q({children:e}){const[a,n]=h.useState(Z);function i(m){const u=a[m],_=m+".default",v=t(_),c=v!=_?v:null;return u??c??""}function l(m){const u=m+".default";return t(u)!=u}async function d(m,u){console.log("setOption called:",{key:m,value:u}),n(_=>({..._,[m]:u??null}))}async function o(m){n(m)}async function p(m){console.log("submitChanges - Current values:",a),m!=null&&m.forceEnable&&(d("enabled","yes"),a.enabled="yes");const u=document.getElementById("vippsadmin_nonce").value,_=new URLSearchParams({action:"vipps_update_admin_settings",vippsadmin_nonce:u});for(const[f,E]of Object.entries(a)){const I="values["+f+"]";E?_.append(I,E):_.append(I,"")}const c=await(await fetch(w("admin_url"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},credentials:"include",body:_.toString()})).json();return console.log("submitChanges - Server response:",c),c}return React.createElement(W.Provider,{value:{setOption:d,getOption:i,hasOption:l,setOptions:o,submitChanges:p}},e)}function k(){const e=h.useContext(W);if(!e)throw new Error("useWP must be used within a WPOptionsProvider");return e}const r=(e,a)=>e.replace(/Vipps MobilePay Checkout/g,a==="Vipps"?"Vipps Checkout":"MobilePay Checkout");function X(){return React.createElement("div",{className:"vipps-mobilepay-react-loading"},React.createElement("div",null),React.createElement("div",null),React.createElement("div",null),React.createElement("div",null))}function Y(e){return React.createElement("input",{...e,className:["input-text regular-input",e.className??""].join(" "),style:{height:30}},e.children)}function $(e){return React.createElement("form",{...e,className:["",e.className??""].join(" ")},e.children)}function N(e){return React.createElement("label",{...e,className:["vipps-mobilepay-react-label",e.className??""].join(" ")},e.children)}function K({variant:e,isLoading:a,disabled:n,...i}){return React.createElement("button",{...i,disabled:a||n,className:[`button-${e}`,i.className??""].join(" ")},React.createElement("div",{style:{display:"flex",alignItems:"center"}},a&&React.createElement(X,null),React.createElement("span",null,i.children)))}function ee({id:e,name:a,onChange:n,checked:i,children:l,className:d}){return React.createElement("input",{id:e,name:a,checked:i?O(i):void 0,onChange:o=>n(z(o.target.checked)),type:"checkbox",className:[d??""].join(" ")},l)}function te({error:e,...a}){return React.createElement("div",null,React.createElement("select",{...a,className:["",a.className??"",e?"has-error":""].join(" ")},a.children),e&&React.createElement("div",{className:"vipps-mobilepay-react-field-error"},e.split(`
3 -`).map((n,i)=>React.createElement("div",{key:i},n))))}function L(e){return React.createElement("option",{...e,className:[e.className??""].join(" ")},e.children)}function ae(e){return React.createElement("textarea",{...e,className:[e.className??""].join(" ")},e.children)}function S(e){return React.createElement("div",{...e,className:["vipps-mobilepay-react-form-field",e.className??""].join(" ")},e.children)}function O(e){return e==="yes"}function z(e){return e?"yes":"no"}function q(e){return O(e)?"no":"yes"}function b({htmlString:e,className:a=""}){return React.createElement("span",{className:[a].join(" "),dangerouslySetInnerHTML:{__html:e}})}function s({name:e,titleKey:a,labelKey:n,descriptionKey:i,inverted:l=!1}){const{getOption:d,setOption:o}=k(),p=d("payment_method_name");return React.createElement(S,null,React.createElement(N,{htmlFor:e},r(t(a),p)),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement("div",{className:"vipps-mobilepay-react-row-center"},React.createElement(ee,{id:e,name:e,checked:l?q(d(e)):d(e),onChange:m=>l?o(e,q(m)):o(e,m)}),n&&React.createElement("label",{htmlFor:e},React.createElement(b,{htmlString:r(t(n),p)}))),i&&React.createElement(b,{className:"vipps-mobilepay-react-field-description",htmlString:r(t(i),p)})))}function R({name:e,titleKey:a,labelKey:n,descriptionKey:i,options:l,onChange:d,required:o=!1,includeEmptyOption:p=!1,error:m}){const{getOption:u,setOption:_}=k(),v=u("payment_method_name");return React.createElement(S,null,React.createElement(N,{htmlFor:e},r(t(a),v)),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement(te,{id:e,name:e,onChange:c=>{_(e,c.target.value),d&&d(c)},required:o,value:u(e),error:m},p&&React.createElement(L,{value:""}),l.map(c=>React.createElement(L,{key:c.value,value:c.value},c.label))),React.createElement("div",null,n&&React.createElement(b,{htmlString:r(t(n),v)})),i&&React.createElement(b,{className:"vipps-mobilepay-react-field-description",htmlString:r(t(i),v)})))}function y({name:e,titleKey:a,labelKey:n,descriptionKey:i,pattern:l,required:d,asterisk:o,type:p="text"}){const{getOption:m,setOption:u}=k(),[_,v]=h.useState(!1),c=!_&&o,f=m("payment_method_name");return React.createElement(S,null,React.createElement(N,{htmlFor:e},r(t(a),f)),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement(Y,{id:e,name:e,onChange:E=>u(e,E.target.value),value:m(e),pattern:l,required:d,onFocus:()=>v(!0),onBlur:()=>v(!1),type:c?"password":p}),React.createElement("div",null,n&&React.createElement(b,{htmlString:r(t(n),f)})),i&&React.createElement(b,{className:"vipps-mobilepay-react-field-description",htmlString:r(t(i),f)})))}function ie({name:e,titleKey:a,labelKey:n,descriptionKey:i,rows:l=5}){const{getOption:d,setOption:o}=k(),p=d("payment_method_name");return React.createElement(S,null,React.createElement(N,{htmlFor:e},r(t(a),p)),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement(ae,{id:e,name:e,onChange:m=>o(e,m.target.value),value:d(e),rows:l}),React.createElement("div",null,n&&React.createElement(b,{htmlString:r(t(n),p)})),i&&React.createElement(b,{className:"vipps-mobilepay-react-field-description",htmlString:r(t(i),p)})))}function ne(){const{setOption:e,getOption:a}=k();return React.createElement("div",null,React.createElement("p",{className:"vipps-mobilepay-react-tab-description"}),React.createElement(s,{name:"enabled",titleKey:"enabled.title",labelKey:"enabled.label"}),React.createElement(R,{name:"country",titleKey:"country.title",descriptionKey:"country.description",includeEmptyOption:!1,required:!0,onChange:n=>{const i=V(n.target.value);a("payment_method_name")||e("payment_method_name",i)},options:[{label:t("country.options.NO"),value:"NO"},{label:t("country.options.SE"),value:"SE"},{label:t("country.options.FI"),value:"FI"},{label:t("country.options.DK"),value:"DK"}]}),React.createElement(R,{name:"payment_method_name",titleKey:"payment_method_name.title",descriptionKey:"payment_method_name.description",includeEmptyOption:!1,required:!0,error:U(a("payment_method_name"),w("currency"))?void 0:`${a("payment_method_name")} does not support your store currency (${w("currency")}). Supported currencies: ${j(a("payment_method_name")).join(", ")}`,options:[{label:t("payment_method_name.options.Vipps"),value:"Vipps"},{label:t("payment_method_name.options.MobilePay"),value:"MobilePay"}]}),React.createElement(y,{name:"orderprefix",titleKey:"orderprefix.title",descriptionKey:"orderprefix.description",pattern:"[a-zA-Z0-9-]+",required:!0}),React.createElement(y,{asterisk:!0,name:"merchantSerialNumber",titleKey:"merchantSerialNumber.title",descriptionKey:"merchantSerialNumber.description"}),React.createElement(y,{asterisk:!0,name:"clientId",titleKey:"clientId.title",descriptionKey:"clientId.description"}),React.createElement(y,{asterisk:!0,name:"secret",titleKey:"secret.title",descriptionKey:"secret.description"}),React.createElement(y,{asterisk:!0,name:"Ocp_Apim_Key_eCommerce",titleKey:"Ocp_Apim_Key_eCommerce.title",descriptionKey:"Ocp_Apim_Key_eCommerce.description"}),React.createElement(R,{name:"result_status",titleKey:"result_status.title",descriptionKey:"result_status.description",options:[{label:t("result_status.options.on-hold"),value:"on-hold"},{label:t("result_status.options.processing"),value:"processing"}]}),React.createElement(R,{name:"status_on_fail",titleKey:"status_on_fail.title",descriptionKey:"status_on_fail.description",options:[{label:t("status_on_fail.options.failed"),value:"failed"},{label:t("status_on_fail.options.cancelled"),value:"cancelled"}]}),React.createElement(ie,{name:"description",titleKey:"description.title",descriptionKey:"description.description",rows:5}),React.createElement(s,{name:"vippsdefault",titleKey:"vippsdefault.title",labelKey:"vippsdefault.label"}))}function ce(){return React.createElement("div",null,React.createElement("p",{className:"vipps-mobilepay-react-tab-description"},t("express_options.description")),React.createElement(s,{name:"cartexpress",titleKey:"cartexpress.title",labelKey:"cartexpress.title",descriptionKey:"cartexpress.description"}),React.createElement(R,{name:"singleproductexpress",titleKey:"singleproductexpress.title",descriptionKey:"singleproductexpress.description",options:[{value:"none",label:t("singleproductexpress.options.none")},{value:"some",label:t("singleproductexpress.options.some")},{value:"all",label:t("singleproductexpress.options.all")}]}),React.createElement(s,{name:"singleproductexpressarchives",titleKey:"singleproductexpressarchives.title",labelKey:"singleproductexpressarchives.label",descriptionKey:"singleproductexpressarchives.description"}),React.createElement(s,{name:"expresscheckout_termscheckbox",titleKey:"expresscheckout_termscheckbox.title",labelKey:"expresscheckout_termscheckbox.label",descriptionKey:"expresscheckout_termscheckbox.description"}),React.createElement(s,{name:"expresscheckout_always_address",titleKey:"expresscheckout_always_address.title",labelKey:"expresscheckout_always_address.label",descriptionKey:"expresscheckout_always_address.description"}),React.createElement(s,{name:"enablestaticshipping",titleKey:"enablestaticshipping.title",labelKey:"enablestaticshipping.label",descriptionKey:"enablestaticshipping.description"}),React.createElement(s,{name:"expresscreateuser",titleKey:"expresscreateuser.title",labelKey:"expresscreateuser.label",descriptionKey:"expresscreateuser.description"}),React.createElement(s,{name:"singleproductbuynowcompatmode",titleKey:"singleproductbuynowcompatmode.title",labelKey:"singleproductbuynowcompatmode.label",descriptionKey:"singleproductbuynowcompatmode.description"}),React.createElement(s,{name:"deletefailedexpressorders",titleKey:"deletefailedexpressorders.title",labelKey:"deletefailedexpressorders.label",descriptionKey:"deletefailedexpressorders.description"}))}function re(){const{getOption:e,hasOption:a}=k(),n=e("vcs_porterbuddy")==="yes",i=e("vcs_helthjem")==="yes",l=a("checkout_external_payments_klarna"),d=l,o=e("payment_method_name");return React.createElement("div",null,React.createElement("p",{className:"vipps-mobilepay-react-tab-description"},React.createElement(b,{htmlString:r(t("checkout_options.description"),o)})),React.createElement("div",{style:{border:"2px solid red",padding:"1.5rem",marginBottom:"2rem"}},React.createElement("h3",null,r(t("kustom_sale_1"),o)),React.createElement("p",null,React.createElement(b,{htmlString:r(t("kustom_sale_2"),o)})),React.createElement("p",null,React.createElement(b,{htmlString:r(t("kustom_sale_3"),o)})),React.createElement("p",null,React.createElement(b,{htmlString:r(t("kustom_sale_4"),o)})),React.createElement("p",null,React.createElement(b,{htmlString:r(t("kustom_sale_5"),o)}))),React.createElement(s,{name:"vipps_checkout_enabled",titleKey:"vipps_checkout_enabled.title",labelKey:"vipps_checkout_enabled.label",descriptionKey:"vipps_checkout_enabled.description"}),React.createElement(s,{name:"checkoutcreateuser",titleKey:"checkoutcreateuser.title",labelKey:"checkoutcreateuser.label",descriptionKey:"checkoutcreateuser.description"}),React.createElement(s,{name:"enablestaticshipping_checkout",titleKey:"enablestaticshipping_checkout.title",labelKey:"enablestaticshipping_checkout.label",descriptionKey:"enablestaticshipping_checkout.description"}),React.createElement(s,{name:"requireUserInfo_checkout",titleKey:"requireUserInfo_checkout.title",labelKey:"requireUserInfo_checkout.label",descriptionKey:"requireUserInfo_checkout.description"}),React.createElement(s,{name:"noAddressFields",titleKey:"noAddressFields.title",labelKey:"noAddressFields.label",descriptionKey:"noAddressFields.description"}),React.createElement(s,{name:"noContactFields",titleKey:"noContactFields.title",labelKey:"noContactFields.label",descriptionKey:"noContactFields.description"}),React.createElement("h3",{className:"vipps-mobilepay-react-tab-description"},r(t("checkout_widgets.title"),o)),React.createElement("p",null,r(t("checkout_widgets.description"),o)),t("checkout_widget_coupon.title")!="checkout_widget_coupon.title"?React.createElement(s,{name:"checkout_widget_coupon",titleKey:"checkout_widget_coupon.title",descriptionKey:"checkout_widget_coupon.description",labelKey:"checkout_widget_coupon.label"}):[],React.createElement(s,{name:"checkout_widget_ordernotes",titleKey:"checkout_widget_ordernotes.title",descriptionKey:"checkout_widget_ordernotes.description",labelKey:"checkout_widget_ordernotes.label"}),d&&React.createElement(React.Fragment,null,React.createElement("h3",{className:"vipps-mobilepay-react-trab-description"},r(t("checkout_external_payment_title.title"),o)),React.createElement("p",null,r(t("checkout_external_payment_title.description"),o)),l&&React.createElement(s,{name:"checkout_external_payments_klarna",titleKey:"checkout_external_payments_klarna.title",labelKey:"checkout_external_payments_klarna.label",descriptionKey:"checkout_external_payments_klarna.description"})),React.createElement("h3",{className:"vipps-mobilepay-react-tab-description"},r(t("checkout_shipping.title"),o)),React.createElement("p",null,r(t("checkout_shipping.description"),o)),React.createElement(s,{name:"vcs_posten",titleKey:"vcs_posten.title",descriptionKey:"vcs_posten.description",labelKey:"vcs_posten.label"}),React.createElement(s,{name:"vcs_postnord",titleKey:"vcs_postnord.title",descriptionKey:"vcs_postnord.description",labelKey:"vcs_postnord.label"}),React.createElement(s,{name:"vcs_porterbuddy",titleKey:"vcs_porterbuddy.title",descriptionKey:"vcs_porterbuddy.description",labelKey:"vcs_porterbuddy.label"}),n&&React.createElement(React.Fragment,null,React.createElement(y,{asterisk:!0,name:"vcs_porterbuddy_publicToken",titleKey:"vcs_porterbuddy_publicToken.title",descriptionKey:"vcs_porterbuddy_publicToken.description"}),React.createElement(y,{asterisk:!0,name:"vcs_porterbuddy_apiKey",titleKey:"vcs_porterbuddy_apiKey.title",descriptionKey:"vcs_porterbuddy_apiKey.description"}),React.createElement(y,{name:"vcs_porterbuddy_phoneNumber",titleKey:"vcs_porterbuddy_phoneNumber.title",descriptionKey:"vcs_porterbuddy_phoneNumber.description"})),React.createElement(s,{name:"vcs_helthjem",titleKey:"vcs_helthjem.title",descriptionKey:"vcs_helthjem.description",labelKey:"vcs_helthjem.label"}),i&&React.createElement(React.Fragment,null,React.createElement(y,{type:"number",name:"vcs_helthjem_shopId",titleKey:"vcs_helthjem_shopId.title",descriptionKey:"vcs_helthjem_shopId.description"}),React.createElement(y,{name:"vcs_helthjem_username",titleKey:"vcs_helthjem_username.title",descriptionKey:"vcs_helthjem_username.description"}),React.createElement(y,{asterisk:!0,name:"vcs_helthjem_password",titleKey:"vcs_helthjem_password.title",descriptionKey:"vcs_helthjem_password.description"})))}function le({onUpload:e}){return{handleImageUpload:()=>{const n=wp.media({library:{type:"image"},button:{},multiple:!1});n.on("select",()=>{const i=n.state().get("selection").first().toJSON();let l="";i.url?l=i.url:i.sizes&&i.sizes.thumbnail&&(l=i.sizes.thumbnail.url),l&&e(i.id,l)}),n.open()}}}function T({variant:e,text:a}){return React.createElement("div",{className:`vipps-mobilepay-react-notification-banner vipps-mobilepay-react-notification-banner-${e}`},Array.isArray(a)?a.map((n,i)=>React.createElement("p",{key:i},n)):React.createElement("p",null,a))}function oe(){const{getOption:e,setOption:a}=k(),[n,i]=h.useState(null);function l(){a("receiptimage",""),a("receiptimage_url",""),i(null)}const{handleImageUpload:d}=le({onUpload(m,u){const _=new Image;_.src=u,_.onload=()=>{if(_.height<167){i(t("receipt_image_error"));return}i(null),console.log("Image Upload - Setting values:",{id:m,url:u}),a("receiptimage",m),a("receiptimage_url",u)}}}),o=e("receiptimage"),p=e("receiptimage_url");return React.createElement("div",null,React.createElement("p",{className:"vipps-mobilepay-react-tab-description"},t("advanced_options.description")),React.createElement(R,{name:"checkout_phone_transformation",titleKey:"checkout_phone_transformation.title",descriptionKey:"checkout_phone_transformation.description",options:[{label:t("checkout_phone_transformation.options.none"),value:"none"},{label:t("checkout_phone_transformation.options.ensure_plus"),value:"ensure_plus"},{label:t("checkout_phone_transformation.options.strip_country_code"),value:"strip_country_code"}]}),React.createElement(s,{labelKey:"vippsorderattribution.label",name:"vippsorderattribution",titleKey:"vippsorderattribution.title",descriptionKey:"vippsorderattribution.description"}),React.createElement(R,{name:"vippsspecialpagetemplate",titleKey:"vippsspecialpagetemplate.title",descriptionKey:"vippsspecialpagetemplate.description",options:Object.entries(t("vippsspecialpagetemplate.options")).map(([m,u])=>({label:u,value:m||""}))}),React.createElement(R,{name:"vippsspecialpageid",titleKey:"vippsspecialpageid.title",descriptionKey:"vippsspecialpageid.description",options:Object.entries(t("vippsspecialpageid.options")).map(([m,u])=>({label:u,value:m||""}))}),React.createElement(s,{name:"sendreceipts",titleKey:"sendreceipts.title",labelKey:"sendreceipts.label",descriptionKey:"sendreceipts.description"}),n&&React.createElement(T,{variant:"error",text:n}),React.createElement(S,null,React.createElement(N,{htmlFor:"woocommerce_vipps_receiptimage"},t("receiptimage.title")),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement("div",null,o?React.createElement(React.Fragment,null,React.createElement("img",{src:p,id:o,style:{width:200}}),React.createElement(K,{type:"button",onClick:l,variant:"link"},t("remove_image"))):React.createElement(K,{type:"button",onClick:d,variant:"link"},t("upload_image")),React.createElement("input",{type:"hidden",name:"woocommerce_vipps_receiptimage",id:"woocommerce_vipps_receiptimage",value:o})),React.createElement("span",{className:"vipps-mobilepay-react-field-description"},t("receiptimage.description"),React.createElement("br",null),React.createElement("small",null,t("receipt_image_size_requirement"))))),React.createElement(s,{name:"use_flock",titleKey:"use_flock.title",descriptionKey:"use_flock.description",labelKey:"use_flock.label"}),React.createElement(s,{name:"delete_settings_on_deactivation",titleKey:"delete_settings_on_deactivation.title",descriptionKey:"delete_settings_on_deactivation.description",labelKey:"delete_settings_on_deactivation.label"}),React.createElement(s,{name:"developermode",titleKey:"developermode.title",descriptionKey:"developermode.description",labelKey:"developermode.label"}))}function se(e){const[a,n]=h.useState(()=>window.location.hash),i=h.useCallback(()=>{n(window.location.hash)},[]);h.useEffect(()=>(window.addEventListener("hashchange",i),()=>{window.removeEventListener("hashchange",i)}),[i]);const l=h.useCallback(o=>{o!==a&&(window.location.hash="#"+o)},[a]);return h.useEffect(()=>{!a&&e&&l(e)},[a,e,l]),[decodeURIComponent(a.replace("#","")),l]}function pe(){return React.createElement("div",null,React.createElement("p",{className:"vipps-mobilepay-react-tab-description"},t("developertitle.description")),React.createElement(s,{name:"testmode",titleKey:"testmode.title",descriptionKey:"testmode.description",labelKey:"testmode.label"}),React.createElement(y,{name:"merchantSerialNumber_test",titleKey:"merchantSerialNumber_test.title",labelKey:"merchantSerialNumber_test.description"}),React.createElement(y,{asterisk:!0,name:"clientId_test",titleKey:"clientId_test.title",labelKey:"clientId_test.description"}),React.createElement(y,{asterisk:!0,name:"secret_test",titleKey:"secret_test.title",labelKey:"secret_test.description"}),React.createElement(y,{asterisk:!0,name:"Ocp_Apim_Key_eCommerce_test",titleKey:"Ocp_Apim_Key_eCommerce_test.title",labelKey:"Ocp_Apim_Key_eCommerce_test.description"}))}function me({isLoading:e}){const{getOption:a,setOption:n,hasOption:i}=k(),[l,d]=h.useState("ESSENTIAL"),[o,p]=h.useState("ESSENTIAL"),m=a("vcs_porterbuddy")==="yes",u=a("vcs_helthjem")==="yes",_=i("checkout_external_payments_klarna"),v=_,c=a("payment_method_name");return React.createElement(React.Fragment,null,l==="ESSENTIAL"&&React.createElement(React.Fragment,null,React.createElement("h3",{className:"vipps-mobilepay-react-tab-description"},t("wizard_header.title")),React.createElement("p",null,t("wizard_header.description")),React.createElement("div",{className:"vipps-mobilepay-form-container"},React.createElement("div",{className:"vipps-mobilepay-form-col"},React.createElement(R,{name:"country",titleKey:"country.title",descriptionKey:"country.description",onChange:f=>{const E=V(f.target.value);n("payment_method_name",E)},required:!0,includeEmptyOption:!1,options:[{label:t("country.options.NO"),value:"NO"},{label:t("country.options.SE"),value:"SE"},{label:t("country.options.FI"),value:"FI"},{label:t("country.options.DK"),value:"DK"}]}),React.createElement(R,{name:"payment_method_name",titleKey:"payment_method_name.title",descriptionKey:"payment_method_name.description",required:!0,includeEmptyOption:!1,options:[{label:t("payment_method_name.options.Vipps"),value:"Vipps"},{label:t("payment_method_name.options.MobilePay"),value:"MobilePay"}]}),React.createElement(y,{asterisk:!0,name:"merchantSerialNumber",titleKey:"merchantSerialNumber.title",descriptionKey:"merchantSerialNumber.description",required:!0}),React.createElement(y,{asterisk:!0,name:"clientId",titleKey:"clientId.title",descriptionKey:"clientId.description",required:!0}),React.createElement(y,{asterisk:!0,name:"secret",titleKey:"secret.title",descriptionKey:"secret.description",required:!0}),React.createElement(y,{asterisk:!0,name:"Ocp_Apim_Key_eCommerce",titleKey:"Ocp_Apim_Key_eCommerce.title",descriptionKey:"Ocp_Apim_Key_eCommerce.description",required:!0}),React.createElement(S,null,React.createElement(N,null),React.createElement("div",{className:"vipps-mobilepay-react-col"},React.createElement(K,{style:{alignSelf:"flex-start"},variant:"primary",type:"button",onClick:f=>{f.preventDefault();const E=f.currentTarget.closest("form");if(!E)throw new Error("Form not found");E.reportValidity()&&(p(l),O(a("vipps_checkout_enabled"))?d("CHECKOUT"):E.requestSubmit())}},O(a("vipps_checkout_enabled"))?t("next_step"):r(t("save_changes"),c))))),React.createElement("div",{className:"vipps-mobilepay-form-col vipps-mobilepay-form-help-box"},React.createElement("div",null,React.createElement("strong",{className:"title"},t("help_box.get_started")),React.createElement("br",null),React.createElement("a",{href:"https://wordpress.org/plugins/woo-vipps/",target:"_blank"},t("help_box.documentation")),React.createElement("br",null),React.createElement("a",{href:"https://portal.vippsmobilepay.com",target:"_blank"},t("help_box.portal"))),React.createElement("br",null),React.createElement("div",null,React.createElement("strong",{className:"title"},t("help_box.support.title")),React.createElement("br",null),React.createElement(b,{htmlString:t("help_box.support.description")}))))),l==="CHECKOUT_CONFIRM"&&React.createElement(React.Fragment,null,React.createElement("div",{className:"vipps-mobilepay-react-checkout-confirm"},React.createElement("h1",{className:"title"},r(t("checkout_confirm.title"),a("payment_method_name"))),React.createElement("p",null,r(t("checkout_options_wizard.description"),c)),React.createElement("div",{className:"body"},React.createElement("div",{className:"list"},React.createElement("strong",null,r(t("checkout_confirm.paragraph1.header"),c)),React.createElement("ul",null,React.createElement("li",null,r(t("checkout_confirm.paragraph1.first"),c)),React.createElement("li",null,r(t("checkout_confirm.paragraph1.second"),c)),React.createElement("li",null,r(t("checkout_confirm.paragraph1.third"),c))),React.createElement("strong",null,r(t("checkout_confirm.paragraph2.header"),c)),React.createElement("ul",null,React.createElement("li",null,r(t("checkout_confirm.paragraph2.first"),c)),React.createElement("li",null,r(t("checkout_confirm.paragraph2.second"),c)))),React.createElement("img",{src:t(c==="Vipps"?"checkout_confirm.img.vipps.src":"checkout_confirm.img.mobilepay.src"),alt:t("checkout_confirm.img.vipps.alt")})),React.createElement("div",{className:"vipps-mobilepay-react-button-actions"},React.createElement(K,{variant:"secondary",type:"button",onClick:()=>d(o)},r(t("previous_step"),c)),React.createElement(K,{variant:"primary",isLoading:e,onClick:()=>{n("vipps_checkout_enabled",z(!0)),p(l),d("CHECKOUT")}},r(t("checkout_confirm.accept"),c)),React.createElement(K,{variant:"secondary",onClick:()=>n("vipps_checkout_enabled",z(!1))},r(t("checkout_confirm.skip"),c))))),l==="CHECKOUT"&&React.createElement(React.Fragment,null,React.createElement("div",{className:"vipps-mobilepay-react-checkout-confirm"},React.createElement("h1",{className:"vipps-mobilepay-react-tab-description title"},r(t("checkout_options_wizard.title"),c)),React.createElement("p",null,r(t("checkout_options_wizard.description"),c)),React.createElement(s,{name:"checkoutcreateuser",titleKey:"checkoutcreateuser_wizard.title",labelKey:"checkoutcreateuser_wizard.label",descriptionKey:"checkoutcreateuser_wizard.description"}),React.createElement(s,{name:"enablestaticshipping_checkout",titleKey:"enablestaticshipping_checkout_wizard.title",labelKey:"enablestaticshipping_checkout_wizard.label",descriptionKey:"enablestaticshipping_checkout_wizard.description",inverted:!0}),React.createElement(s,{name:"noAddressFields",titleKey:"noAddressFields_wizard.title",labelKey:"noAddressFields_wizard.label",descriptionKey:"noAddressFields_wizard.description",inverted:!0}),React.createElement("h3",{className:"vipps-mobilepay-react-tab-description"},r(t("checkout_shipping_wizard.title"),c)),React.createElement("p",null,r(t("checkout_shipping_wizard.description"),c)),React.createElement(s,{name:"vcs_posten",titleKey:"vcs_posten_wizard.title",labelKey:"vcs_posten_wizard.label",descriptionKey:"vcs_posten_wizard.description"}),React.createElement(s,{name:"vcs_postnord",titleKey:"vcs_postnord_wizard.title",labelKey:"vcs_postnord_wizard.label",descriptionKey:"vcs_postnord_wizard.description"}),React.createElement(s,{name:"vcs_porterbuddy",titleKey:"vcs_porterbuddy_wizard.title",labelKey:"vcs_porterbuddy_wizard.label",descriptionKey:"vcs_porterbuddy_wizard.description"}),m&&React.createElement(React.Fragment,null,React.createElement(y,{asterisk:!0,name:"vcs_porterbuddy_publicToken",titleKey:"vcs_porterbuddy_publicToken.title",descriptionKey:"vcs_porterbuddy_publicToken.description"}),React.createElement(y,{asterisk:!0,name:"vcs_porterbuddy_apiKey",titleKey:"vcs_porterbuddy_apiKey.title",descriptionKey:"vcs_porterbuddy_apiKey.description"}),React.createElement(y,{name:"vcs_porterbuddy_phoneNumber",titleKey:"vcs_porterbuddy_phoneNumber.title",descriptionKey:"vcs_porterbuddy_phoneNumber.description"})),React.createElement(s,{name:"vcs_helthjem",titleKey:"vcs_helthjem_wizard.title",labelKey:"vcs_helthjem_wizard.label",descriptionKey:"vcs_helthjem_wizard.description"}),u&&React.createElement(React.Fragment,null,React.createElement(y,{type:"number",name:"vcs_helthjem_shopId",titleKey:"vcs_helthjem_shopId.title",descriptionKey:"vcs_helthjem_shopId.description"}),React.createElement(y,{name:"vcs_helthjem_username",titleKey:"vcs_helthjem_username.title",descriptionKey:"vcs_helthjem_username.description"}),React.createElement(y,{asterisk:!0,name:"vcs_helthjem_password",titleKey:"vcs_helthjem_password.title",descriptionKey:"vcs_helthjem_password.description"})),v&&React.createElement(React.Fragment,null,React.createElement("h3",{className:"vipps-mobilepay-react-trab-description"},r(t("checkout_external_payment_title.title"),c)),React.createElement("p",null,r(t("checkout_external_payment_title.description"),c)),_&&React.createElement(s,{name:"checkout_external_payments_klarna",titleKey:"checkout_external_payments_klarna.title",labelKey:"checkout_external_payments_klarna.label",descriptionKey:"checkout_external_payments_klarna.description"})),React.createElement("div",{className:"vipps-mobilepay-react-button-actions"},React.createElement(K,{variant:"secondary",type:"button",onClick:()=>{d(o),p("ESSENTIAL")}},r(t("previous_step"),c)),React.createElement(K,{variant:"primary",isLoading:e},r(t("save_changes"),c))))))}function de(){const[e,a]=h.useState(!1),[n,i]=h.useState(),[l,d]=h.useState(!1),{submitChanges:o,getOption:p,setOptions:m}=k(),u=w("currency"),_=p("payment_method_name"),v=!U(_,u),c=[t("main_options.title"),t("express_options.title")],f=+(w("vipps_checkout_activated")??0)||p("vipps_checkout_enabled")=="yes";f&&c.push(t("checkout_options.title"));const E=p("developermode")==="yes";E&&c.push(t("developertitle.title")),c.push(t("advanced_options.title"));const I=w("__dev_force_wizard_screen")||"",ye=["1","yes","true","TRUE"].includes(I),[H,_e]=se(c[0]);function C(F){return F===H}async function he(F){F.preventDefault(),a(!0),d(!1);try{const g=await o({forceEnable:B});console.log("handleSaveSettings - Response data:",g),!g.connection_ok||!g.form_ok?(i({text:g.connection_msg||g.form_errors,variant:"error"}),d(!1)):(i({text:g.connection_msg,variant:"success"}),d(!0),console.log("handleSaveSettings - Setting new options:",g.options),await m(g.options),be(D()),setTimeout(()=>{d(!1)},2e3))}catch(g){console.error("handleSaveSettings - Error:",g),i({text:g.message,variant:"error"}),d(!1)}finally{a(!1)}}function D(){const F=p("merchantSerialNumber")&&p("clientId")&&p("secret")&&p("Ocp_Apim_Key_eCommerce")&&p("country")&&p("payment_method_name"),g=O(p("testmode")),ve=p("merchantSerialNumber_test")&&p("clientId_test")&&p("secret_test")&&p("Ocp_Apim_Key_eCommerce_test")&&p("payment_method_name")&&p("country");return!F&&!ve&&!g}const[B,be]=h.useState(()=>ye||D());return React.createElement(React.Fragment,null,n&&React.createElement(T,{variant:n.variant,text:n.text}),v&&React.createElement(T,{variant:"error",text:`${_} does not support your store currency (${u}). Supported currencies: ${j(_).join(", ")}`}),React.createElement($,{onSubmit:he,className:"vippsAdminSettings"},B?React.createElement(me,{isLoading:e}):React.createElement(React.Fragment,null,React.createElement(G,{tabs:c,onTabChange:_e,activeTab:H}),C(c[0])&&React.createElement(ne,null),C(c[1])&&React.createElement(ce,null),f&&C(c[2])&&React.createElement(re,null),C(c[3])&&React.createElement(oe,null),E&&C(c[4])&&React.createElement(pe,null),React.createElement("div",{className:"vipps-mobilepay-react-save-section"},React.createElement(K,{variant:"primary",isLoading:e},t("save_changes")),l&&React.createElement("span",{className:"vipps-mobilepay-react-save-confirmation"},React.createElement("span",{className:"dashicons dashicons-yes"}),t("settings_saved"))))))}function ue(){const e=w("page")==="admin_settings_page";return React.createElement("div",{className:"vipps-mobilepay-react-admin-page"},e&&React.createElement(Q,null,React.createElement(de,null)))}P.createRoot(document.getElementById("vipps-mobilepay-react-ui")).render(h.createElement(h.StrictMode,null,h.createElement(ue,null)))})(wp.element,wp.element);
1 +(function(e,t){var n=document.createElement(`style`);n.textContent=`.vipps-mobilepay-react-admin-page{color:#161225;font-family:Vipps Text,Roboto,Helvetica,Arial,sans-serif}.vipps-mobilepay-react-loading{width:20px;height:20px;display:inline-block;position:relative}.vipps-mobilepay-react-loading div{box-sizing:border-box;border:2px solid #0000;border-top-color:#666;border-radius:50%;width:16px;height:16px;margin:2px;animation:1.2s cubic-bezier(.5,0,.5,1) infinite vipps-mobilepay-react-loading;display:block;position:absolute}.vipps-mobilepay-react-loading div:first-child{animation-delay:-.45s}.vipps-mobilepay-react-loading div:nth-child(2){animation-delay:-.3s}.vipps-mobilepay-react-loading div:nth-child(3){animation-delay:-.15s}@keyframes vipps-mobilepay-react-loading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.vipps-mobilepay-react-form-field{gap:2rem;margin-bottom:2rem;display:flex}.vipps-mobilepay-react-form-field>label{overflow-wrap:break-word;width:20%}@media (width>=860px){.vipps-mobilepay-react-form-field>label{overflow-wrap:normal}}.vipps-mobilepay-react-form-field>div{width:85%}.vipps-mobilepay-react-col{flex-direction:column;gap:.5rem;display:flex}.vipps-mobilepay-react-label{color:#1d2327;font-size:14px;font-weight:600}.vipps-mobilepay-react-tab-description{margin-bottom:1rem}.vipps-mobilepay-react-field-description{color:#666}.vipps-mobilepay-react-button-actions{column-gap:1rem;display:flex}.vipps-mobilepay-react-notification-banner{align-items:center;min-height:40px;padding:1rem;font-size:1rem;display:flex}.vipps-mobilepay-react-notification-banner-error{color:#721c24;background-color:#f8d7da;border:1px solid #f5c6cb}.vipps-mobilepay-react-notification-banner-warning{color:#856404;background-color:#fff3cd;border:1px solid #ffeeba}.vipps-mobilepay-react-notification-banner-success{color:#155724;background-color:#d4edda;border:1px solid #c3e6cb}.vipps-mobilepay-react-save-section{align-items:center;gap:1rem;display:flex}.vipps-mobilepay-react-save-confirmation{color:#2a8947;align-items:center;gap:.5rem;font-weight:500;display:flex}.vipps-mobilepay-react-save-confirmation .dashicons{width:auto;height:auto;font-size:1.2rem}.vipps-mobilepay-form-container{flex-direction:column;align-items:flex-start;gap:3rem;display:flex}@media (width>=420px){.vipps-mobilepay-form-container{flex-direction:column;align-items:center;gap:3rem;display:flex}}@media (width>=700px){.vipps-mobilepay-form-container{align-items:flex-start;gap:1rem,;flex-direction:row}}@media (width>=1280px){.vipps-mobilepay-form-container{gap:3rem}}.vipps-mobilepay-react-form-field{flex-direction:row;justify-content:flex-start;display:flex}.vipps-mobilepay-form-help-box{background-color:#fff;border:1px solid #8c8f94;border-radius:4px;width:13rem;margin-left:auto;margin-right:auto;padding:30px}@media (width>=420px){.vipps-mobilepay-form-help-box{margin-left:0;margin-right:0}}.vipps-mobilepay-form-help-box a{text-wrap:nowrap}.vipps-mobilepay-react-checkout-confirm .body{flex-direction:column;gap:5rem;margin-bottom:2rem;display:flex}@media (width>=870px){.vipps-mobilepay-react-checkout-confirm .body{flex-direction:row;gap:5rem;display:flex}}.vipps-mobilepay-react-checkout-confirm .title{margin-bottom:1em;font-weight:700}.vipps-mobilepay-react-checkout-confirm li{margin-left:1em;list-style:inside}.vipps-mobilepay-react-checkout-confirm img{justify-content:center;align-items:center;width:20rem;margin-right:50px;display:flex}@media (width>=1280px){.vipps-mobilepay-react-checkout-confirm img{width:30rem}}.vipps-mobilepay-react-checkout .title{margin-bottom:1em;font-weight:700}
2 +/*$vite$:1*/`,document.head.appendChild(n);var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},u=(e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));e=u(e,1),t=u(t,1);var d=window;if(!d.VippsMobilePayReactTranslations)throw Error(`VippsMobilePayReactTranslations not found, make sure to include this using wp_localize_script()`);if(!d.VippsMobilePayReactOptions)throw Error(`VippsMobilePayReactOptions not found, make sure to include this using wp_localize_script()`);if(!d.VippsMobilePayReactMetadata)throw Error(`VippsMobilePayReactMetadata not found, make sure to include this using wp_localize_script()`);function f(e){let t=d.VippsMobilePayReactTranslations,n=e.split(`.`);for(let e of n)if(typeof t==`object`&&t)t=t[e];else break;return t===void 0?e:t}function p(e){return d.VippsMobilePayReactMetadata?.[e]??null}var{VippsMobilePayReactTranslations:m,VippsMobilePayReactOptions:h,VippsMobilePayReactMetadata:g}=d;function _({tabs:e,onTabChange:t,activeTab:n}){return React.createElement(`div`,{className:`vippstabholder`,id:`vippstabholder`},e.map((e,r)=>React.createElement(`h3`,{key:r,id:`woocommerce_vipps_${e}_options`,"aria-selected":e===n?`true`:`false`,className:`wc-settings-sub-title tab ${e===n?`active`:``}`,title:e,onClick:()=>t(e),style:{cursor:`pointer`}},e)))}function v(e){switch(e){case`NO`:return`Vipps`;case`SE`:return`Vipps`;case`FI`:return`MobilePay`;case`DK`:return`MobilePay`}return`MobilePay`}function y(e){switch(e){case`Vipps`:return[`NOK`,`SEK`];case`MobilePay`:return[`DKK`,`EUR`];default:return[]}}function b(e,t){return t?y(e).includes(t):!1}var x=(0,e.createContext)(null);function S({children:t}){let[n,r]=(0,e.useState)(h);function i(e){let t=n[e],r=e+`.default`,i=f(r);return t??(i==r?null:i)??``}function a(e){let t=e+`.default`;return f(t)!=t}async function o(e,t){console.log(`setOption called:`,{key:e,value:t}),r(n=>({...n,[e]:t??null}))}async function s(e){r(e)}async function c(e){console.log(`submitChanges - Current values:`,n),e?.forceEnable&&(o(`enabled`,`yes`),n.enabled=`yes`);let t=document.getElementById(`vippsadmin_nonce`).value,r=new URLSearchParams({action:`vipps_update_admin_settings`,vippsadmin_nonce:t});for(let[e,t]of Object.entries(n)){let n=`values[`+e+`]`;t?r.append(n,t):r.append(n,``)}let i=await(await fetch(p(`admin_url`),{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded; charset=UTF-8`},credentials:`include`,body:r.toString()})).json();return console.log(`submitChanges - Server response:`,i),i}return React.createElement(x.Provider,{value:{setOption:o,getOption:i,hasOption:a,setOptions:s,submitChanges:c}},t)}function C(){let t=(0,e.useContext)(x);if(!t)throw Error(`useWP must be used within a WPOptionsProvider`);return t}var w=(e,t)=>e.replace(/Vipps MobilePay Checkout/g,t===`Vipps`?`Vipps Checkout`:`MobilePay Checkout`);function T(){return React.createElement(`div`,{className:`vipps-mobilepay-react-loading`},React.createElement(`div`,null),React.createElement(`div`,null),React.createElement(`div`,null),React.createElement(`div`,null))}function E(e){return React.createElement(`input`,{...e,className:[`input-text regular-input`,e.className??``].join(` `),style:{height:30}},e.children)}function D(e){return React.createElement(`form`,{...e,className:[``,e.className??``].join(` `)},e.children)}function O(e){return React.createElement(`label`,{...e,className:[`vipps-mobilepay-react-label`,e.className??``].join(` `)},e.children)}function k({variant:e,isLoading:t,disabled:n,...r}){return React.createElement(`button`,{...r,disabled:t||n,className:[`button-${e}`,r.className??``].join(` `)},React.createElement(`div`,{style:{display:`flex`,alignItems:`center`}},t&&React.createElement(T,null),React.createElement(`span`,null,r.children)))}function A({id:e,name:t,onChange:n,checked:r,children:i,className:a}){return React.createElement(`input`,{id:e,name:t,checked:r?F(r):void 0,onChange:e=>n(I(e.target.checked)),type:`checkbox`,className:[a??``].join(` `)},i)}function j({error:e,...t}){return React.createElement(`div`,null,React.createElement(`select`,{...t,className:[``,t.className??``,e?`has-error`:``].join(` `)},t.children),e&&React.createElement(`div`,{className:`vipps-mobilepay-react-field-error`},e.split(`
3 +`).map((e,t)=>React.createElement(`div`,{key:t},e))))}function M(e){return React.createElement(`option`,{...e,className:[e.className??``].join(` `)},e.children)}function N(e){return React.createElement(`textarea`,{...e,className:[e.className??``].join(` `)},e.children)}function P(e){return React.createElement(`div`,{...e,className:[`vipps-mobilepay-react-form-field`,e.className??``].join(` `)},e.children)}function F(e){return e===`yes`}function I(e){return e?`yes`:`no`}function L(e){return F(e)?`no`:`yes`}function R({htmlString:e,className:t=``}){return React.createElement(`span`,{className:[t].join(` `),dangerouslySetInnerHTML:{__html:e}})}function z({name:e,titleKey:t,labelKey:n,descriptionKey:r,inverted:i=!1}){let{getOption:a,setOption:o}=C(),s=a(`payment_method_name`);return React.createElement(P,null,React.createElement(O,{htmlFor:e},w(f(t),s)),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(`div`,{className:`vipps-mobilepay-react-row-center`},React.createElement(A,{id:e,name:e,checked:i?L(a(e)):a(e),onChange:t=>i?o(e,L(t)):o(e,t)}),n&&React.createElement(`label`,{htmlFor:e},React.createElement(R,{htmlString:w(f(n),s)}))),r&&React.createElement(R,{className:`vipps-mobilepay-react-field-description`,htmlString:w(f(r),s)})))}function B({name:e,titleKey:t,labelKey:n,descriptionKey:r,options:i,onChange:a,required:o=!1,includeEmptyOption:s=!1,error:c}){let{getOption:l,setOption:u}=C(),d=l(`payment_method_name`);return React.createElement(P,null,React.createElement(O,{htmlFor:e},w(f(t),d)),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(j,{id:e,name:e,onChange:t=>{u(e,t.target.value),a&&a(t)},required:o,value:l(e),error:c},s&&React.createElement(M,{value:``}),i.map(e=>React.createElement(M,{key:e.value,value:e.value},e.label))),React.createElement(`div`,null,n&&React.createElement(R,{htmlString:w(f(n),d)})),r&&React.createElement(R,{className:`vipps-mobilepay-react-field-description`,htmlString:w(f(r),d)})))}function V({name:t,titleKey:n,labelKey:r,descriptionKey:i,pattern:a,required:o,asterisk:s,type:c=`text`}){let{getOption:l,setOption:u}=C(),[d,p]=(0,e.useState)(!1),m=!d&&s,h=l(`payment_method_name`);return React.createElement(P,null,React.createElement(O,{htmlFor:t},w(f(n),h)),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(E,{id:t,name:t,onChange:e=>u(t,e.target.value),value:l(t),pattern:a,required:o,onFocus:()=>p(!0),onBlur:()=>p(!1),type:m?`password`:c}),React.createElement(`div`,null,r&&React.createElement(R,{htmlString:w(f(r),h)})),i&&React.createElement(R,{className:`vipps-mobilepay-react-field-description`,htmlString:w(f(i),h)})))}function H({name:e,titleKey:t,labelKey:n,descriptionKey:r,rows:i=5}){let{getOption:a,setOption:o}=C(),s=a(`payment_method_name`);return React.createElement(P,null,React.createElement(O,{htmlFor:e},w(f(t),s)),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(N,{id:e,name:e,onChange:t=>o(e,t.target.value),value:a(e),rows:i}),React.createElement(`div`,null,n&&React.createElement(R,{htmlString:w(f(n),s)})),r&&React.createElement(R,{className:`vipps-mobilepay-react-field-description`,htmlString:w(f(r),s)})))}function U(){let{setOption:e,getOption:t}=C();return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`}),React.createElement(z,{name:`enabled`,titleKey:`enabled.title`,labelKey:`enabled.label`}),React.createElement(B,{name:`country`,titleKey:`country.title`,descriptionKey:`country.description`,includeEmptyOption:!1,required:!0,onChange:n=>{let r=v(n.target.value);t(`payment_method_name`)||e(`payment_method_name`,r)},options:[{label:f(`country.options.NO`),value:`NO`},{label:f(`country.options.SE`),value:`SE`},{label:f(`country.options.FI`),value:`FI`},{label:f(`country.options.DK`),value:`DK`}]}),React.createElement(B,{name:`payment_method_name`,titleKey:`payment_method_name.title`,descriptionKey:`payment_method_name.description`,includeEmptyOption:!1,required:!0,error:b(t(`payment_method_name`),p(`currency`))?void 0:`${t(`payment_method_name`)} does not support your store currency (${p(`currency`)}). Supported currencies: ${y(t(`payment_method_name`)).join(`, `)}`,options:[{label:f(`payment_method_name.options.Vipps`),value:`Vipps`},{label:f(`payment_method_name.options.MobilePay`),value:`MobilePay`}]}),React.createElement(V,{name:`orderprefix`,titleKey:`orderprefix.title`,descriptionKey:`orderprefix.description`,pattern:`[a-zA-Z0-9-]+`,required:!0}),React.createElement(V,{asterisk:!0,name:`merchantSerialNumber`,titleKey:`merchantSerialNumber.title`,descriptionKey:`merchantSerialNumber.description`}),React.createElement(V,{asterisk:!0,name:`clientId`,titleKey:`clientId.title`,descriptionKey:`clientId.description`}),React.createElement(V,{asterisk:!0,name:`secret`,titleKey:`secret.title`,descriptionKey:`secret.description`}),React.createElement(V,{asterisk:!0,name:`Ocp_Apim_Key_eCommerce`,titleKey:`Ocp_Apim_Key_eCommerce.title`,descriptionKey:`Ocp_Apim_Key_eCommerce.description`}),React.createElement(B,{name:`result_status`,titleKey:`result_status.title`,descriptionKey:`result_status.description`,options:[{label:f(`result_status.options.on-hold`),value:`on-hold`},{label:f(`result_status.options.processing`),value:`processing`}]}),React.createElement(B,{name:`status_on_fail`,titleKey:`status_on_fail.title`,descriptionKey:`status_on_fail.description`,options:[{label:f(`status_on_fail.options.failed`),value:`failed`},{label:f(`status_on_fail.options.cancelled`),value:`cancelled`}]}),React.createElement(H,{name:`description`,titleKey:`description.title`,descriptionKey:`description.description`,rows:5}),React.createElement(z,{name:`vippsdefault`,titleKey:`vippsdefault.title`,labelKey:`vippsdefault.label`}))}function W(){let{getOption:e}=C();return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`},f(`cc_options.description`)),F(e(`testmode`))&&React.createElement(`div`,{style:{border:`2px solid red`,padding:`.5rem`,marginBottom:`2rem`}},React.createElement(`p`,null,React.createElement(R,{htmlString:f(`cc_options.test_mode_warning`)}))),React.createElement(z,{name:`cc_enabled`,titleKey:`cc_enabled.title`,labelKey:`cc_enabled.label`}),React.createElement(H,{name:`cc_description`,titleKey:`cc_description.title`,descriptionKey:`cc_description.description`,rows:5}))}function G(){return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`},f(`express_options.description`)),React.createElement(z,{name:`cartexpress`,titleKey:`cartexpress.title`,labelKey:`cartexpress.title`,descriptionKey:`cartexpress.description`}),React.createElement(z,{name:`express_show_in_checkout`,titleKey:`express_show_in_checkout.title`,labelKey:`express_show_in_checkout.title`,descriptionKey:`express_show_in_checkout.description`}),React.createElement(B,{name:`singleproductexpress`,titleKey:`singleproductexpress.title`,descriptionKey:`singleproductexpress.description`,options:[{value:`none`,label:f(`singleproductexpress.options.none`)},{value:`some`,label:f(`singleproductexpress.options.some`)},{value:`all`,label:f(`singleproductexpress.options.all`)}]}),React.createElement(z,{name:`singleproductexpressarchives`,titleKey:`singleproductexpressarchives.title`,labelKey:`singleproductexpressarchives.label`,descriptionKey:`singleproductexpressarchives.description`}),React.createElement(z,{name:`expresscheckout_termscheckbox`,titleKey:`expresscheckout_termscheckbox.title`,labelKey:`expresscheckout_termscheckbox.label`,descriptionKey:`expresscheckout_termscheckbox.description`}),React.createElement(z,{name:`expresscheckout_always_address`,titleKey:`expresscheckout_always_address.title`,labelKey:`expresscheckout_always_address.label`,descriptionKey:`expresscheckout_always_address.description`}),React.createElement(z,{name:`enablestaticshipping`,titleKey:`enablestaticshipping.title`,labelKey:`enablestaticshipping.label`,descriptionKey:`enablestaticshipping.description`}),React.createElement(z,{name:`expresscreateuser`,titleKey:`expresscreateuser.title`,labelKey:`expresscreateuser.label`,descriptionKey:`expresscreateuser.description`}),React.createElement(z,{name:`singleproductbuynowcompatmode`,titleKey:`singleproductbuynowcompatmode.title`,labelKey:`singleproductbuynowcompatmode.label`,descriptionKey:`singleproductbuynowcompatmode.description`}),React.createElement(z,{name:`deletefailedexpressorders`,titleKey:`deletefailedexpressorders.title`,labelKey:`deletefailedexpressorders.label`,descriptionKey:`deletefailedexpressorders.description`}))}function K(){let{getOption:e,hasOption:t}=C(),n=e(`vcs_porterbuddy`)===`yes`,r=e(`vcs_helthjem`)===`yes`,i=t(`checkout_external_payments_klarna`),a=i,o=e(`payment_method_name`);return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`},React.createElement(R,{htmlString:w(f(`checkout_options.description`),o)})),React.createElement(`div`,{style:{border:`2px solid red`,padding:`1.5rem`,marginBottom:`2rem`}},React.createElement(`h3`,null,w(f(`kustom_sale_1`),o)),React.createElement(`p`,null,React.createElement(R,{htmlString:w(f(`kustom_sale_2`),o)})),React.createElement(`p`,null,React.createElement(R,{htmlString:w(f(`kustom_sale_3`),o)})),React.createElement(`p`,null,React.createElement(R,{htmlString:w(f(`kustom_sale_4`),o)})),React.createElement(`p`,null,React.createElement(R,{htmlString:w(f(`kustom_sale_5`),o)})),React.createElement(`p`,null,React.createElement(R,{htmlString:w(f(`kustom_sale_6`),o)}))),React.createElement(z,{name:`vipps_checkout_enabled`,titleKey:`vipps_checkout_enabled.title`,labelKey:`vipps_checkout_enabled.label`,descriptionKey:`vipps_checkout_enabled.description`}),React.createElement(z,{name:`checkoutcreateuser`,titleKey:`checkoutcreateuser.title`,labelKey:`checkoutcreateuser.label`,descriptionKey:`checkoutcreateuser.description`}),React.createElement(z,{name:`enablestaticshipping_checkout`,titleKey:`enablestaticshipping_checkout.title`,labelKey:`enablestaticshipping_checkout.label`,descriptionKey:`enablestaticshipping_checkout.description`}),React.createElement(z,{name:`requireUserInfo_checkout`,titleKey:`requireUserInfo_checkout.title`,labelKey:`requireUserInfo_checkout.label`,descriptionKey:`requireUserInfo_checkout.description`}),React.createElement(z,{name:`noAddressFields`,titleKey:`noAddressFields.title`,labelKey:`noAddressFields.label`,descriptionKey:`noAddressFields.description`}),React.createElement(z,{name:`noContactFields`,titleKey:`noContactFields.title`,labelKey:`noContactFields.label`,descriptionKey:`noContactFields.description`}),React.createElement(`h3`,{className:`vipps-mobilepay-react-tab-description`},w(f(`checkout_widgets.title`),o)),React.createElement(`p`,null,w(f(`checkout_widgets.description`),o)),f(`checkout_widget_coupon.title`)==`checkout_widget_coupon.title`?[]:React.createElement(z,{name:`checkout_widget_coupon`,titleKey:`checkout_widget_coupon.title`,descriptionKey:`checkout_widget_coupon.description`,labelKey:`checkout_widget_coupon.label`}),React.createElement(z,{name:`checkout_widget_ordernotes`,titleKey:`checkout_widget_ordernotes.title`,descriptionKey:`checkout_widget_ordernotes.description`,labelKey:`checkout_widget_ordernotes.label`}),a&&React.createElement(React.Fragment,null,React.createElement(`h3`,{className:`vipps-mobilepay-react-trab-description`},w(f(`checkout_external_payment_title.title`),o)),React.createElement(`p`,null,w(f(`checkout_external_payment_title.description`),o)),i&&React.createElement(z,{name:`checkout_external_payments_klarna`,titleKey:`checkout_external_payments_klarna.title`,labelKey:`checkout_external_payments_klarna.label`,descriptionKey:`checkout_external_payments_klarna.description`})),React.createElement(`h3`,{className:`vipps-mobilepay-react-tab-description`},w(f(`checkout_shipping.title`),o)),React.createElement(`p`,null,w(f(`checkout_shipping.description`),o)),React.createElement(z,{name:`vcs_posten`,titleKey:`vcs_posten.title`,descriptionKey:`vcs_posten.description`,labelKey:`vcs_posten.label`}),React.createElement(z,{name:`vcs_postnord`,titleKey:`vcs_postnord.title`,descriptionKey:`vcs_postnord.description`,labelKey:`vcs_postnord.label`}),React.createElement(z,{name:`vcs_porterbuddy`,titleKey:`vcs_porterbuddy.title`,descriptionKey:`vcs_porterbuddy.description`,labelKey:`vcs_porterbuddy.label`}),n&&React.createElement(React.Fragment,null,React.createElement(V,{asterisk:!0,name:`vcs_porterbuddy_publicToken`,titleKey:`vcs_porterbuddy_publicToken.title`,descriptionKey:`vcs_porterbuddy_publicToken.description`}),React.createElement(V,{asterisk:!0,name:`vcs_porterbuddy_apiKey`,titleKey:`vcs_porterbuddy_apiKey.title`,descriptionKey:`vcs_porterbuddy_apiKey.description`}),React.createElement(V,{name:`vcs_porterbuddy_phoneNumber`,titleKey:`vcs_porterbuddy_phoneNumber.title`,descriptionKey:`vcs_porterbuddy_phoneNumber.description`})),React.createElement(z,{name:`vcs_helthjem`,titleKey:`vcs_helthjem.title`,descriptionKey:`vcs_helthjem.description`,labelKey:`vcs_helthjem.label`}),r&&React.createElement(React.Fragment,null,React.createElement(V,{type:`number`,name:`vcs_helthjem_shopId`,titleKey:`vcs_helthjem_shopId.title`,descriptionKey:`vcs_helthjem_shopId.description`}),React.createElement(V,{name:`vcs_helthjem_username`,titleKey:`vcs_helthjem_username.title`,descriptionKey:`vcs_helthjem_username.description`}),React.createElement(V,{asterisk:!0,name:`vcs_helthjem_password`,titleKey:`vcs_helthjem_password.title`,descriptionKey:`vcs_helthjem_password.description`})))}function q({onUpload:e}){return{handleImageUpload:()=>{let t=wp.media({library:{type:`image`},button:{},multiple:!1});t.on(`select`,()=>{let n=t.state().get(`selection`).first().toJSON(),r=``;n.url?r=n.url:n.sizes&&n.sizes.thumbnail&&(r=n.sizes.thumbnail.url),r&&e(n.id,r)}),t.open()}}}function J({variant:e,text:t}){return React.createElement(`div`,{className:`vipps-mobilepay-react-notification-banner vipps-mobilepay-react-notification-banner-${e}`},Array.isArray(t)?t.map((e,t)=>React.createElement(`p`,{key:t},e)):React.createElement(`p`,null,t))}function Y(){let{getOption:t,setOption:n}=C(),[r,i]=(0,e.useState)(null),[a]=(0,e.useState)(t(`vippsspecialpagetemplate`));function o(){n(`receiptimage`,``),n(`receiptimage_url`,``),i(null)}let{handleImageUpload:s}=q({onUpload(e,t){let r=new Image;r.src=t,r.onload=()=>{if(r.height<167){i(f(`receipt_image_error`));return}i(null),console.log(`Image Upload - Setting values:`,{id:e,url:t}),n(`receiptimage`,e),n(`receiptimage_url`,t)}}}),c=t(`receiptimage`),l=t(`receiptimage_url`);return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`},f(`advanced_options.description`)),React.createElement(B,{name:`checkout_phone_transformation`,titleKey:`checkout_phone_transformation.title`,descriptionKey:`checkout_phone_transformation.description`,options:[{label:f(`checkout_phone_transformation.options.none`),value:`none`},{label:f(`checkout_phone_transformation.options.ensure_plus`),value:`ensure_plus`},{label:f(`checkout_phone_transformation.options.strip_country_code`),value:`strip_country_code`}]}),React.createElement(z,{labelKey:`vippsorderattribution.label`,name:`vippsorderattribution`,titleKey:`vippsorderattribution.title`,descriptionKey:`vippsorderattribution.description`}),a&&React.createElement(B,{name:`vippsspecialpagetemplate`,titleKey:`vippsspecialpagetemplate.title`,descriptionKey:`vippsspecialpagetemplate.description`,options:Object.entries(f(`vippsspecialpagetemplate.options`)).map(([e,t])=>({label:t,value:e||``}))}),React.createElement(z,{name:`sendreceipts`,titleKey:`sendreceipts.title`,labelKey:`sendreceipts.label`,descriptionKey:`sendreceipts.description`}),r&&React.createElement(J,{variant:`error`,text:r}),React.createElement(P,null,React.createElement(O,{htmlFor:`woocommerce_vipps_receiptimage`},f(`receiptimage.title`)),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(`div`,null,c?React.createElement(React.Fragment,null,React.createElement(`img`,{src:l,id:c,style:{width:200}}),React.createElement(k,{type:`button`,onClick:o,variant:`link`},f(`remove_image`))):React.createElement(k,{type:`button`,onClick:s,variant:`link`},f(`upload_image`)),React.createElement(`input`,{type:`hidden`,name:`woocommerce_vipps_receiptimage`,id:`woocommerce_vipps_receiptimage`,value:c})),React.createElement(`span`,{className:`vipps-mobilepay-react-field-description`},f(`receiptimage.description`),React.createElement(`br`,null),React.createElement(`small`,null,f(`receipt_image_size_requirement`))))),React.createElement(z,{name:`use_flock`,titleKey:`use_flock.title`,descriptionKey:`use_flock.description`,labelKey:`use_flock.label`}),React.createElement(z,{name:`delete_settings_on_deactivation`,titleKey:`delete_settings_on_deactivation.title`,descriptionKey:`delete_settings_on_deactivation.description`,labelKey:`delete_settings_on_deactivation.label`}),React.createElement(z,{name:`developermode`,titleKey:`developermode.title`,descriptionKey:`developermode.description`,labelKey:`developermode.label`}))}function X(t){let[n,r]=(0,e.useState)(()=>window.location.hash),i=(0,e.useCallback)(()=>{r(window.location.hash)},[]);(0,e.useEffect)(()=>(window.addEventListener(`hashchange`,i),()=>{window.removeEventListener(`hashchange`,i)}),[i]);let a=(0,e.useCallback)(e=>{e!==n&&(window.location.hash=`#`+e)},[n]);return(0,e.useEffect)(()=>{!n&&t&&a(t)},[n,t,a]),[decodeURIComponent(n.replace(`#`,``)),a]}function Z(){return React.createElement(`div`,null,React.createElement(`p`,{className:`vipps-mobilepay-react-tab-description`},f(`developertitle.description`)),React.createElement(z,{name:`testmode`,titleKey:`testmode.title`,descriptionKey:`testmode.description`,labelKey:`testmode.label`}),React.createElement(V,{name:`merchantSerialNumber_test`,titleKey:`merchantSerialNumber_test.title`,labelKey:`merchantSerialNumber_test.description`}),React.createElement(V,{asterisk:!0,name:`clientId_test`,titleKey:`clientId_test.title`,labelKey:`clientId_test.description`}),React.createElement(V,{asterisk:!0,name:`secret_test`,titleKey:`secret_test.title`,labelKey:`secret_test.description`}),React.createElement(V,{asterisk:!0,name:`Ocp_Apim_Key_eCommerce_test`,titleKey:`Ocp_Apim_Key_eCommerce_test.title`,labelKey:`Ocp_Apim_Key_eCommerce_test.description`}))}function Q({isLoading:t}){let{getOption:n,setOption:r,hasOption:i}=C(),[a,o]=(0,e.useState)(`ESSENTIAL`),[s,c]=(0,e.useState)(`ESSENTIAL`),l=n(`vcs_porterbuddy`)===`yes`,u=n(`vcs_helthjem`)===`yes`,d=i(`checkout_external_payments_klarna`),p=d,m=n(`payment_method_name`);return React.createElement(React.Fragment,null,a===`ESSENTIAL`&&React.createElement(React.Fragment,null,React.createElement(`h3`,{className:`vipps-mobilepay-react-tab-description`},f(`wizard_header.title`)),React.createElement(`p`,null,f(`wizard_header.description`)),React.createElement(`div`,{className:`vipps-mobilepay-form-container`},React.createElement(`div`,{className:`vipps-mobilepay-form-col`},React.createElement(B,{name:`country`,titleKey:`country.title`,descriptionKey:`country.description`,onChange:e=>{r(`payment_method_name`,v(e.target.value))},required:!0,includeEmptyOption:!1,options:[{label:f(`country.options.NO`),value:`NO`},{label:f(`country.options.SE`),value:`SE`},{label:f(`country.options.FI`),value:`FI`},{label:f(`country.options.DK`),value:`DK`}]}),React.createElement(B,{name:`payment_method_name`,titleKey:`payment_method_name.title`,descriptionKey:`payment_method_name.description`,required:!0,includeEmptyOption:!1,options:[{label:f(`payment_method_name.options.Vipps`),value:`Vipps`},{label:f(`payment_method_name.options.MobilePay`),value:`MobilePay`}]}),React.createElement(V,{asterisk:!0,name:`merchantSerialNumber`,titleKey:`merchantSerialNumber.title`,descriptionKey:`merchantSerialNumber.description`,required:!0}),React.createElement(V,{asterisk:!0,name:`clientId`,titleKey:`clientId.title`,descriptionKey:`clientId.description`,required:!0}),React.createElement(V,{asterisk:!0,name:`secret`,titleKey:`secret.title`,descriptionKey:`secret.description`,required:!0}),React.createElement(V,{asterisk:!0,name:`Ocp_Apim_Key_eCommerce`,titleKey:`Ocp_Apim_Key_eCommerce.title`,descriptionKey:`Ocp_Apim_Key_eCommerce.description`,required:!0}),React.createElement(P,null,React.createElement(O,null),React.createElement(`div`,{className:`vipps-mobilepay-react-col`},React.createElement(k,{style:{alignSelf:`flex-start`},variant:`primary`,type:`button`,onClick:e=>{e.preventDefault();let t=e.currentTarget.closest(`form`);if(!t)throw Error(`Form not found`);t.reportValidity()&&(c(a),F(n(`vipps_checkout_enabled`))?o(`CHECKOUT`):o(`EXPRESS`))}},F(n(`vipps_checkout_enabled`))?f(`next_step`):w(f(`save_changes`),m))))),React.createElement(`div`,{className:`vipps-mobilepay-form-col vipps-mobilepay-form-help-box`},React.createElement(`div`,null,React.createElement(`strong`,{className:`title`},f(`help_box.get_started`)),React.createElement(`br`,null),React.createElement(`a`,{href:`https://wordpress.org/plugins/woo-vipps/`,target:`_blank`},f(`help_box.documentation`)),React.createElement(`br`,null),React.createElement(`a`,{href:`https://portal.vippsmobilepay.com`,target:`_blank`},f(`help_box.portal`))),React.createElement(`br`,null),React.createElement(`div`,null,React.createElement(`strong`,{className:`title`},f(`help_box.support.title`)),React.createElement(`br`,null),React.createElement(R,{htmlString:f(`help_box.support.description`)}))))),a===`CHECKOUT`&&React.createElement(React.Fragment,null,React.createElement(`div`,{className:`vipps-mobilepay-react-checkout-confirm`},React.createElement(`h1`,{className:`vipps-mobilepay-react-tab-description title`},w(f(`checkout_options_wizard.title`),m)),React.createElement(`p`,null,w(f(`checkout_options_wizard.description`),m)),React.createElement(z,{name:`checkoutcreateuser`,titleKey:`checkoutcreateuser_wizard.title`,labelKey:`checkoutcreateuser_wizard.label`,descriptionKey:`checkoutcreateuser_wizard.description`}),React.createElement(z,{name:`enablestaticshipping_checkout`,titleKey:`enablestaticshipping_checkout_wizard.title`,labelKey:`enablestaticshipping_checkout_wizard.label`,descriptionKey:`enablestaticshipping_checkout_wizard.description`,inverted:!0}),React.createElement(z,{name:`noAddressFields`,titleKey:`noAddressFields_wizard.title`,labelKey:`noAddressFields_wizard.label`,descriptionKey:`noAddressFields_wizard.description`,inverted:!0}),React.createElement(`h3`,{className:`vipps-mobilepay-react-tab-description`},w(f(`checkout_shipping_wizard.title`),m)),React.createElement(`p`,null,w(f(`checkout_shipping_wizard.description`),m)),React.createElement(z,{name:`vcs_posten`,titleKey:`vcs_posten_wizard.title`,labelKey:`vcs_posten_wizard.label`,descriptionKey:`vcs_posten_wizard.description`}),React.createElement(z,{name:`vcs_postnord`,titleKey:`vcs_postnord_wizard.title`,labelKey:`vcs_postnord_wizard.label`,descriptionKey:`vcs_postnord_wizard.description`}),React.createElement(z,{name:`vcs_porterbuddy`,titleKey:`vcs_porterbuddy_wizard.title`,labelKey:`vcs_porterbuddy_wizard.label`,descriptionKey:`vcs_porterbuddy_wizard.description`}),l&&React.createElement(React.Fragment,null,React.createElement(V,{asterisk:!0,name:`vcs_porterbuddy_publicToken`,titleKey:`vcs_porterbuddy_publicToken.title`,descriptionKey:`vcs_porterbuddy_publicToken.description`}),React.createElement(V,{asterisk:!0,name:`vcs_porterbuddy_apiKey`,titleKey:`vcs_porterbuddy_apiKey.title`,descriptionKey:`vcs_porterbuddy_apiKey.description`}),React.createElement(V,{name:`vcs_porterbuddy_phoneNumber`,titleKey:`vcs_porterbuddy_phoneNumber.title`,descriptionKey:`vcs_porterbuddy_phoneNumber.description`})),React.createElement(z,{name:`vcs_helthjem`,titleKey:`vcs_helthjem_wizard.title`,labelKey:`vcs_helthjem_wizard.label`,descriptionKey:`vcs_helthjem_wizard.description`}),u&&React.createElement(React.Fragment,null,React.createElement(V,{type:`number`,name:`vcs_helthjem_shopId`,titleKey:`vcs_helthjem_shopId.title`,descriptionKey:`vcs_helthjem_shopId.description`}),React.createElement(V,{name:`vcs_helthjem_username`,titleKey:`vcs_helthjem_username.title`,descriptionKey:`vcs_helthjem_username.description`}),React.createElement(V,{asterisk:!0,name:`vcs_helthjem_password`,titleKey:`vcs_helthjem_password.title`,descriptionKey:`vcs_helthjem_password.description`})),p&&React.createElement(React.Fragment,null,React.createElement(`h3`,{className:`vipps-mobilepay-react-trab-description`},w(f(`checkout_external_payment_title.title`),m)),React.createElement(`p`,null,w(f(`checkout_external_payment_title.description`),m)),d&&React.createElement(z,{name:`checkout_external_payments_klarna`,titleKey:`checkout_external_payments_klarna.title`,labelKey:`checkout_external_payments_klarna.label`,descriptionKey:`checkout_external_payments_klarna.description`})),React.createElement(`div`,{className:`vipps-mobilepay-react-button-actions`},React.createElement(k,{variant:`secondary`,type:`button`,onClick:()=>{o(s),c(`ESSENTIAL`)}},w(f(`previous_step`),m)),React.createElement(k,{variant:`primary`,isLoading:t},w(f(`save_changes`),m))))),a===`EXPRESS`&&React.createElement(React.Fragment,null,React.createElement(`div`,{className:`vipps-mobilepay-react-express-confirm`},React.createElement(`h1`,{className:`vipps-mobilepay-react-tab-description title`},f(`express_options_wizard.title`)),React.createElement(`p`,null,f(`express_options_wizard.description`)),React.createElement(`p`,null,React.createElement(`a`,{href:`https://vippsmobilepay.com/nb-NO/express`},f(`express_options_wizard.readmore`))),React.createElement(z,{name:`cartexpress`,titleKey:`cartexpress.title`,labelKey:`cartexpress.label`}),React.createElement(z,{name:`express_show_in_checkout`,titleKey:`express_show_in_checkout.title`,labelKey:`express_show_in_checkout.label`}),React.createElement(B,{name:`singleproductexpress`,titleKey:`singleproductexpress.title`,descriptionKey:`singleproductexpress.description`,required:!0,includeEmptyOption:!1,options:Object.entries(f(`singleproductexpress`)?.options??{}).map(([e,t])=>({value:e,label:t}))}),React.createElement(z,{name:`singleproductexpressarchives`,titleKey:`singleproductexpressarchives_wizard.title`,labelKey:`singleproductexpressarchives_wizard.label`,descriptionKey:`singleproductexpressarchives.description`}),React.createElement(`div`,{className:`vipps-mobilepay-react-button-actions`},React.createElement(k,{variant:`secondary`,type:`button`,onClick:()=>{o(s),c(`ESSENTIAL`)}},f(`previous_step`)),React.createElement(k,{variant:`primary`,isLoading:t},f(`save_changes`))))))}function $(){let[t,n]=(0,e.useState)(!1),[r,i]=(0,e.useState)(),[a,o]=(0,e.useState)(!1),{submitChanges:s,getOption:c,setOptions:l}=C(),u=p(`currency`),d=c(`payment_method_name`),m=!b(d,u),h=f(`main_options.title`),g=f(`express_options.title`),v=f(`cc_options.title`),x=f(`checkout_options.title`),S=f(`developertitle.title`),w=f(`advanced_options.title`),T=[h,g,v],E=+(p(`vipps_checkout_activated`)??0)||c(`vipps_checkout_enabled`)==`yes`;E&&T.push(x),T.push(w);let O=c(`developermode`)===`yes`;O&&T.push(S);let A=p(`__dev_force_wizard_screen`)||``,j=[`1`,`yes`,`true`,`TRUE`].includes(A),[M,N]=X(h);function P(e){return e===M}async function I(e){e.preventDefault(),n(!0),o(!1);try{let e=await s({forceEnable:R});console.log(`handleSaveSettings - Response data:`,e),!e.connection_ok||!e.form_ok?(i({text:e.connection_msg||e.form_errors,variant:`error`}),o(!1)):(i({text:e.connection_msg,variant:`success`}),o(!0),console.log(`handleSaveSettings - Setting new options:`,e.options),await l(e.options),z(L()),setTimeout(()=>{o(!1)},2e3))}catch(e){console.error(`handleSaveSettings - Error:`,e),i({text:e.message,variant:`error`}),o(!1)}finally{n(!1)}}function L(){let e=c(`merchantSerialNumber`)&&c(`clientId`)&&c(`secret`)&&c(`Ocp_Apim_Key_eCommerce`)&&c(`country`)&&c(`payment_method_name`),t=F(c(`testmode`)),n=c(`merchantSerialNumber_test`)&&c(`clientId_test`)&&c(`secret_test`)&&c(`Ocp_Apim_Key_eCommerce_test`)&&c(`payment_method_name`)&&c(`country`);return!e&&!n&&!t}let[R,z]=(0,e.useState)(()=>j||L());return React.createElement(React.Fragment,null,r&&React.createElement(J,{variant:r.variant,text:r.text}),m&&React.createElement(J,{variant:`error`,text:`${d} does not support your store currency (${u}). Supported currencies: ${y(d).join(`, `)}`}),React.createElement(D,{onSubmit:I,className:`vippsAdminSettings`},R?React.createElement(Q,{isLoading:t}):React.createElement(React.Fragment,null,React.createElement(_,{tabs:T,onTabChange:N,activeTab:M}),P(h)&&React.createElement(U,null),P(g)&&React.createElement(G,null),P(v)&&React.createElement(W,null),E&&P(x)&&React.createElement(K,null),P(w)&&React.createElement(Y,null),O&&P(S)&&React.createElement(Z,null),React.createElement(`div`,{className:`vipps-mobilepay-react-save-section`},React.createElement(k,{variant:`primary`,isLoading:t},f(`save_changes`)),a&&React.createElement(`span`,{className:`vipps-mobilepay-react-save-confirmation`},React.createElement(`span`,{className:`dashicons dashicons-yes`}),f(`settings_saved`))))))}function ee(){let e=p(`page`)===`admin_settings_page`;return React.createElement(`div`,{className:`vipps-mobilepay-react-admin-page`},e&&React.createElement(S,null,React.createElement($,null)))}t.default.createRoot(document.getElementById(`vipps-mobilepay-react-ui`)).render(e.default.createElement(e.default.StrictMode,null,e.default.createElement(ee,null)))})(wp.element,wp.element);