PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
← All changes | admin-legacy-core/assets/build/settings-app.js +1 -1 3.1.4 → 3.3.0 View file →
@@ -44,9 +44,9 @@
44 44 (0,z.__)("This action will hide this archived variation from the list of steps, but its analytics will be visible. %1$s Do you want to hide this archived variation?","cartflows"),"\n"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})){g(!0);const e=new window.FormData;e.append("action","cartflows_hide_archive_ab_test_variation"),e.append("security",cartflows_admin.hide_archive_ab_test_variation_nonce),e.append("step_id",r),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(()=>{window.location.reload(),g(!1)})}},y=async function(e){if(e.preventDefault(),await p({title:(0,z.__)("Trash Archived Variation","cartflows"),description:(0,z.sprintf)(/* translators: %1$s is replaced with the HTML tag */ /* translators: %1$s is replaced with the HTML tag */
45 45 (0,z.__)("This action will delete this archived variation and its analytics data permanently. %1$s Do you want to delete this archived variation?","cartflows"),"\n"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})){g(!0);const e=new window.FormData;e.append("action","cartflows_permanent_delete_archive_ab_test_variation"),e.append("security",cartflows_admin.permanent_delete_archive_ab_test_variation_nonce),e.append("step_id",r),e.append("flow_id",n),e.append("control_id",i),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(()=>{window.location.reload(),g(!1)})}};return"1"===l?null:(0,e.createElement)("div",{className:"wcf-archived-step flex items-center gap-2 py-4","data-id":r},(0,e.createElement)("div",{className:"wcf-archive-step--sortable-toggle flex text-gray-300 disabled pointer-events-none"},(0,e.createElement)(qc,{className:"w-5 h-5 stroke-1","aria-hidden":"true"}),(0,e.createElement)(qc,{className:"w-5 h-5 stroke-1 -ml-3.5","aria-hidden":"true"})),(0,e.createElement)("div",{className:"wcf-step flex justify-between items-center w-full "+(m?"step-overlay":"")},(0,e.createElement)("div",{className:"wcf-archive-step--content flex items-center gap-4 w-[55%]"},(0,e.createElement)("img",{src:function(){let e="";switch(d){case"landing":e=XT;break;case"checkout":e=JT;break;case"optin":e=KT;break;case"thankyou":e=eA;break;case"upsell":e=$T;break;case"downsell":e=qT}return e}(),alt:d,className:"rounded-lg w-[72px] h-[72px]"}),(0,e.createElement)("div",{className:"wcf-archive-step--title-wrap flex flex-col gap-1"},(0,e.createElement)("div",{className:"wcf-archive-step--col-tags flex items-center gap-2"},(0,e.createElement)("span",{className:"text-base font-normal text-gray-400 capitalize mr-2"},"thankyou"===d?(0,z.__)("Thank You","cartflows"):d),function(){let t="",a="";return o?(t=(0,z.__)("Deleted On: ","cartflows"),a="bg-red-500"):(t=(0,z.__)("Archived On: ","cartflows"),a="bg-gray-800"),(0,e.createElement)("span",{className:`wcf-step-badge text-white text-xs px-2.5 py-1 rounded-full ${a}`},t+c)}()),(0,e.createElement)("div",{className:"wcf-archive-step--title"},(0,e.createElement)("span",{className:"font-semibold text-lg text-gray-800 cursor-default"},Mn(s,cartflows_admin.title_length.max,cartflows_admin.title_length.display_length))))),(0,e.createElement)("div",{className:"wcf-archive-step--col"},(0,e.createElement)("div",{className:"wcf-archive-step--actions"},(0,e.createElement)("div",{className:"wcf-archive-step--action__btns-wrapper"},(0,e.createElement)("div",{className:"wcf-archive-step--basic-action__btns flex items-center gap-3"},u.map(t=>{let a,r;switch(t.slug){case"restore":a=f,r=(0,e.createElement)(HE,{className:"w-18 h-18 stroke-2"});break;case"delete":a=h,r=(0,e.createElement)(au,{className:"w-18 h-18 stroke-2"});break;case"hide":a=M,r=(0,e.createElement)(dA,{className:"w-18 h-18 stroke-2"});break;case"deleteArch":a=y,r=(0,e.createElement)(au,{className:"w-18 h-18 stroke-2"})}return(0,e.createElement)(e.Fragment,null,t?.before_text&&(0,e.createElement)("span",{className:"wcf-step__action-before-text"},t?.before_text),(0,e.createElement)("a",{href:t?.link,className:`wcf-step__action-btn text-gray-400 hover:text-primary-500 p-1 flex gap-2 ${t?.class}`,title:t?.text,onClick:a},r,t?.text))})))))))},gA=function(a){const{flow_id:r,control_id:n,archived_variations:i,type:s}=a,[o,l]=(0,t.useState)(!1);return(0,e.createElement)("div",{className:"wcf-archived-wrapper p-4 bg-white w-full rounded-b-lg"},(0,e.createElement)("span",{id:"wcf-archived-button",onClick:function(){l(!o)},className:`text-gray-800 text-sm flex items-center gap-1 cursor-pointer p-1 ${o?"is-active":""} `},(0,z.__)("Archived Steps","cartflows"),o?(0,e.createElement)(Ew,{className:"w-4 h-4 stroke-1 mt-0.5","aria-hidden":"true"}):(0,e.createElement)(Tw,{className:"w-4 h-4 stroke-1 mt-0.5","aria-hidden":"true"})),o&&(0,e.createElement)("div",{className:"wcf-archived-steps divide-y divide-gray-200"},i.map(t=>{const a={step_id:t.id,flow_id:r,control_id:n,title:t.title,note:t.note,deleted:t.deleted,hide:t.hide,date:t.date,type:s,actions:Object.values(t.actions)};return(0,e.createElement)(mA,(0,M.A)({},a,{key:t.id}))})))},pA=function(t){const[{is_cf_pro:a,global_checkout:r,flow_id:n,flow_type:i}]=Bc(),{id:s,title:o,type:l,actions:c,menu_actions:u,ajaxcall:d,offer_yes_next_step:m,offer_no_next_step:g,invalid:p=!1,step_disabled:f=!1,setShowAbtestUpgradePopup:h=()=>{}}=t,y=!!p,N=s;"storeCheckout"===i&&(["checkout"].includes(l)&&(delete u.clone,y||delete u.delete),y&&(delete u.clone,delete u.abtest));let w=!1,x=!1,b=[],D=[],v=0;wcfCartflowsTypePro()&&(w=!!t["ab-test-ui"]&&t["ab-test-ui"],x=!!t["ab-test-start"]&&t["ab-test-start"],b=t["ab-test-variations"]?t["ab-test-variations"]:[],D=t["ab-test-archived-variations"]?t["ab-test-archived-variations"]:[],v=b.length,v<2&&(w=!1));let j="";"storeCheckout"===i&&y&&(j+=" invalid-step wcf-store-checkout pointer-events-none touch-none"),w&&(j+=" wcf-ab-test flex flex-col items-center"),wcfCartflowsTypePlusPro()||"upsell"!==l&&"downsell"!==l||(j+=" invalid-step pro-inactive pointer-events-none touch-none !bg-gray-50 !text-gray-300 !border-0"),f&&!w&&(j+=" invalid-step step-disabled touch-none !bg-gray-50 !text-gray-300 !border-0");const _={is_cf_pro:a,global_checkout:r,flow_id:n,ab_test_ui:w,control_id:N,step_id:s,type:l,title:o,actions:Object.values(c),menu_actions:Object.values(u),has_product_assigned:t.is_product_assigned,offer_yes_next_step:m,offer_no_next_step:g,ab_test_archived_variations:D,invalidStep:y,setShowAbtestUpgradePopup:h,step_disabled:f};return(0,e.createElement)("div",{className:"wcf-step-wrap bg-white border shadow-sm rounded-lg mb-4"+j,id:s,onDragEnd:d},w&&(0,e.createElement)(cA,{flow_id:n,control_id:N,step_id:s,abvariations:b,ab_test_start:x}),function(){let t="";if(_.step_id=s,w&&v>1){let a=0;t=b.map(t=>(N!==t.id&&++a,_.is_variation=!0,_.control_id=N,_.step_id=t.id,_.title=t.title,_.actions=Object.values(t.actions),_.menu_actions=Object.values(t.menu_actions),_.has_product_assigned=t.is_product_assigned,_.var_badge_count=a,_.step_disabled=t.step_disabled,(0,e.createElement)(nA,(0,M.A)({},_,{key:t.id}))))}else t=(0,e.createElement)(nA,_);return t}(),function(){if(w&&D.length>0){const t={flow_id:n,control_id:N,type:l,archived_variations:D};return(0,e.createElement)(gA,t)}}())},fA=function(){return(0,e.createElement)("div",{className:"w-11/12"},Array(3).fill().map((t,a)=>(0,e.createElement)("div",{key:a,className:"wcf-step-wrap animate-pulse bg-white border shadow-sm rounded-lg mb-4 p-4 flex items-center gap-2"},(0,e.createElement)("div",{className:"wcf-steps--sortable-toggle flex cursor-move text-gray-400"},(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true",className:"w-5 h-5 stroke-1"},(0,e.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z"})),(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true",className:"w-5 h-5 stroke-1 -ml-3.5"},(0,e.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z"}))),(0,e.createElement)("div",{className:"wcf-step flex justify-between items-center w-full wcf-step__no-product"},(0,e.createElement)("div",{className:"wcf-step--content flex items-center gap-4 w-[55%]"},(0,e.createElement)("div",{className:"image bg-gray-200 p-11 rounded-md"}),(0,e.createElement)("div",{className:"wcf-steps--title-wrap flex flex-col gap-4 w-full"},(0,e.createElement)("div",{className:"wcf-step__col-tags flex items-center gap-2"},(0,e.createElement)("span",{className:"h-3 w-full bg-gray-200 rounded-md px-10 block mr-2"}),(0,e.createElement)("span",{className:"h-3 w-full bg-gray-200 rounded-md px-10 block"})),(0,e.createElement)("div",{className:"wcf-step__title"},(0,e.createElement)("span",{className:"h-3 w-4/5 bg-gray-200 rounded-md px-10 block mr-2"})))),(0,e.createElement)("div",{className:"wcf-step--stats-content flex text-center justify-between items-center w-1/4 "},(0,e.createElement)("div",{className:"wcf-step--stats-content__stat"},(0,e.createElement)("div",{className:"h-3 w-full bg-gray-200 rounded-md px-10 block"}),(0,e.createElement)("div",{className:"h-3 w-8 bg-gray-200 rounded-md px-4 block mx-auto mt-2"})),(0,e.createElement)("div",{className:"wcf-step--stats-content__stat"},(0,e.createElement)("div",{className:"h-3 w-full bg-gray-200 rounded-md px-10 block"}),(0,e.createElement)("div",{className:"h-3 w-8 bg-gray-200 rounded-md px-4 block mx-auto mt-2"})),(0,e.createElement)("div",{className:"wcf-step--stats-content__stat"},(0,e.createElement)("div",{className:"h-3 w-full bg-gray-200 rounded-md px-10 block"}),(0,e.createElement)("div",{className:"h-3 w-8 bg-gray-200 rounded-md px-4 block mx-auto mt-2"}))),(0,e.createElement)("div",{className:"wcf-step--actions-col"},(0,e.createElement)("div",{className:"wcf-step--actions"},(0,e.createElement)("div",{className:"wcf-step--action-btns flex items-center"},(0,e.createElement)("div",{className:"wcf-step--action__basic-btns flex items-center gap-3"},(0,e.createElement)("span",{className:"wcf-step__action-btn h-3 w-full bg-gray-200 rounded-md p-3 block"}),(0,e.createElement)("span",{className:"wcf-step__action-btn h-3 w-full bg-gray-200 rounded-md p-3 block"}),(0,e.createElement)("span",{className:"wcf-step__action-btn h-3 w-full bg-gray-200 rounded-md p-3 block"}),(0,e.createElement)("span",{className:"wcf-step__action-btn h-3 w-full bg-gray-200 rounded-md p-3 block"})))))))))};function hA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"}))}const MA=t.forwardRef(hA);function yA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"}))}const NA=t.forwardRef(yA);function wA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.53 16.122a3 3 0 0 0-5.78 1.128 2.25 2.25 0 0 1-2.4 2.245 4.5 4.5 0 0 0 8.4-2.245c0-.399-.078-.78-.22-1.128Zm0 0a15.998 15.998 0 0 0 3.388-1.62m-5.043-.025a15.994 15.994 0 0 1 1.622-3.395m3.42 3.42a15.995 15.995 0 0 0 4.764-4.648l3.876-5.814a1.151 1.151 0 0 0-1.597-1.597L14.146 6.32a15.996 15.996 0 0 0-4.649 4.763m3.42 3.42a6.776 6.776 0 0 0-3.42-3.42"}))}const xA=t.forwardRef(wA);function bA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"}))}const DA=t.forwardRef(bA),vA=function(){const[{step_id:a,flow_id:r},n]=Bc();let[{step_title:i}]=Bc();(0,t.useEffect)(()=>{let e=!0;return e&&A()({path:`/cartflows/v1/admin/flow-data/${r}`}).then(t=>{e&&n({type:"SET_FLOW_DATA",data:t})}),()=>{e=!1}},[i]);const[s,o]=(0,t.useState)(!1),[l,c]=(0,t.useState)(""),u=(0,t.createRef)(),d=function(e){e.preventDefault(),o(!0)},m=function(e){e.preventDefault(),c("wcf-button-loading");const t=u.current.value,r=new window.FormData;r.append("action","cartflows_update_step_title"),r.append("security",cartflows_admin.update_step_title_nonce),r.append("step_id",a),r.append("new_step_title",t),A()({url:cartflows_admin.ajax_url,method:"POST",body:r}).then(()=>{n({type:"SET_STEP_TITLE",title:t}),c(""),o(!1)})},g=function(e){e.preventDefault(),o(!1)};return!1===i?"":(0,e.createElement)("div",{className:"wcf-edit-step__title-wrap"},(0,e.createElement)("div",{className:"wcf-steps-header--title wcf-step__title--editable flex justify-between items-center gap-2.5"},function(){""===i&&(i=(0,z.__)("(no title)","cartflows"));let t=Mn(i,cartflows_admin.title_length.max,cartflows_admin.title_length.display_length),a=(0,e.createElement)("a",{href:"#",className:"wcf-steps-header__title--edit",title:(0,z.__)("Edit Step Name","cartflows"),onClick:d},(0,e.createElement)(DA,{className:"w-5 h-5 stroke-1 text-gray-400 hover:text-primary-500"}));return s&&(t=(0,e.createElement)(xp,{attr:{ref:u},id:"new-step-title",value:i,autocomplete:"off",class:"new-step-title input-field !px-4 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !w-full !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0"}),a=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"wcf-button wcf-primary-button "+(l?"wcf-disabled":""),type:"button",onClick:m},l&&(0,e.createElement)("svg",{"aria-hidden":"true",className:"w-18 h-18 mr-2 text-gray-400 animate-spin fill-primary-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),(0,e.createElement)("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})),(0,z.__)("Save","cartflows")),(0,e.createElement)("button",{className:"wcf-button wcf-secondary-button",href:"#",onClick:g},(0,z.__)("Cancel","cartflows")))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"wcf-steps-header__title--text",title:i},t),(0,e.createElement)("span",{className:"wcf-steps-header__title--buttons flex gap-2"},a))}()))},jA=function(){return(0,e.createElement)("div",{className:"wcf-design-page is-placeholder"},(0,e.createElement)("div",{className:"wcf-design-page__content"},(0,e.createElement)("div",{className:"wcf-design-header--title wcf-step__title--editable"},(0,e.createElement)("div",{className:"title wcf-placeholder__width--30"})),(0,e.createElement)("div",{className:"wcf-design-page__customize"},(0,e.createElement)("div",{className:"wcf-design-page__button"}),(0,e.createElement)("div",{className:"wcf-design-page__button"})),(0,e.createElement)("div",{className:"wcf-design-page__text"},(0,e.createElement)("div",{className:"title wcf-placeholder__width--60"})),(0,e.createElement)("div",{className:"wcf-design-page__WPeditor"},(0,e.createElement)("div",{className:"title wcf-placeholder__width--80"}))),(0,e.createElement)("div",{className:"wcf-design-page__settings"},(0,e.createElement)("div",{className:"title"}),(0,e.createElement)("div",{className:"wcf-field wcf-checkbox-field"},(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("div",{className:"wcf-settings"},(0,e.createElement)("form",null,(0,e.createElement)("div",{className:"wcf-vertical-nav"},(0,e.createElement)("div",{className:"wcf-vertical-nav__menu"},Array(5).fill().map(t=>(0,e.createElement)("div",{className:"wcf-settings-nav__tab",key:t},(0,e.createElement)(nw,{height:"45px"})))),(0,e.createElement)("div",{className:"wcf-vertical-nav__content"},(0,e.createElement)(aw,{fontSize:"35px",width:"225px"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"65%"}),(0,e.createElement)(rw,null),(0,e.createElement)(aw,{fontSize:"35px",width:"300px"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"45%"}),(0,e.createElement)(rw,null),(0,e.createElement)(aw,{fontSize:"35px",width:"300px"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"45%"})))))))},_A=function({settings:t},a="tr"){const[{options:r}]=Bc();return(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options-wrapper"},"tr"===a?(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,Object.keys(t.fields).map(a=>{const n=t.fields[a],i=r[n.name]?r[n.name]:"",s=yn.isActiveControl(n,r);return(0,e.createElement)(Sy,{key:a,data:n,value:i,isActive:s,field:a})}))):(0,e.createElement)("div",{className:"wcf-list-options-container"},Object.keys(t.fields).map(n=>{const i=t.fields[n],s=r[i.name]?r[i.name]:"",o=yn.isActiveControl(i,r);return(0,e.createElement)(Sy,{key:n,data:i,value:s,isActive:o,field:n,tabName:"list-options",displayAs:a})}))))},IA=function(a){const[r,n]=(0,t.useState)(a.isOpen?"":"collapsed"),i=a.settings.title.replace(/ /g,"_").toLowerCase(),s=a.settings.title.replace(/ /g,"-").toLowerCase();return(0,e.createElement)("div",{className:`wcf-${s} accordion-item bg-white -mx-8 border-b border-gray-200 ${!1===a?.isActive?"hidden":""}`},(0,e.createElement)("h2",{className:"accordion-header mb-0 "+("landing"===a?.settings?.step_type&&"general"===a?.settings?.slug?"hidden":""),id:`wcf_${i}_toggler`.toLowerCase()},(0,e.createElement)("button",{className:`wcf-accordion-button relative flex justify-between items-center w-full py-4 px-8 text-base font-semibold text-gray-800 text-left transition focus:outline-none ${r}`,type:"button","data-bs-toggle":"collapse","data-bs-target":`#wcf_collapse_${i}`,"aria-expanded":"false","aria-controls":`wcf_collapse_${i}`,onClick:function(){n("collapsed"===r?"":"collapsed")}},(0,e.createElement)("span",null,a.settings.title),""===r?(0,e.createElement)(_w,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}):(0,e.createElement)(Ew,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}))),(0,e.createElement)("div",{id:`wcf_collapse_${i}`,className:`accordion-collapse px-8 pt-4 pb-8 ${r}`,"aria-labelledby":`wcf_${i}_toggler`},(0,e.createElement)("div",{className:"accordion-body"},(0,e.createElement)(_A,{settings:a.settings,displayAs:a.displayAs?a.displayAs:"tr"}))))},EA=function(){const[{step_id:a,design_settings:r,options:n,flow_type:i,flow_id:s,step_data:o,is_flow_instant_checkout:l}]=Bc(),c=r.settings,u=c?Object.values(c).sort(function(e,t){return e.priority-t.priority}):"",[{step_title:d}]=Bc(),m=(0,p.useHistory)(),g=PN();return(0,t.useEffect)(()=>{let e=!0;return()=>{e=!1}},[]),""===a?(0,e.createElement)(jA,null):(0,e.createElement)("div",{className:"wcf-design-page"},"storeCheckout"===i&&d&&"yes"!==l&&(0,e.createElement)("div",{className:"mb-3"},(0,e.createElement)("div",{className:"wcf-change-step wcf-button wcf-secondary-button",onClick:async function(){await g({title:(0,z.__)("Update Template","cartflows"),description:(0,z.__)("Changing the template will permanently delete the current design in this step. Would you still like to proceed?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})&&m.push(`admin.php?page=cartflows&path=store-checkout&action=wcf-edit-flow&step_id=${a}&flow_id=${s}&tab=update-template`)}},(0,e.createElement)("span",{className:""},(0,z.__)("Change Template","cartflows")))),(0,e.createElement)("div",{className:"wcf-step-notices-wrapper rounded-md bg-yellow-50 border border-yellow-200 p-4 mb-3"},(0,e.createElement)("div",{className:"flex"},(0,e.createElement)("div",{className:"text-sm text-yellow-700"},"yes"===l&&["checkout","upsell","downsell","thankyou"].includes(o?.type)?(0,e.createElement)(e.Fragment,null,(0,z.sprintf)(
46 46 // translators: %s: The current step type.
47 47 // translators: %s: The current step type.
48 -(0,z.__)("Use this setting to customize the style of the Instant %s Layout.","cartflows"),"thankyou"===o?.type?(0,z.__)("Thank You","cartflows"):o?.type.charAt(0).toUpperCase()+o?.type.slice(1))):(0,e.createElement)(e.Fragment,null,(0,z.__)("If you are using shortcodes, enable this design settings to apply styles.","cartflows"))))),u&&(0,e.createElement)("div",{className:"wcf-design-page__settings"},(0,e.createElement)("div",{className:"mb-4"},(0,e.createElement)(Yy,{id:"wcf-enable-design-settings",name:"wcf-enable-design-settings",value:n["wcf-enable-design-settings"],label:(0,z.__)("Enable Design Settings","cartflows"),fullWidth:!0})),"yes"===n["wcf-enable-design-settings"]&&Object.keys(u).map((t,a)=>(0,e.createElement)(IA,{settings:u[t],key:t,isOpen:0===a,isActive:yn.isActiveControl(u[t],n)}))))},LA=function(){return(0,e.createElement)("div",{className:"wcf-settings-nav"},(0,e.createElement)("div",{className:"wcf-settings-nav__tabs"},Array(5).fill().map(t=>(0,e.createElement)("div",{className:"wcf-settings-nav__tab",key:t},(0,e.createElement)(nw,{height:"45px"})))),(0,e.createElement)("div",{className:"wcf-settings-nav__content"},(0,e.createElement)(aw,{fontSize:"35px",width:"225px"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"65%"}),(0,e.createElement)(rw,null),(0,e.createElement)(aw,{fontSize:"35px",width:"300px"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"45%"})))},TA=function(){const[{step_id:a,flow_id:r,step_data:n}]=Bc(),[i,s]=(0,t.useState)("collapsed"),o=(0,p.useHistory)(),l=PN();return(0,e.createElement)("div",{className:"wcf-change-step-template accordion-item bg-white -mx-8 border-b border-gray-200"},(0,e.createElement)("h2",{className:"accordion-header mb-0",id:"wcf_change_step_template_toggler"},(0,e.createElement)("button",{className:`wcf-accordion-button relative flex justify-between items-center w-full py-4 px-8 text-base font-semibold text-gray-800 text-left transition focus:outline-none ${i}`,type:"button","data-bs-toggle":"collapse","data-bs-target":"#wcf_collapse_change_step_template","aria-expanded":"false","aria-controls":"wcf_collapse_change_step_template",onClick:function(){s("collapsed"===i?"":"collapsed")}},(0,e.createElement)("span",null,(0,z.__)("Change Template","cartflows")),""===i?(0,e.createElement)(_w,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}):(0,e.createElement)(Ew,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}))),(0,e.createElement)("div",{id:"wcf_collapse_change_step_template",className:`accordion-collapse px-8 pt-4 pb-8 ${i}`,"aria-labelledby":"wcf_change_step_template_toggler"},(0,e.createElement)("div",{className:"accordion-body"},(0,e.createElement)("div",{className:"mb-3 flex items-center gap-4"},(0,e.createElement)("img",{src:function(){let e="";switch(n.type){case"landing":e=XT;break;case"checkout":e=JT;break;case"optin":e=KT;break;case"thankyou":e=eA;break;case"upsell":e=$T;break;case"downsell":e=qT}return e}(),alt:n.type,className:"rounded-lg w-[85px] h-[85px]"}),(0,e.createElement)("div",{className:"wcf-template-content"},(0,e.createElement)("div",{className:"wcf-step-template-type mb-3"},(0,e.createElement)("span",{className:"text-sm font-medium"},(0,z.__)("Step Type: ","cartflows")),(0,e.createElement)("span",{className:"text-sm font-normal text-gray-500 capitalize"},n.type)),(0,e.createElement)("div",{className:"wcf-change-step wcf-button wcf-secondary-button",onClick:async function(){await l({title:(0,z.__)("Update Template","cartflows"),description:(0,z.__)("Changing the template will permanently delete the current design in this step. Would you still like to proceed?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})&&o.push(`admin.php?page=cartflows&path=store-checkout&action=wcf-edit-flow&flow_id=${r}step_id=${a}&tab=update-template`)}},(0,e.createElement)("span",{className:""},(0,z.__)("Update Template","cartflows"))))))))},AA=function(){const[{step_data:t,settings_data:a,page_builder:r,flow_type:n,step_title:i,options:s}]=Bc(),[{license_status:o}]=m();let l=!0;void 0!==t.id&&(l=!1);const c=a.settings,u=Object.values(c).sort(function(e,t){return e.priority-t.priority});return l?(0,e.createElement)(LA,null):["upsell","downsell"].includes(t.type)&&wcfCartflowsPro()&&"Activated"!==o?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)(KN,{heading:(0,z.__)("License is required!","cartflows"),subHeading:(0,z.__)("Activate the license to modify this offer step's settings","cartflows")}))):(0,e.createElement)("div",{className:"wcf-settings-page"},c&&Object.keys(u).map((a,n)=>"other"!==r&&"shortcode"===u[a].slug?null:(u[a].step_type=t?.type||"",(0,e.createElement)(IA,{settings:u[a],key:a,displayAs:"div",isOpen:0===n,isActive:yn.isActiveControl(u[a],s)}))),"storeCheckout"===n&&i&&(0,e.createElement)(TA,null))},zA=function({settings:t},a="tr"){const[{options:r}]=Bc(),n=e=>{let t="";const a=e.name;if(a&&a.includes("[")){const n=a.split("["),i=[];for(let e=1;e<n.length;e++)i.push(n[e].split("]")[0]);const s=a.substr(0,a.indexOf("[")),o=r[s],l=r["wcf-offer-product"];if((null==l||""===l||l.length<=0)&&("wcf-offer-product[original_price]"===a||"wcf-offer-product[sell_price]"===a))return(0,z.__)("No product Selected","cartflows");const c=Array.isArray(l)?parseFloat(l[0].original_price):parseFloat(l.original_price);if("wcf-offer-product[sell_price]"===a&&c){const t=r["wcf-offer-discount"],a=parseFloat(r["wcf-offer-discount-value"]);let n=c;return"discount_percent"===t?a>0&&(n=(c-c*a/100).toFixed(2)):"discount_price"===t&&a>0&&(n=(c-a).toFixed(2)),e.class=n<0?"error_field":"",n}t=o[i[0]]}else t=r[e.name]?r[e.name]:"";return t};return(0,e.createElement)("div",{className:"wcf-list-options wcf-offer-list-options"},(0,e.createElement)("div",{className:"wcf-list-options-wrapper"},"tr"===a?(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,Object.keys(t.fields).map(a=>{const i=t.fields[a],s=n(i),o=yn.isActiveControl(i,r);return(0,e.createElement)(Sy,{key:a,data:i,value:s,isActive:o,field:a})}))):(0,e.createElement)("div",{className:"wcf-list-options-container"},Object.keys(t.fields).map(i=>{const s=t.fields[i],o=n(s),l=yn.isActiveControl(s,r);return(0,e.createElement)(Sy,{key:i,data:s,value:o,isActive:l,field:i,tabName:"list-options",displayAs:a})}))),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null)))},kA=function(){return(0,e.createElement)("div",{className:"wcf-checkout-products is-placeholder"},(0,e.createElement)("div",{className:"wcf-checkout-products--selection wcf-checkout__section"},(0,e.createElement)("div",{className:"wcf-product-selection-wrapper"},(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options__title"},(0,e.createElement)("div",{className:"title wcf-placeholder__width--30"})),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,e.createElement)("div",{className:"wcf-checkout-product-selection-field"},(0,e.createElement)("div",{className:"wcf-checkout-product-selection-field__add-new"},(0,e.createElement)("div",{className:"wcf-checkout-products__button"}),(0,e.createElement)("div",{className:"wcf-checkout-products__button"})))))))))),(0,e.createElement)("div",{className:"wcf-checkout-products__pro-options"},(0,e.createElement)("div",{className:"wcf-checkout-products--coupon"},(0,e.createElement)("div",{className:"wcf-coupon-selection-wrapper"},(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options__title"},(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field"},(0,e.createElement)("div",{className:"title"}))))))))))),(0,e.createElement)("div",{className:"wcf-field wcf-submit"},(0,e.createElement)("div",{className:"wcf-checkout-products__button"})))},SA=function(){const[{settings_data:a,page_settings:r,options:n,step_data:i},s]=Bc(),[{license_status:o}]=m(),l=n["wcf-offer-product"]?n["wcf-offer-product"]:"",c=[{value:"",label:"No Discount",icon:(0,e.createElement)(Vc,{className:"w-5 h-5"})},{value:"discount_percent",label:"Discount Percentage",icon:(0,e.createElement)(Gc,{className:"w-5 h-5"})},{value:"discount_price",label:"Discount Price",icon:(0,e.createElement)(Jc,{className:"w-5 h-5"})}],[u,d]=(0,t.useState)(),[g,p]=(0,t.useState)(""),f=(0,z.__)("Add","cartflows"),h=void 0===l.discount_type||""===l.discount_type?"disable":"enable",[M,y]=(0,t.useState)(h);(0,t.useEffect)(()=>{y(l?.discount_type?"enable":"disable")},[l]);const[N,w]=(0,t.useState)({isInProcessing:!1,buttonText:f}),{isInProcessing:x,buttonText:b}=N;return void 0===a.settings?(0,e.createElement)(kA,null):["upsell","downsell"].includes(i.type)&&wcfCartflowsPro()&&"Activated"!==o?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)(KN,{heading:(0,z.__)("License is required!","cartflows"),subHeading:(0,z.__)("Activate the license to modify this offer step's settings","cartflows")}))):(0!==l.length&&function(){const e=n["wcf-offer-discount"],t=parseFloat(n["wcf-offer-discount-value"]),a=parseFloat(l.original_price);let r=0;"discount_percent"===e?t>0&&(r=a-a*t/100):"discount_price"===e&&t>0&&(r=a-t),l.sell_price=r.toFixed(2)}(),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-offer-product--wrapper"},(0,e.createElement)("div",{className:"wcf-offer-products--selection wcf-products__section"},0===l.length?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("input",{name:"wcf-offer-product[]",type:"hidden",value:""}),(0,e.createElement)("div",{className:"wcf-offer-no-product--notice border border-gray-200 bg-gray-25 text-center text-sm font-normal rounded-md p-5"},(0,z.__)("Once you select the product, they will be displayed here.","cartflows")),(0,e.createElement)("div",{className:"wcf-offer-product-selection-field__add-new flex justify-between gap-5 mt-5"},(0,e.createElement)(by,{name:"",desc:"",field:"product",value:g,allowed_products:"",include_products:"braintree-subscription, braintree-variable-subscription",excluded_products:"grouped",placeholder:(0,z.__)("Search for a Product","cartflows"),onChangeCB:d}),(0,e.createElement)("div",{className:"wcf-select-product-button inline-flex"},(0,e.createElement)("button",{type:"button",className:Dn()("wcf-button",x?"wcf-disabled":"wcf-secondary-button"),onClick:function(){const e=u?.value;p(u),e&&(w({isInProcessing:!0,buttonText:(0,z.__)("Adding…","cartflows")}),A()({path:`/cartflows/v1/admin/product-data/${e}`}).then(t=>{console.log(t),s({type:"ADD_OFFER_PRODUCT",field_name:"wcf-offer-product",product_data:{value:e,quantity:"1",label:u?.label,img_url:t?.img_url,original_price:t?.regular_price}}),p(null),w({isInProcessing:!1,buttonText:f})}),d(null))}},!x&&(0,e.createElement)(Sn,{className:"w-4 h-4 stroke-2","aria-hidden":"true"}),x&&(0,e.createElement)(Cn,{className:"w-4 h-4 stroke-2 animate-spin","aria-hidden":"true"}),b)))):(0,e.createElement)("div",{className:"overflow-visible shadow border border-gray-200 rounded-md"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--header border-b border-gray-200 flex gap-6 p-3"},(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/2"},(0,z.__)("Items","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-[10%]"},(0,z.__)("Quantity","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/5"},(0,z.__)("Discount","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/6"},(0,z.__)("Shipping Rate","cartflows")),(0,e.createElement)("div",{className:"relative w-[5%]"},(0,e.createElement)("span",{className:"sr-only"},(0,z.__)("Delete","cartflows")))),(0,e.createElement)("div",{className:"wcf-offer-product-selection--selected-product flex items-center p-3 gap-4"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-title whitespace-nowrap text-sm font-medium text-gray-900 w-1/2"},(0,e.createElement)("div",{className:"flex gap-3 items-center"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-image flex w-24 h-24"},(0,e.createElement)("img",{src:l.img_url?l.img_url:cartflows_admin.image_placeholder,className:"product-image rounded-md w-full h-full aspect-{3/2} object-contain",alt:xn(l.label)})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-title_text"},(0,e.createElement)("div",{className:"wcf-offer-product-repeater-field__title whitespace-normal text-left","data-product_id":l.value},xn(l.label)),(0,e.createElement)("div",{className:"wcf-offer-product-repeater-field__reg-price mt-1"},(0,e.createElement)("div",{className:"flex gap-2"},(0,e.createElement)("span",{className:"wcf-offer-product--reg-price "+(0<l.sell_price?"line-through text-gray-400":"")},cartflows_admin.woo_currency+l.original_price),0<l.sell_price&&(0,e.createElement)("span",{className:"wcf-offer-product--sale-price"},cartflows_admin.woo_currency+l.sell_price)))))),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-qty whitespace-nowrap text-sm text-gray-500 w-[10%]"},(0,e.createElement)(bp,{id:"",name:"wcf-offer-quantity",class:"input-field !w-20 !min-h-[43px] !text-sm font-normal !rounded-md text-gray-400 !border !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",value:n["wcf-offer-quantity"],min:"1"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-discount flex whitespace-nowrap text-sm text-gray-500 w-1/5"},(0,e.createElement)(hN,{name:"wcf-offer-discount",value:n["wcf-offer-discount"],class:"!block !w-20 !m-0",options:c,callback:function(e,t,a){y(""===a?"disable":"enable")}}),(0,e.createElement)(bp,{id:"",class:"input-field !w-20 !min-h-[43px] !leading-[3] !text-sm font-normal !rounded-r-md !rounded-l-none text-gray-400 !border !border-l-0 !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"wcf-offer-discount-value",value:"disable"===M?"":n["wcf-offer-discount-value"],readonly:"disable"===M?"readonly":"",placeholder:"disable"===M?"":"0",min:"1",step:"any"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--flat-rate flex whitespace-nowrap text-sm text-gray-500 w-1/6"},(0,e.createElement)(bp,{id:"",class:"input-field !w-20 !min-h-[43px] !leading-[3] !text-sm font-normal !rounded-md text-gray-400 !border !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"wcf-offer-flat-shipping-value",placeholder:"0",value:n["wcf-offer-flat-shipping-value"],min:"0"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection-actions flex gap-2 relative whitespace-nowrap text-right text-sm font-medium w-[5%] justify-center"},(0,e.createElement)("div",{className:"wcf-delete-product-item py-2 text-primary-500 hover:text-primary-700 cursor-pointer text-right flex justify-end",onClick:function(){s({type:"REMOVE_OFFER_PRODUCT",field_name:"wcf-offer-product"})}},(0,e.createElement)(au,{className:"h-18 w-18"}))),(0,e.createElement)("input",{name:"wcf-offer-product[]",type:"hidden",className:"wcf-checkout-product-id",value:l.value})))),(0,e.createElement)("div",{className:"wcf-offer-product--common-settings pt-8"},(0,e.createElement)(zA,{settings:r?.settings.product,displayAs:"div"})))))},OA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-product-tab p-6 is-placeholder"},(0,e.createElement)("div",{role:"status",className:"space-y-8 animate-pulse md:space-y-0 md:space-x-8 md:flex md:items-center"},(0,e.createElement)("div",{className:"flex items-center justify-center w-full h-48 bg-gray-300 rounded sm:w-96"},(0,e.createElement)("svg",{className:"w-12 h-12 text-gray-200",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",fill:"currentColor",viewBox:"0 0 640 512"},(0,e.createElement)("path",{d:"M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"}))),(0,e.createElement)("div",{className:"w-full"},(0,e.createElement)("div",{className:"wcf-accordion-loader mb-3.5"},(0,e.createElement)("span",{className:"block h-4 w-28 bg-gray-200 rounded-md mb-4"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-10/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-8/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md w-1/2 mb-4"})))),(0,e.createElement)("div",{className:"flex gap-4 mt-6"},(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"})),(0,e.createElement)("div",{className:"w-full"},(0,e.createElement)("div",{className:"mt-6 mb-3.5"},(0,e.createElement)("span",{className:"block h-4 w-28 bg-gray-200 rounded-md mb-4"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-10/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-8/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md w-1/2 mb-4"}))))},CA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-design-tab is-placeholder"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__settings"},(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field wcf-product-field"},(0,e.createElement)("div",{className:"wcf-selection-field"},(0,e.createElement)("label",null)))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field wcf-product-field"},(0,e.createElement)("div",{className:"wcf-selection-field"},(0,e.createElement)("label",null)))))))),(0,e.createElement)("div",{className:"wcf-order-bump-save-settings"},(0,e.createElement)("span",null))),(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__preview"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__preview--title"},(0,e.createElement)("label",null)),(0,e.createElement)("div",{className:"wcf-bump-order-wrap wcf-bump-order-style-1 wcf-after-order"},(0,e.createElement)("div",{className:"wcf-bump-order-content"},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("span",null)),(0,e.createElement)("div",{className:"wcf-content-container"},(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight"})),(0,e.createElement)("div",{className:"wcf-bump-order-desc"})))))))},YA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-setting-tab is-placeholder"},(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-one"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-two"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-one"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-two"})))))),(0,e.createElement)("div",{className:"wcf-order-bump-save-settings"},(0,e.createElement)("span",null)))},UA=function(){return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--enable_option"},(0,e.createElement)(aw,{width:"65%"})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group"},Array(3).fill().map((t,a)=>(0,e.createElement)("div",{className:"wcf-order-bumps-rule",key:t},(0,e.createElement)("div",{className:"wcf-order-bumps-rule--select-box"},(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"})),2!==a&&(0,e.createElement)("div",{className:"wcf-order-bumps-rule__and"},(0,e.createElement)(nw,{height:"25px",width:"5%"}))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or"},(0,e.createElement)(nw,{height:"35px",width:"5%"}),(0,e.createElement)(nw,{height:"45px",width:"12%"})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules-save-settings"},(0,e.createElement)(nw,{height:"45px",width:"12%"})))},QA=new function(){const e=this;this.compare=function(e,t,a){switch(a){case"==":return e==t;case"!=":return e!=t;case"!==":return e!==t;case"in":return-1!==t.indexOf(e);case"!in":return-1===t.indexOf(e);case"contains":return-1!==e.indexOf(t);case"!contains":return-1===e.indexOf(t);case"<":return e<t;case"<=":return e<=t;case">":return e>t;case">=":return e>=t;default:return e===t}},this.check=function(t,a){const r="or"===t.relation;let n=!r;return t.fields.map(function(t){let i;return i=t.fields?e.check(t,a):e.compare(a[t.name],t.value,t.operator),r?(i&&(n=!0),!i):i?"":n=!1}),n},this.isActiveControl=function(t,a){const r=!!t?.conditions&&t?.conditions;return!(r&&!e.check(r,a))}},PA=function(){const[{page_settings:t,current_ob:a}]=Bc();if(null===t||"undefined"===t)return(0,e.createElement)(CA,null);const r=t?.settings["multiple-order-bump-design"];return(0,e.createElement)("div",{className:"wcf-order-bump-design-tab"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__settings"},r&&Object.keys(r.fields).map(t=>{const n=r.fields[t];let i="";return"borders"===n.id&&(i="grid grid-cols-4 gap-x-4"),"shadow"===n.id&&(i="grid grid-cols-5 gap-x-2"),n.section_fields?(0,e.createElement)("div",{key:t,className:`wcf-order-bump-design-tab--${n.id}-section ${i} p-5 border border-gray-200 rounded-md mb-5`},(0,e.createElement)("div",{className:"wcf-order-bump-deign-tab--heading-section col-span-full"},(0,e.createElement)(wy,{label:n.title,labelClass:"block text-base font-semibold text-gray-800 mb-5"})),Object.keys(n.section_fields).map(t=>{const r=n.section_fields[t],i=a[r.name],s=QA.isActiveControl(r,a);return(0,e.createElement)(Sy,{key:t,data:r,value:i,isActive:s,field:t,displayAs:"div",tabName:"ob-design"})})):(0,e.createElement)("div",{key:t,className:"wcf-order-bump-design-tab--section mb-5"},(0,e.createElement)(Sy,{key:n.name,data:n,value:a[n.name],isActive:QA.isActiveControl(n,a),field:n.name,displayAs:"div",tabName:"ob-design"}))})))};function FA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z"}))}const RA=t.forwardRef(FA),HA=function(){const[{page_settings:a,current_ob:r},n]=Bc(),[i,s]=(0,t.useState)(r?.product[0]?r?.product[0]:""),[o,l]=(0,t.useState)(!1),[c,u]=(0,t.useState)(),d=(0,z.__)("Add","cartflows"),[m,g]=(0,t.useState)({isInProcessing:!1,buttonText:d}),{isInProcessing:p,buttonText:f}=m,h=a?.settings["multiple-order-bump-product"],M=[{value:"",label:"Original",icon:(0,e.createElement)(Vc,{className:"w-5 h-5"})},{value:"discount_percent",label:"Percentage",icon:(0,e.createElement)(Gc,{className:"w-5 h-5"})},{value:"discount_price",label:"Price",icon:(0,e.createElement)(Jc,{className:"w-5 h-5"})},{value:"coupon",label:"Coupon",icon:(0,e.createElement)(RA,{className:"w-5 h-5"})}];return""!==i&&function(){const e=r.discount_type,t=parseFloat(r.discount_value),a=parseFloat(i.original_price);let n=0;"discount_percent"===e?t>0&&(n=a-a*t/100):"discount_price"===e&&t>0&&(n=a-t),i.sell_price=n.toFixed(2)}(),(0,t.useEffect)(()=>{const e=r?.product?.[0];s(e||""),l(!(e&&!e?.is_deleted))},[r]),null===a||"undefined"===a?(0,e.createElement)(OA,null):(0,e.createElement)("div",{className:"wcf-order-bump-product-tab"},""===i&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"border border-gray-200 bg-gray-25 text-center text-sm font-normal rounded-md p-5"},(0,z.__)("Once you have add product, it will be displayed here.","cartflows")),(0,e.createElement)("input",{type:"hidden",name:"product"}),(0,e.createElement)("div",{className:"wcf-ob-product-selection-field__add-new flex justify-between gap-5 mt-5"},(0,e.createElement)(by,{name:"",desc:"",field:"product",value:"",allowed_products:"",include_products:"braintree-subscription, braintree-variable-subscription",excluded_products:"grouped",placeholder:(0,z.__)("Search for a Product","cartflows"),onChangeCB:u}),(0,e.createElement)("div",{className:"wcf-select-product-button inline-flex"},(0,e.createElement)("button",{type:"button",className:Dn()("wcf-button",p?"wcf-disabled":"wcf-secondary-button"),onClick:function(e){e.preventDefault();const t=c?.value;"active"===cartflows_admin.woocommerce_status&&t&&(g({isInProcessing:!0,buttonText:(0,z.__)("Adding…","cartflows")}),A()({path:`/cartflows-pro/v1/admin/ob-product-data/${t}`}).then(e=>{n({type:"ADD_OB_PRODUCT",product:e}),g({isInProcessing:!1,buttonText:d})}),u())}},!p&&(0,e.createElement)(Sn,{className:"w-4 h-4 stroke-2","aria-hidden":"true"}),p&&(0,e.createElement)(Cn,{className:"w-4 h-4 stroke-2 animate-spin","aria-hidden":"true"}),f)))),""!==i&&(0,e.createElement)(e.Fragment,null,o&&(0,e.createElement)("div",{className:"border border-primary-500 bg-primary-25 text-center text-primary-500 text-xs font-normal rounded-md p-5 mb-5"},(0,z.__)("The product previously added as an Order Bump has been deleted. Please add a new product.","cartflows")),(0,e.createElement)("div",{className:"wcf-ob-product-selection--selected-product flex items-center gap-3 p-3 border border-gray-200 rounded-md"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-title whitespace-nowrap text-sm font-medium text-gray-900 w-2/4"},(0,e.createElement)("div",{className:"flex gap-3 items-center"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-image w-20 h-20"},(0,e.createElement)("img",{src:i.product_image?i.product_image:cartflows_admin.image_placeholder,className:"wcf-ob-product-image rounded-md w-full h-full aspect-{3/2} object-contain",alt:i.label})),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-title_text"},(0,e.createElement)("div",{className:"wcf-ob-product-repeater-field__title whitespace-normal text-left","data-product_id":i.value},xn(String(i?.label))),(0,e.createElement)("input",{type:"hidden",name:"product",value:i.value?i.value:""}),(0,e.createElement)("div",{className:"wcf-ob-product-repeater-field__reg-price mt-1 "},(0,e.createElement)("div",{className:"flex gap-2"},(0,e.createElement)("span",{className:`wcf-ob-product--reg-price ${0<r.discount_value?"line-through text-gray-400":""} `},cartflows_admin.woo_currency+i.original_price),0<r.discount_value&&(0,e.createElement)("span",{className:"wcf-ob-product--sale-price"},cartflows_admin.woo_currency+i.sell_price))),"coupon"===r.discount_type&&(0,e.createElement)("span",{className:"coupon-message text-xs mt-0.5 text-gray-500"},(0,z.__)("Coupon will apply on checkout page","cartflows"))))),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-discount__wrapper flex items-center gap-3 justify-start w-[45%]"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-qty whitespace-nowrap text-sm text-gray-500"},(0,e.createElement)(bp,{id:"",name:"quantity",class:"!w-16 !h-11 input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0 "+("no"===r.display_quantity_field?"disabled":""),value:r.quantity,min:"1",readonly:"no"===r.display_quantity_field})),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-discount flex whitespace-nowrap text-sm text-gray-500"},(0,e.createElement)(hN,{name:"discount_type",value:r.discount_type,class:"!block !w-16 !m-0",options:M}),"coupon"!==r.discount_type?(0,e.createElement)(bp,{id:"",class:"input-field !w-16 !min-h-[44px] !text-sm font-normal !rounded-tr-md !rounded-tb-md !rounded-tl-none text-gray-400 !border !border-l-0 !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"discount_value",value:""===r.discount_type?"":r.discount_value,readonly:""===r.discount_type?"readonly":"",placeholder:""===r.discount_type?"":"0",min:"1",step:"any"}):(0,e.createElement)(Dy,{wrapperClass:"w-[200px] bg-white",fieldClass:"!border-l-0 !rounded-r-md !rounded-l-none",name:"discount_coupon",placeholder:(0,z.__)("Search for a coupon","cartflows"),multiple:!1,allow_clear:!0,value:""===r.discount_type?"":r.discount_coupon}))),(0,e.createElement)("div",{className:"wcf-product-selection-actions whitespace-nowrap text-right text-sm font-medium w-[5%]"},(0,e.createElement)("div",{className:"wcf-delete-product-item p-2 text-gray-400 hover:text-primary-500 cursor-pointer flex justify-center items-center",onClick:function(){n({type:"REMOVE_OB_PRODUCT",product:""}),s("")}},(0,e.createElement)(au,{className:"h-18 w-18"})))),(0,e.createElement)("div",{className:"flex mt-5"},(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,h&&h.fields&&Object.keys(h.fields).map(t=>{const a=h.fields[t],n=a.name,i=r[n],s=QA.isActiveControl(a,r);return(0,e.createElement)(Sy,{key:t,data:a,value:i,isActive:s,field:t})}))))))},BA=function(){const[{page_settings:t,current_ob:a}]=Bc();if(null===t||"undefined"===t)return(0,e.createElement)(CA,null);const r=t?.settings["multiple-order-bump-content"];return(0,e.createElement)("div",{className:"wcf-order-bump-content-tab"},(0,e.createElement)("div",{className:"wcf-order-bump-content-tab__settings"},Object.keys(r.fields).map(t=>{const n=r.fields[t],i=a[n.name],s=QA.isActiveControl(n,a);return(0,e.createElement)(Sy,{key:t,data:n,value:i,isActive:s,field:t,options:a,displayAs:"div",tabName:"order-bump-content"})})))},WA=function({rules:t,group_id:a,g_index:r,groups_length:n}){const[{page_settings:i},s]=Bc(),o=i?.settings["multiple-order-bump-rules"],l=o.conditions,c=e=>{const t=e.target.getAttribute("rule_id");a&&t&&s({type:"REMOVE_OB_RULE",name:"rules",rule_id:t,group_id:a})};return(0,e.createElement)(e.Fragment,null,t.map((i,u)=>{const d=i?.rule_id,m=t[u],g=o.field_data[m.condition];return(0,e.createElement)(e.Fragment,null,0!==u&&(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules__condition-label"},(0,e.createElement)("div",{className:"wcf--condition-label__and_group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf--condition-label__and_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("AND","cartflows"))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules flex gap-3 items-center","data-rule-id":d,key:d},(0,e.createElement)("input",{type:"hidden",name:`rules[${r}][rules][${u}][rule_id]`,value:d}),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--rule_fields grid gap-3 items-center w-full \n\t\t\t\t\t\t\t\t\t"+(g?.fields?.some(e=>"product"===e.type)?"grid-cols-2":"grid-cols-3")},(0,e.createElement)(In,{name:`rules[${r}][rules][${u}][condition]`,wrapperClass:"block",options:l,onSelect:()=>{s({type:"RESET_OB_RULE_VALUE",name:"rules",group_id:a,rule_id:d})},value:m.condition}),(0,e.createElement)(In,{name:`rules[${r}][rules][${u}][operator]`,wrapperClass:"block",options:g.operator,value:xn(m.operator)}),function(t,a,n){const i=n.value;let s="";const o=`rules[${r}][rules][${a}][value]`;return t.map(t=>{switch(t.type){case"select2":s=(0,e.createElement)(Pc,{name:`${o}[]`,value:i,placeholder:t.placeholder,tooltip:t.tooltip,options:t.options,isMulti:t.isMulti,isSearchable:t?.enable_search});break;case"number":s=(0,e.createElement)(bp,{name:o,value:i,min:0,placeholder:t.placeholder,tooltip:t.tooltip});break;case"coupon":s="exist"===n.operator||"not_exist"===n.operator?(0,e.createElement)(In,{name:o,options:[{label:"in parent order",value:"parent_order"}]}):(0,e.createElement)(Dy,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti});break;case"product":s=(0,e.createElement)(by,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti,sectionClass:"col-span-full",showLabelOnly:!0})}return s})}(g.fields,u,m)),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--rule_actions"},function(t,r){return 1===t&&1===n?"":(0,e.createElement)(au,{className:"w-5 h-6 stroke-2 p-0.5 text-gray-400 cursor-pointer hover:text-primary-700 focus:text-primary-700",onClick:c,group_id:a,rule_id:r})}(t.length,d))))}))},VA=function(){const[{options:a,current_ob:r},n]=Bc(),[i,s]=(0,t.useState)({ruleGroupId:"",isOpen:!1}),{ruleGroupId:o,isOpen:l}=i;if(null===a||"undefined"===r)return(0,e.createElement)(UA,null);const c=r.rules;if(void 0===c)return(0,e.createElement)(Ny,{content:(0,z.__)("Please Update the CartFlows Pro to the latest version to use the conditional order bump feature.","cartflows")});const u=()=>{const e={group_id:Math.random().toString(36).substring(2,5),rules:[{rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""}]};n({type:"ADD_NEW_OB_GROUP",name:"rules",newGroup:e})},d=e=>{const t=e.target.getAttribute("data-group_id"),a={rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""};n({type:"ADD_NEW_OB_RULE",name:"rules",newRule:a,group_id:t})},m=function(e){const t=e.target.getAttribute("data-group_id");s({ruleGroupId:t,isOpen:o!==t||!l})};return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--enable_option"},(0,e.createElement)(Yy,{name:"is_rule",value:r.is_rule,label:(0,z.__)("Enable conditional order bump ","cartflows"),tooltip:(0,z.__)("By enabling this option, you can create the conditions to display the order bump.","cartflows")})),"yes"===r.is_rule&&c&&(0,e.createElement)("div",{className:"mt-8"},(0,e.createElement)(Fc.ReactSortable,{id:"wcf-order-bump-sortable-wrapper",className:"wcf-order-bump--sortable-wrapper flex flex-col gap-4",list:c,setList:e=>n({type:"SET_OB_RULES_GROUPS",groups:e,fieldName:"rules"}),swapThreshold:.8,direction:"vertical",animation:150,handle:".wcf-order-bumps-rules-page--group_wrapper",filter:".wcf-order-bumps-rules--rule_fields, .wcf-order-bumps-rules--rule_actions, .wcf-field wcf-select-option, .wcf-order-bumps-rules--add-rule__repeater .wcf-button.wcf-button--secondary, .wcf-field__data--content, .wcf-order-bumps-rules-page--group_wrapper__footer, .wcf-checkout-rules--group_header__right",preventOnFilter:!1,onStart:function(){document.getElementsByClassName("wcf-order-bumps-rules--or_group__button")[0].setAttribute("style","display:none")},onEnd:function(){document.getElementsByClassName("wcf-order-bumps-rules--or_group__button")[0].setAttribute("style","display:inline-block")}},c.map((t,a)=>{const r=t.group_id,n=t.rules;return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--group_wrapper",key:r},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group border border-gray-200 rounded-lg mb-6","data-group-id":r},(0,e.createElement)("input",{type:"hidden",name:`rules[${a}][group_id]`,value:r}),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group-header bg-white p-4 rounded-lg flex items-center justify-between"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_header__left flex gap-2 items-center"},(0,e.createElement)("div",{className:"wcf-order-bumps-rule--sortable-toggle flex cursor-move text-gray-500"},(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-2","aria-hidden":"true"}),(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-4","aria-hidden":"true"})),(0,e.createElement)("span",{className:"wcf-group-header--text font-sm font-normal text-gray-400"},(0,z.__)("Show this order bump if following conditions are true","cartflows"))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_header__right flex gap-2 items-center"},o===r&&l?(0,e.createElement)(_w,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:m,"data-group_id":r}):(0,e.createElement)(Ew,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:m,"data-group_id":r}))),(0,e.createElement)("div",{id:`wcf-order-bumps-rules--group-${r}`,className:"pt-7 px-7 pb-4 border-t border-gray-200 "+(o===r&&l?"visible":"hidden")},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules--wrapper flex flex-col gap-4"},0!==n.length&&(0,e.createElement)(WA,{rules:n,group_id:r,g_index:a,groups_length:c.length})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--add-rule__repeater flex"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--add-rule__button text-sm font-medium flex gap-1.5 items-center cursor-pointer text-primary-500 hover:text-primary-600 focus:text-primary-600 mt-5","data-group_id":r,onClick:d},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Condition","cartflows"))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--group_wrapper__footer"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or_group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf-order-bumps-rules--or_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("OR","cartflows")))),parseInt(a)+1===c.length&&(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or_group__button mt-4"},(0,e.createElement)("span",{className:"wcf-order-bumps-rules--or_group_button or-button wcf-button wcf-secondary-button",onClick:u},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Conditions Group","cartflows")))))}))))},ZA=function(){const[{current_ob:a}]=Bc(),[r,n]=(0,t.useState)(!1),i=()=>{n(!0)},s=()=>{n(!1)},o=a,l=e=>{let t=o?.product;return e&&t&&(Array.isArray(t)&&(t=o?.product[0]),e=(e=(e=(e=e.replace("{{product_name}}",t?.product_name)).replace("{{product_price}}",t?.display_price?t?.display_price:t?.original_price)).replace("{{product_desc}}",t?.product_desc)).replace("{{quantity}}",o?.quantity)),e},c=()=>(()=>{let e=o?.product;return Array.isArray(e)&&(e=o?.product[0]),"variable"===e?.type||!0===e?.is_variable})()?(0,e.createElement)("div",{className:"wcf-order-bump-choose-variation-preview"},(0,z.__)("Choose a variation","cartflows")):null,u=o?.position,d=xn(l(o?.checkbox_label)||""),m=xn(l(o?.hl_text)||""),g=xn(l(o?.desc_text)||""),p=o?.show_arrow,f=o?.style,h=xn(l(o?.title_text)||""),M=o?.action_element,y=o?.show_animation,N=o?.enable_show_image,w=o?.display_quantity_field,x="yes"===y?"wcf-blink":"",b=(0,e.createElement)("svg",{version:"1.1",className:`wcf-pointing-arrow ${x}`,id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"20px",height:"15px",fill:"red",viewBox:"310 253 90 70",enableBackground:"new 310 253 90 70"},(0,e.createElement)("g",null,(0,e.createElement)("g",null,(0,e.createElement)("path",{d:"M364.348,253.174c-0.623,0.26-1.029,0.867-1.029,1.54v18.257h-51.653c-0.919,0-1.666,0.747-1.666,1.666v26.658c0,0.92,0.747,1.666,1.666,1.666h51.653v18.327c0,0.673,0.406,1.28,1.026,1.54c0.623,0.257,1.34,0.116,1.816-0.36l33.349-33.238 c0.313-0.313,0.49-0.737,0.49-1.18c0-0.443-0.177-0.866-0.487-1.179l-33.349-33.335 C365.688,253.058,364.971,252.915,364.348,253.174z"})))),D=o?.bg_color,v=o?.border_style,j=o?.border_color,_=o?.box_border_width,I=o?.box_border_radius,E=o?.box_shadow_color,L=""!==o?.box_shadow_horizontal?o?.box_shadow_horizontal:0,T=""!==o?.box_shadow_vertical?o?.box_shadow_vertical:0,A=""!==o?.box_shadow_blur?o?.box_shadow_blur:0,k=""!==o?.box_shadow_spread?o?.box_shadow_spread:0,S=o?.label_color?o?.label_color:"#7a7a7a",O=o?.label_bg_color,C=o?.desc_text_color,Y=o?.hl_text_color,U=o?.button_text_color,Q=o?.button_text_hover_color,P=o?.button_color,F=o?.button_border_width,R=o?.button_border_style,H=o?.button_border_color,B=o?.button_border_radius,W=o?.button_hover_color,V=o?.title_text_color,Z=o?.label_border_style,G=o?.label_border_width,X=o?.label_border_radius,J=o?.label_border_color,$={background:D,borderStyle:v,borderColor:j,borderRadius:""!==I?I+"px":"4px",borderWidth:""!==_?_+"px":"1px",boxShadow:L+"px "+T+"px "+A+"px "+k+"px "+E};let q={},K={},ee={};"style-1"===f?(q={borderColor:j,borderBottomStyle:"inherit"!==v?v:"solid",background:O,borderWidth:_+"px"},$.borderStyle="inherit"!==v?v:"solid"):"style-2"===f?(q={borderColor:j,borderTopStyle:"inherit"!==v?v:"solid",background:O,borderWidth:_+"px"},$.borderStyle="inherit"!==v?v:"solid"):"style-3"===f?$.borderStyle="inherit"!==v?v:"solid":"style-4"===f?($.borderStyle="inherit"!==v?v:"solid",ee={color:r?Q:U,background:r?W:P,borderWidth:""!==F?F+"px":"1px",borderStyle:"inherit"!==R?R:"none",borderColor:H,borderRadius:""!==B?B+"px":"3px"}):"style-5"===f&&($.borderStyle="inherit"!==v?v:"",K={borderStyle:"inherit"!==Z?Z:"",borderWidth:G+"px",borderRadius:X+"px",borderColor:J,background:O,padding:O?"5px 10px":"5px 0"},ee={color:r?Q:U,background:r?W:P,borderWidth:""!==F?F+"px":"1px",borderStyle:"inherit"!==R?R:"solid",borderColor:H,borderRadius:""!==B?B+"px":"3px"});let te="",ae="left",re="auto";"yes"===N&&(te=o?.product_image,ae=o?.ob_image_position,re=""!==o?.ob_image_width?o?.ob_image_width+"px":"auto"),(0,t.useEffect)(()=>{const e=document.getElementById("wcf-order-bump-preview-wrapper"),t=e.offsetTop-25,a=window.addEventListener("scroll",()=>{window.pageYOffset>t?e.classList.add("sticky"):e.classList.remove("sticky")});return()=>{window.removeEventListener("scroll",a)}},[]);const ne=function(){let t="";return"yes"===w&&(t=(0,e.createElement)("div",{className:"wcf-ob-qty-selection-wrap"},(0,e.createElement)("span",{className:"wcf-ob-qty-selection-btn wcf-ob-qty-decrement wcf-ob-qty-change-icon"},"-"),(0,e.createElement)("input",{type:"number",className:"wcf-order-bump-quantity-updater",name:"wcf_order_bump_quantity",placeholder:"1",defaultValue:o?.quantity,min:"1"}),(0,e.createElement)("span",{className:"wcf-ob-qty-selection-btn wcf-ob-qty-increment wcf-ob-qty-change-icon"},"+"))),t};return(0,e.createElement)("div",{id:"wcf-order-bump-preview-wrapper",className:"wcf-order-bump-preview-wrapper"},(0,e.createElement)("div",{className:`wcf-bump-order-wrap wcf-bump-order-${f} wcf-${u}`,style:$},function(){let t="";return"style-1"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap",style:q},"right"!==ae&&(0,e.createElement)("label",{style:{color:S}},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("span",{className:"wcf-bump-order-label"},d)),"right"===ae&&(0,e.createElement)("label",{style:{color:S}},(0,e.createElement)("span",{className:"wcf-bump-order-label"},d),(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b)),(0,e.createElement)("div",{className:"wcf-content-container"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight",style:{color:Y}},m)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})))):"style-2"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight",style:{color:Y}},m)),(0,e.createElement)("div",{className:"wcf-content-container"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"===re?"":re}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"===re?"":re}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")}))),(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap",style:q},"right"!==ae&&(0,e.createElement)("label",{style:{color:S}},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("span",{className:"wcf-bump-order-label"},d)),"right"===ae&&(0,e.createElement)("label",{style:{color:S}},(0,e.createElement)("span",{className:"wcf-bump-order-label"},d),(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b))):"style-3"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},""!==te&&"top"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-action"},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-image",style:{maxWidth:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},""===te&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),""!==te&&"top"===ae&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne())),"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h),""===te&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}))),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-image",style:{maxWidth:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b))):"style-4"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:"auto"===re?"100px":re},alt:(0,z.__)("Order Bump Product Image","cartflows")})),"right"!==ae&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-info"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne())),(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows")))),"right"===ae&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows"))),(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-info"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()))),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:"auto"===re?"100px":re},alt:(0,z.__)("Order Bump Product Image","cartflows")})))):"style-5"===f&&(t=(0,e.createElement)("div",{className:"wcf-bump-order-content"},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("div",{className:`wcf-bump-order-info wcf-bump-order-image-${ae} `},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:re},alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-text"},""!==h&&(0,e.createElement)("div",{className:"wcf-bump-order-label",style:{color:V}},(0,e.createElement)("span",null,h)),""!==g&&(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne(),"checkbox"===M&&(0,e.createElement)("div",{className:"wcf-bump-order-action",style:K},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("label",{style:{color:S}},d)),"button"===M&&(0,e.createElement)("div",{className:"wcf-bump-order-action wcf-ob-action-button"},(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows")))),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:re},alt:(0,z.__)("Order Bump Product Image","cartflows")})))))),t}()))};function GA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"}))}const XA=t.forwardRef(GA);function JA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const $A=t.forwardRef(JA),qA=()=>{const[{flow_id:e,step_id:a,current_ob:r},n]=Bc(),[,i]=m();return{saveOrderBump:(0,t.useCallback)(()=>{i({status:"PROCESSING"});const t=document.querySelector(".wcf-slide-out-panel--form");if(!t)return i({status:"RESET"}),Promise.resolve(!1);if(null===r)return i({status:"SAVED"}),Promise.resolve(!0);if("undefined"!=typeof tinymce){const e=tinymce.get("wcf-order-bump-desc-editor");e&&e.save()}const s=new window.FormData(t),o=r.id;return s.append("action","cartflows_pro_save_order_bump_settings"),s.append("security",cartflows_admin.save_order_bump_settings_nonce),s.append("post_id",e),s.append("step_id",a),s.append("ob_id",o),A()({url:cartflows_admin.ajax_url,method:"POST",body:s}).then(e=>{if(e.data&&e.data.success){const e=new window.FormData;return e.append("action","cartflows_pro_get_current_order_bump"),e.append("security",cartflows_admin.get_current_order_bump_nonce),e.append("ob_id",o),e.append("step_id",a),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(e=>(e.data&&e.data.success&&e.data.current_ob&&n({type:"SET_CURRENT_OB",current_ob:e.data.current_ob,ob_id:o}),i({status:"SAVED"}),window.wcfUnsavedChanges=!1,!0))}return i({status:"RESET"}),!1}).catch(e=>(console.error(e),i({status:"RESET"}),!1))},[e,a,r,n,i])}},KA=function(a){const[{step_id:r,options:n,current_ob:i},s]=Bc(),[o,l]=(0,t.useState)("product"),c=new URLSearchParams((0,p.useLocation)().search),u=a.ob_id,d=c.get("obtab"),m=PN(),{saveOrderBump:g}=qA();!function(){const[{current_ob:e},a]=Bc(),r=function(t){const{name:r,value:n}=t.detail;if(r.includes("[")){const t=r.split("["),i=[];for(let e=1;e<t.length;e++)i.push(t[e].split("]")[0]);const s=r.substr(0,r.indexOf("[")),o=e[s];switch(i.length){case 2:o[i[0]][i[1]]=n;break;case 4:o[i[0]][i[1]][i[2]][i[3]]=n}a({type:"SET_OB_OPTION",name:s,value:o})}void 0!==e&&(window.wcfUnsavedChanges=!0,a({type:"SET_OB_OPTION",name:r,value:n}))},n=[{type:"select"},{type:"select2"},{type:"checkbox"},{type:"text"},{type:"textarea"},{type:"code"},{type:"number"},{type:"radio"},{type:"color"},{type:"font"},{type:"product"},{type:"coupon"},{type:"image-selector"},{type:"wpeditor"},{type:"toggle"},{type:"selectioncard"}];(0,t.useEffect)(()=>(e&&n.map(function(e){return document.addEventListener(`wcf:${e.type}:change`,r),""}),()=>{n.map(function(e){return document.removeEventListener(`wcf:${e.type}:change`,r),""})}),[e])}();const f=[{name:(0,z.__)("Product","cartflows"),slug:"product",icon:(0,e.createElement)(NL,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Content","cartflows"),slug:"content",icon:(0,e.createElement)(XA,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Styles","cartflows"),slug:"styles",icon:(0,e.createElement)(xA,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Conditions","cartflows"),slug:"conditions",icon:(0,e.createElement)($A,{className:"w-18 h-18 stroke-2"})}];if((0,t.useEffect)(()=>((async()=>{!function(){const e=new window.FormData;e.append("action","cartflows_pro_get_current_order_bump"),e.append("security",cartflows_admin.get_current_order_bump_nonce),e.append("ob_id",u),e.append("step_id",r),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(e=>{e.data.success&&s({type:"SET_CURRENT_OB",current_ob:e.data.current_ob,ob_id:u})})}(),null!==n&&"undefined"!==n||A()({path:`/cartflows/v1/admin/step-data/${r}`}).then(e=>{if(e.billing_fields){const t=Object.entries(e.billing_fields.fields).map(([e,t])=>({...t,key:e}));e.billing_fields=t}if(e.shipping_fields){const t=Object.entries(e.shipping_fields.fields).map(([e,t])=>({...t,key:e}));e.shipping_fields=t}s({type:"SET_STEP_DATA",data:e})})})(),()=>{}),[]),null===i||"undefined"===i){let t="";switch(d){case"design":case"content":t=(0,e.createElement)(CA,null);break;case"product":default:t=(0,e.createElement)(OA,null);break;case"settings":t=(0,e.createElement)(YA,null);break;case"conditions":t=(0,e.createElement)(UA,null)}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-page-wrapper wcf-order-bump-page-wrapper"},t))}if(i&&u!==i.id)return"";return(0,e.createElement)("div",{className:"wcf-order-bump-page-wrapper p-6 bg-gray-50 rounded-b-lg"},(0,e.createElement)("div",{className:"wcf-order-bump-content-tab__preview"},(0,e.createElement)(ZA,null)),(0,e.createElement)("div",{className:"wcf-order-bump--tabs-wrapper border border-gray-200 isolate inline-flex rounded-md shadow-sm w-full mt-8 mb-8 gap-0.5"},f.map(t=>{const a=t.slug===o?"z-10 text-primary-600 bg-primary-25 outline-none ring-1 ring-primary-300 rounded-lg shadow shadow-primary-lg":"";return(0,e.createElement)("button",{type:"button",className:Dn()("wcf-order-bump--tab flex justify-center gap-2 relative text-center w-1/3 items-center px-4 py-2 text-sm font-medium text-gray-400 hover:bg-primary-25 hover:ring-1 hover:ring-primary-300 hover:rounded-lg hover:text-primary-600",a),onClick:()=>{!async function(e){e!==o?(await async function(){return!!window.wcfUnsavedChanges&&await m({title:(0,z.__)("Save Changes","cartflows"),description:(0,z.__)("You have made changes. Do you want to save the changes?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows"),onConfirm:g})}()||l(e),window.wcfUnsavedChanges=!1):l(e)}(t.slug)},key:t.slug},t.icon?t.icon:"",(0,e.createElement)("span",{className:"text-center"},t.name))})),function(){let t=(0,e.createElement)("h1",null,"404 Not Found");switch(o){case"styles":t=(0,e.createElement)(PA,null);break;case"product":default:t=(0,e.createElement)(HA,null);break;case"content":t=(0,e.createElement)(BA,null);break;case"conditions":t=(0,e.createElement)(VA,null)}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",null,t))}())},ez=function(a){const{flow_id:r,step_id:n,data:i,callback:s}=a,[{},o]=Bc(),[l,c]=(0,t.useState)(i.status),[u,d]=(0,t.useState)(!1),[m,g]=(0,t.useState)(""),[p,f]=(0,t.useState)(!1),[h,M]=(0,t.useState)(!1),y=(0,t.createRef)(),[N,w]=(0,t.useState)(""),x=PN();(0,t.useEffect)(()=>{c(l)},[l,N]);let b=i.title;const D=function(e){e.preventDefault(),f(!0)},v=function(e){e.preventDefault(),f(!1)},j=function(e){e.preventDefault(),M(!0);const t=e.target.getAttribute("data-ob_id"),a=y.current.value,r=new window.FormData;r.append("action","cartflows_pro_update_order_bump_title"),r.append("security",cartflows_admin.update_order_bump_title_nonce),r.append("step_id",n),r.append("new_title",a),r.append("ob_id",t),A()({url:cartflows_admin.ajax_url,method:"POST",body:r}).then(()=>{o({type:"SET_OB_TITLE",title:a,name:"wcf-order-bumps",ob_id:t}),M(!1),f(!1)})},_=function(e){event.preventDefault();const t=e.target.getAttribute("data-ob_id");w(!N&&t?t:"")};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump border-b border-gray-200 last:border-0",onDragEnd:s},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper flex items-center relative p-6 text-sm gap-2"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product w-3/4"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title flex items-center gap-2"},(0,e.createElement)("span",{className:"text-sm font-medium text-gray-800 flex gap-2 justify-center items-center"},function(){""===b&&(b=(0,z.__)("(no title)","cartflows"));let t=Mn(b,cartflows_admin.title_length.max,cartflows_admin.title_length.display_length),a=(0,e.createElement)("a",{href:"#",className:"wcf-ob-header__title--edit flex p-1 cursor-pointer text-gray-500 hover:text-primary-500 hover:bg-gray-100 focus:bg-gray-100 relative wcf-inline-tooltip","data-tooltip":(0,z.__)("Edit Step Name","cartflows"),onClick:D},(0,e.createElement)(ON,{className:"w-4 h-4 stroke-1"}));return p&&(t=(0,e.createElement)(xp,{attr:{ref:y},id:"new-step-title",value:b,autocomplete:"off",class:"new-step-title text-sm font-medium text-gray-800 !border-gray-200 !outline-none !shadow-none !px-3 !py-1"}),a=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"wcf-button--small wcf-button wcf-primary-button "+(h?"wcf-disabled":""),href:"#",onClick:j,"data-ob_id":i.id},h&&(0,e.createElement)(MN,null),(0,z.__)("Save","cartflows")),(0,e.createElement)("button",{className:"wcf-button--small wcf-button wcf-secondary-button",href:"#",onClick:v},(0,z.__)("Cancel","cartflows")))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"wcf-ob-header__title--text"},t),(0,e.createElement)("span",{className:"wcf-ob-header__title--buttons flex gap-2"},a))}()),""===i.product&&(0,e.createElement)("span",{className:"wcf-badge wcf-badge--warning text-xs border-0"},(0,e.createElement)(FE,{className:"w-4 h-4 stroke-2"}),(0,z.__)("No product","cartflows")))),(0,e.createElement)("div",{className:"wcf_order_bump__status w-[12%] flex gap-2"},(0,e.createElement)("button",{type:"button",className:Dn()("bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-2",l?"bg-primary-600":"bg-gray-200"),role:"switch",onClick:function(e){d(!0);const t=e.target.getAttribute("data-ob_id"),a=new window.FormData;a.append("action","cartflows_pro_update_order_bump_status"),a.append("security",cartflows_admin.update_order_bump_status_nonce),a.append("ob_id",t),a.append("post_id",r),a.append("step_id",n),a.append("ob_status",!l),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(()=>{o({type:"SET_OB_STATUS",name:"wcf-order-bumps",newStatus:!l,ob_id:t}),c(!l),d(!1)})},"data-wcf-order-bump-switch":l,"data-ob_id":i.id},(0,e.createElement)("span",{"aria-hidden":"true",className:Dn()(l?"translate-x-5":"translate-x-0","translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")})),u&&(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-2 text-primary-500 animate-spin"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions flex justify-between w-[12%]"},(0,e.createElement)("span",{className:"wcf-clone-bump-button cursor-pointer text-gray-500 hover:text-primary-500 p-1 hover:bg-gray-100 focus:bg-gray-100 rounded relative wcf-inline-tooltip",id:i.id,onClick:e=>{e.preventDefault();const t=new window.FormData,a=e.target.closest(".wcf-clone-bump-button").getAttribute("id");g("clone"),t.append("action","cartflows_pro_clone_order_bump"),t.append("security",cartflows_admin.clone_order_bump_nonce),t.append("ob_id",a),t.append("step_id",n),A()({url:cartflows_admin.ajax_url,method:"POST",body:t}).then(e=>{e.success&&(o({type:"UPDATE_ORDER_BUMP",name:"wcf-order-bumps",order_bumps:e.data.order_bumps}),g(""))})},"data-tooltip":(0,z.__)("Duplicate Order Bump","cartflows")},"clone"===m?(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-1 animate-spin"}):(0,e.createElement)(WE,{className:"w-18 h-18 stroke-1"})),(0,e.createElement)("a",{className:"wcf-setting-bump-button cursor-pointer text-gray-500 p-1 hover:bg-primary-50 hover:text-primary-500 focus:bg-primary-50 rounded relative wcf-inline-tooltip "+(N===i.id?"bg-primary-50 text-primary-500":""),"data-ob_id":i.id,"data-tooltip":(0,z.__)("Edit Order Bump","cartflows"),onClick:_},(0,e.createElement)($A,{className:"w-18 h-18 stroke-1","data-ob_id":i.id,onClick:_})),(0,e.createElement)("span",{className:"wcf-remove-order-bump-button cursor-pointer text-gray-500 hover:text-primary-500 p-1 hover:bg-gray-100 focus:bg-gray-100 rounded relative wcf-inline-tooltip after:-left-16",id:i.id,onClick:async function(e){if(e.preventDefault(),!await x({title:(0,z.__)("Trash Order Bump","cartflows"),description:(0,z.__)("Do you really want to trash this order bump permanently?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")}))return;const t=e.target.closest(".wcf-remove-order-bump-button").getAttribute("id");g("delete");const a=new window.FormData;a.append("action","cartflows_pro_delete_order_bump"),a.append("security",cartflows_admin.delete_order_bump_nonce),a.append("ob_id",t),a.append("post_id",r),a.append("step_id",n),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(e=>{e.success&&(o({type:"REMOVE_ORDER_BUMP",name:"wcf-order-bumps",ob_id:t}),g(""))})},"data-tooltip":(0,z.__)("Delete Order Bump","cartflows")},"delete"===m?(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-2 animate-spin"}):(0,e.createElement)(au,{className:"w-18 h-18 stroke-1"}))))),N&&(0,e.createElement)(KA,{ob_id:N}))},tz=function(){return(0,e.createElement)("div",{className:"wcf-multiple-order-bumps is-placeholder"},(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__add-new"},(0,e.createElement)("span",{className:"wcf-add-new-order-bump wcf-button--primary"})),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__header"},(0,e.createElement)("div",{className:"wcf-column wcf-column--title"},"Title"),(0,e.createElement)("div",{className:"wcf-column wcf-column--status"},"Status"),(0,e.createElement)("div",{className:"wcf-column wcf-column--actions"},"Actions")),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__content"},(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump"},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title"},(0,e.createElement)("span",{title:"ob"}))),(0,e.createElement)("div",{className:"wcf_order_bump__status"},(0,e.createElement)("span",{className:"wcf-ob-status"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions"},(0,e.createElement)("span",{title:"Edit Order Bump"}))))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump"},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title"},(0,e.createElement)("span",{title:"ob"}))),(0,e.createElement)("div",{className:"wcf_order_bump__status"},(0,e.createElement)("span",{className:"wcf-ob-status"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions"},(0,e.createElement)("span",{title:"Edit Order Bump"})))))))},az=function(){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)("span",{className:"wcf-accordion-button relative flex justify-between items-center w-full py-4 px-0 text-base font-semibold text-gray-800 text-left transition focus:outline-none"},(0,e.createElement)("span",{className:"flex gap-2 items-center"},(0,e.createElement)("span",null,(0,z.__)("Order Bumps","cartflows")),(0,e.createElement)("span",{className:"wcf-pro-badge px-2 py-0.5 text-xs text-primary-600 ml-auto rounded-[14px] shadow-[0px_6px_16px_-2px_rgba(240,100,52,0.4)]"},(0,e.createElement)("span",null,(0,z.__)("PRO","cartflows"))))),(0,e.createElement)(KN,{heading:(0,z.__)("Increase Your Revenue with Smart Order Bumps","cartflows"),subHeading:(0,z.__)("Boost sales with CartFlows’ Order Bump! Offer personalized add-ons at checkout to increase revenue effortlessly. Quick to set up, no coding needed!","cartflows")})))},rz=function(){const[{options:a,step_id:r,flow_id:n,page_settings:i},s]=Bc(),[{license_status:o}]=m(),[l,c]=(0,t.useState)(),[u,d]=(0,t.useState)(""),g=(0,z.__)("Add","cartflows"),[p,f]=(0,t.useState)({button_text:g,is_processing:!1}),{button_text:h,is_processing:M}=p;if(!wcfCartflowsTypePlusPro()||"Activated"!==o)return(0,e.createElement)(az,null);if(null===a||"undefined"===i)return(0,e.createElement)(tz,null);const y=i,N=a["wcf-order-bumps"],w=Object.keys(N).length,x=i?.settings["multiple-order-bump-design"],b=()=>{const e=a["wcf-order-bumps"],t=[];Object.keys(e).map(a=>(t.push(e[a].id),""));const n=new window.FormData;n.append("action","cartflows_pro_reorder_order_bumps"),n.append("security",cartflows_admin.reorder_order_bumps_nonce),n.append("step_id",r),n.append("sorted_obs",t),A()({url:cartflows_admin.ajax_url,method:"POST",body:n}).then(()=>{})};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",{className:"text-base font-semibold text-gray-800 py-4"},(0,z.__)("Order Bumps","cartflows")),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps--wrapper py-2"},w>0&&(0,e.createElement)("div",{className:"wcf-multiple-order-bumps -mx-4 mt-4 ring-1 ring-gray-200 sm:mx-0 sm:rounded-lg"},(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__header flex items-center border-b border-gray-200 px-6 py-4 text-left text-sm font-medium text-gray-800"},(0,e.createElement)("span",{className:"wcf-column wcf-column--title w-3/4"},(0,z.__)("Title","cartflows")),(0,e.createElement)("span",{className:"wcf-column wcf-column--status w-[13%]"},(0,z.__)("Status","cartflows")),(0,e.createElement)("span",{className:"wcf-column wcf-column--actions w-[12%]"},(0,e.createElement)("span",{className:"sr-only"},(0,z.__)("Actions","cartflows")))),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__content"},N&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Fc.ReactSortable,{list:N,setList:e=>s({type:"SET_OB",obs:e,fieldName:"wcf-order-bumps",step_id:r,flow_id:n}),swapThreshold:.8,direction:"vertical",animation:150,handle:".wcf-order-bump",filter:".wcf-order-bump__action, .wcf_order_bump__status, .wcf-order-bump__data-title a",preventOnFilter:!1},N.map(t=>(0,e.createElement)(ez,{key:t.id,flow_id:n,step_id:r,data:t,title:t.title,settings:y.settings["multiple-order-bump"],design_settings:x,callback:b})))))),0===w&&(0,e.createElement)("div",{className:"border border-gray-200 bg-gray-25 rounded-md px-5 py-7 text-sm text-gray-600 text-center"},(0,z.__)("Create an order bump.","cartflows")),(0,e.createElement)("div",{className:"flex wcf-multiple-order-bumps__add-new mt-5 gap-3"},(0,e.createElement)(En,{name:"",value:l,sectionClass:"block text-left w-full",wrapperClass:"block",class:"!w-full !h-auto input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0 !placeholder-gray-400",placeholder:(0,z.__)("Enter order bump name","cartflows"),onChangeCB:c,desc:u,descClass:"absolute text-sm font-normal text-primary-500 mt-2"}),(0,e.createElement)("a",{className:"wcf-add-new-order-bump wcf-button "+(M?"wcf-disabled":"wcf-secondary-button"),onClick:function(e){if(e.preventDefault(),void 0!==l){d(""),f({button_text:(0,z.__)("Adding…","cartflows"),is_processing:!0});const t={title:l,id:Math.random().toString(36).substring(2,5)},a=new window.FormData;a.append("action","cartflows_pro_add_order_bump"),a.append("security",cartflows_admin.add_order_bump_nonce),a.append("ob_id",t.id),a.append("post_id",n),a.append("step_id",r),a.append("title",l),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(t=>{t.success&&(s({type:"UPDATE_ORDER_BUMP",name:"wcf-order-bumps",order_bumps:t.data.order_bumps}),c(""),f({button_text:g,is_processing:!1})),e.target.blur()})}else d((0,z.__)("Please enter the order bump title","cartflows")),e.target.blur()}},M?(0,e.createElement)(MN,null):(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,e.createElement)("span",null,h)))),(0,e.createElement)(Ny,{content:(0,z.sprintf)(
48 +(0,z.__)("Use this setting to customize the style of the Instant %s Layout.","cartflows"),"thankyou"===o?.type?(0,z.__)("Thank You","cartflows"):o?.type.charAt(0).toUpperCase()+o?.type.slice(1))):(0,e.createElement)(e.Fragment,null,(0,z.__)("If you are using shortcodes, enable this design settings to apply styles.","cartflows"))))),u&&(0,e.createElement)("div",{className:"wcf-design-page__settings"},(0,e.createElement)("div",{className:"mb-4"},(0,e.createElement)(Yy,{id:"wcf-enable-design-settings",name:"wcf-enable-design-settings",value:n["wcf-enable-design-settings"],label:(0,z.__)("Enable Design Settings","cartflows"),fullWidth:!0})),"yes"===n["wcf-enable-design-settings"]&&Object.keys(u).map((t,a)=>(0,e.createElement)(IA,{settings:u[t],key:t,isOpen:0===a,isActive:yn.isActiveControl(u[t],n)}))))},LA=function(){return(0,e.createElement)("div",{className:"wcf-settings-nav"},(0,e.createElement)("div",{className:"wcf-settings-nav__tabs"},Array(5).fill().map(t=>(0,e.createElement)("div",{className:"wcf-settings-nav__tab",key:t},(0,e.createElement)(nw,{height:"45px"})))),(0,e.createElement)("div",{className:"wcf-settings-nav__content"},(0,e.createElement)(aw,{fontSize:"35px",width:"225px"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"80%"}),(0,e.createElement)(aw,{width:"65%"}),(0,e.createElement)(rw,null),(0,e.createElement)(aw,{fontSize:"35px",width:"300px"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"60%"}),(0,e.createElement)(aw,{width:"45%"})))},TA=function(){const[{step_id:a,flow_id:r,step_data:n}]=Bc(),[i,s]=(0,t.useState)("collapsed"),o=(0,p.useHistory)(),l=PN();return(0,e.createElement)("div",{className:"wcf-change-step-template accordion-item bg-white -mx-8 border-b border-gray-200"},(0,e.createElement)("h2",{className:"accordion-header mb-0",id:"wcf_change_step_template_toggler"},(0,e.createElement)("button",{className:`wcf-accordion-button relative flex justify-between items-center w-full py-4 px-8 text-base font-semibold text-gray-800 text-left transition focus:outline-none ${i}`,type:"button","data-bs-toggle":"collapse","data-bs-target":"#wcf_collapse_change_step_template","aria-expanded":"false","aria-controls":"wcf_collapse_change_step_template",onClick:function(){s("collapsed"===i?"":"collapsed")}},(0,e.createElement)("span",null,(0,z.__)("Change Template","cartflows")),""===i?(0,e.createElement)(_w,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}):(0,e.createElement)(Ew,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"}))),(0,e.createElement)("div",{id:"wcf_collapse_change_step_template",className:`accordion-collapse px-8 pt-4 pb-8 ${i}`,"aria-labelledby":"wcf_change_step_template_toggler"},(0,e.createElement)("div",{className:"accordion-body"},(0,e.createElement)("div",{className:"mb-3 flex items-center gap-4"},(0,e.createElement)("img",{src:function(){let e="";switch(n.type){case"landing":e=XT;break;case"checkout":e=JT;break;case"optin":e=KT;break;case"thankyou":e=eA;break;case"upsell":e=$T;break;case"downsell":e=qT}return e}(),alt:n.type,className:"rounded-lg w-[85px] h-[85px]"}),(0,e.createElement)("div",{className:"wcf-template-content"},(0,e.createElement)("div",{className:"wcf-step-template-type mb-3"},(0,e.createElement)("span",{className:"text-sm font-medium"},(0,z.__)("Step Type: ","cartflows")),(0,e.createElement)("span",{className:"text-sm font-normal text-gray-500 capitalize"},n.type)),(0,e.createElement)("div",{className:"wcf-change-step wcf-button wcf-secondary-button",onClick:async function(){await l({title:(0,z.__)("Update Template","cartflows"),description:(0,z.__)("Changing the template will permanently delete the current design in this step. Would you still like to proceed?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})&&o.push(`admin.php?page=cartflows&path=store-checkout&action=wcf-edit-flow&flow_id=${r}step_id=${a}&tab=update-template`)}},(0,e.createElement)("span",{className:""},(0,z.__)("Update Template","cartflows"))))))))},AA=function(){const[{step_data:t,settings_data:a,page_builder:r,flow_type:n,step_title:i,options:s}]=Bc(),[{license_status:o}]=m();let l=!0;void 0!==t.id&&(l=!1);const c=a.settings,u=Object.values(c).sort(function(e,t){return e.priority-t.priority});return l?(0,e.createElement)(LA,null):["upsell","downsell"].includes(t.type)&&wcfCartflowsPro()&&"Activated"!==o?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)(KN,{heading:(0,z.__)("License is required!","cartflows"),subHeading:(0,z.__)("Activate the license to modify this offer step's settings","cartflows")}))):(0,e.createElement)("div",{className:"wcf-settings-page"},c&&Object.keys(u).map((a,n)=>"other"!==r&&"shortcode"===u[a].slug?null:(u[a].step_type=t?.type||"",(0,e.createElement)(IA,{settings:u[a],key:a,displayAs:"div",isOpen:0===n,isActive:yn.isActiveControl(u[a],s)}))),"storeCheckout"===n&&i&&(0,e.createElement)(TA,null))},zA=function({settings:t},a="tr"){const[{options:r}]=Bc(),n=e=>{let t="";const a=e.name;if(a&&a.includes("[")){const n=a.split("["),i=[];for(let e=1;e<n.length;e++)i.push(n[e].split("]")[0]);const s=a.substr(0,a.indexOf("[")),o=r[s],l=r["wcf-offer-product"];if((null==l||""===l||l.length<=0)&&("wcf-offer-product[original_price]"===a||"wcf-offer-product[sell_price]"===a))return(0,z.__)("No product Selected","cartflows");const c=Array.isArray(l)?parseFloat(l[0].original_price):parseFloat(l.original_price);if("wcf-offer-product[sell_price]"===a&&c){const t=r["wcf-offer-discount"],a=parseFloat(r["wcf-offer-discount-value"]);let n=c;return"discount_percent"===t?a>0&&(n=(c-c*a/100).toFixed(2)):"discount_price"===t&&a>0&&(n=(c-a).toFixed(2)),e.class=n<0?"error_field":"",n}t=o[i[0]]}else t=r[e.name]?r[e.name]:"";return t};return(0,e.createElement)("div",{className:"wcf-list-options wcf-offer-list-options"},(0,e.createElement)("div",{className:"wcf-list-options-wrapper"},"tr"===a?(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,Object.keys(t.fields).map(a=>{const i=t.fields[a],s=n(i),o=yn.isActiveControl(i,r);return(0,e.createElement)(Sy,{key:a,data:i,value:s,isActive:o,field:a})}))):(0,e.createElement)("div",{className:"wcf-list-options-container"},Object.keys(t.fields).map(i=>{const s=t.fields[i],o=n(s),l=yn.isActiveControl(s,r);return(0,e.createElement)(Sy,{key:i,data:s,value:o,isActive:l,field:i,tabName:"list-options",displayAs:a})}))),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null)))},kA=function(){return(0,e.createElement)("div",{className:"wcf-checkout-products is-placeholder"},(0,e.createElement)("div",{className:"wcf-checkout-products--selection wcf-checkout__section"},(0,e.createElement)("div",{className:"wcf-product-selection-wrapper"},(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options__title"},(0,e.createElement)("div",{className:"title wcf-placeholder__width--30"})),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,e.createElement)("div",{className:"wcf-checkout-product-selection-field"},(0,e.createElement)("div",{className:"wcf-checkout-product-selection-field__add-new"},(0,e.createElement)("div",{className:"wcf-checkout-products__button"}),(0,e.createElement)("div",{className:"wcf-checkout-products__button"})))))))))),(0,e.createElement)("div",{className:"wcf-checkout-products__pro-options"},(0,e.createElement)("div",{className:"wcf-checkout-products--coupon"},(0,e.createElement)("div",{className:"wcf-coupon-selection-wrapper"},(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options__title"},(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field"},(0,e.createElement)("div",{className:"title"}))))))))))),(0,e.createElement)("div",{className:"wcf-field wcf-submit"},(0,e.createElement)("div",{className:"wcf-checkout-products__button"})))},SA=function(){const[{settings_data:a,page_settings:r,options:n,step_data:i},s]=Bc(),[{license_status:o}]=m(),l=n["wcf-offer-product"]?n["wcf-offer-product"]:"",c=[{value:"",label:"No Discount",icon:(0,e.createElement)(Vc,{className:"w-5 h-5"})},{value:"discount_percent",label:"Discount Percentage",icon:(0,e.createElement)(Gc,{className:"w-5 h-5"})},{value:"discount_price",label:"Discount Price",icon:(0,e.createElement)(Jc,{className:"w-5 h-5"})}],[u,d]=(0,t.useState)(),[g,p]=(0,t.useState)(""),f=(0,z.__)("Add","cartflows"),h=void 0===l.discount_type||""===l.discount_type?"disable":"enable",[M,y]=(0,t.useState)(h);(0,t.useEffect)(()=>{y(l?.discount_type?"enable":"disable")},[l]);const[N,w]=(0,t.useState)({isInProcessing:!1,buttonText:f}),{isInProcessing:x,buttonText:b}=N;return void 0===a.settings?(0,e.createElement)(kA,null):["upsell","downsell"].includes(i.type)&&wcfCartflowsPro()&&"Activated"!==o?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)(KN,{heading:(0,z.__)("License is required!","cartflows"),subHeading:(0,z.__)("Activate the license to modify this offer step's settings","cartflows")}))):(0!==l.length&&function(){const e=n["wcf-offer-discount"],t=parseFloat(n["wcf-offer-discount-value"]),a=parseFloat(l.original_price);let r=0;"discount_percent"===e?t>0&&(r=a-a*t/100):"discount_price"===e&&t>0&&(r=a-t),l.sell_price=r.toFixed(2)}(),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-offer-product--wrapper"},(0,e.createElement)("div",{className:"wcf-offer-products--selection wcf-products__section"},0===l.length?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("input",{name:"wcf-offer-product[]",type:"hidden",value:""}),(0,e.createElement)("div",{className:"wcf-offer-no-product--notice border border-gray-200 bg-gray-25 text-center text-sm font-normal rounded-md p-5"},(0,z.__)("Once you select the product, they will be displayed here.","cartflows")),(0,e.createElement)("div",{className:"wcf-offer-product-selection-field__add-new flex justify-between gap-5 mt-5"},(0,e.createElement)(by,{name:"",desc:"",field:"product",value:g,allowed_products:"",include_products:"braintree-subscription, braintree-variable-subscription",excluded_products:"grouped",placeholder:(0,z.__)("Search for a Product","cartflows"),onChangeCB:d}),(0,e.createElement)("div",{className:"wcf-select-product-button inline-flex"},(0,e.createElement)("button",{type:"button",className:Dn()("wcf-button",x?"wcf-disabled":"wcf-secondary-button"),onClick:function(){const e=u?.value;p(u),e&&(w({isInProcessing:!0,buttonText:(0,z.__)("Adding…","cartflows")}),A()({path:`/cartflows/v1/admin/product-data/${e}`}).then(t=>{console.log(t),s({type:"ADD_OFFER_PRODUCT",field_name:"wcf-offer-product",product_data:{value:e,quantity:"1",label:u?.label,img_url:t?.img_url,original_price:t?.regular_price}}),p(null),w({isInProcessing:!1,buttonText:f})}),d(null))}},!x&&(0,e.createElement)(Sn,{className:"w-4 h-4 stroke-2","aria-hidden":"true"}),x&&(0,e.createElement)(Cn,{className:"w-4 h-4 stroke-2 animate-spin","aria-hidden":"true"}),b)))):(0,e.createElement)("div",{className:"overflow-visible shadow border border-gray-200 rounded-md"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--header border-b border-gray-200 flex gap-6 p-3"},(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/2"},(0,z.__)("Items","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-[10%]"},(0,z.__)("Quantity","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/5"},(0,z.__)("Discount","cartflows")),(0,e.createElement)("div",{className:"text-left text-sm font-semibold text-gray-900 w-1/6"},(0,z.__)("Shipping Rate","cartflows")),(0,e.createElement)("div",{className:"relative w-[5%]"},(0,e.createElement)("span",{className:"sr-only"},(0,z.__)("Delete","cartflows")))),(0,e.createElement)("div",{className:"wcf-offer-product-selection--selected-product flex items-center p-3 gap-4"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-title whitespace-nowrap text-sm font-medium text-gray-900 w-1/2"},(0,e.createElement)("div",{className:"flex gap-3 items-center"},(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-image flex w-24 h-24"},(0,e.createElement)("img",{src:l.img_url?l.img_url:cartflows_admin.image_placeholder,className:"product-image rounded-md w-full h-full aspect-{3/2} object-contain",alt:xn(l.label)})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-title_text"},(0,e.createElement)("div",{className:"wcf-offer-product-repeater-field__title whitespace-normal text-left","data-product_id":l.value},xn(l.label)),(0,e.createElement)("div",{className:"wcf-offer-product-repeater-field__reg-price mt-1"},(0,e.createElement)("div",{className:"flex gap-2"},(0,e.createElement)("span",{className:"wcf-offer-product--reg-price "+(0<l.sell_price?"line-through text-gray-400":"")},cartflows_admin.woo_currency+l.original_price),0<l.sell_price&&(0,e.createElement)("span",{className:"wcf-offer-product--sale-price"},cartflows_admin.woo_currency+l.sell_price)))))),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-qty whitespace-nowrap text-sm text-gray-500 w-[10%]"},(0,e.createElement)(bp,{id:"",name:"wcf-offer-quantity",class:"input-field !w-20 !min-h-[43px] !text-sm font-normal !rounded-md text-gray-400 !border !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",value:n["wcf-offer-quantity"],min:"1"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--product-discount flex whitespace-nowrap text-sm text-gray-500 w-1/5"},(0,e.createElement)(hN,{name:"wcf-offer-discount",value:n["wcf-offer-discount"],class:"!block !w-20 !m-0",options:c,callback:function(e,t,a){y(""===a?"disable":"enable")}}),(0,e.createElement)(bp,{id:"",class:"input-field !w-20 !min-h-[43px] !leading-[3] !text-sm font-normal !rounded-r-md !rounded-l-none text-gray-400 !border !border-l-0 !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"wcf-offer-discount-value",value:"disable"===M?"":n["wcf-offer-discount-value"],readonly:"disable"===M?"readonly":"",placeholder:"disable"===M?"":"0",min:"1",step:"any"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection--flat-rate flex whitespace-nowrap text-sm text-gray-500 w-1/6"},(0,e.createElement)(bp,{id:"",class:"input-field !w-20 !min-h-[43px] !leading-[3] !text-sm font-normal !rounded-md text-gray-400 !border !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"wcf-offer-flat-shipping-value",placeholder:"0",value:n["wcf-offer-flat-shipping-value"],min:"0"})),(0,e.createElement)("div",{className:"wcf-offer-product-selection-actions flex gap-2 relative whitespace-nowrap text-right text-sm font-medium w-[5%] justify-center"},(0,e.createElement)("div",{className:"wcf-delete-product-item py-2 text-primary-500 hover:text-primary-700 cursor-pointer text-right flex justify-end",onClick:function(){s({type:"REMOVE_OFFER_PRODUCT",field_name:"wcf-offer-product"})}},(0,e.createElement)(au,{className:"h-18 w-18"}))),(0,e.createElement)("input",{name:"wcf-offer-product[]",type:"hidden",className:"wcf-checkout-product-id",value:l.value})))),(0,e.createElement)("div",{className:"wcf-offer-product--common-settings pt-8"},(0,e.createElement)(zA,{settings:r?.settings.product,displayAs:"div"})))))},OA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-product-tab p-6 is-placeholder"},(0,e.createElement)("div",{role:"status",className:"space-y-8 animate-pulse md:space-y-0 md:space-x-8 md:flex md:items-center"},(0,e.createElement)("div",{className:"flex items-center justify-center w-full h-48 bg-gray-300 rounded sm:w-96"},(0,e.createElement)("svg",{className:"w-12 h-12 text-gray-200",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",fill:"currentColor",viewBox:"0 0 640 512"},(0,e.createElement)("path",{d:"M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"}))),(0,e.createElement)("div",{className:"w-full"},(0,e.createElement)("div",{className:"wcf-accordion-loader mb-3.5"},(0,e.createElement)("span",{className:"block h-4 w-28 bg-gray-200 rounded-md mb-4"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-10/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-8/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md w-1/2 mb-4"})))),(0,e.createElement)("div",{className:"flex gap-4 mt-6"},(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"}),(0,e.createElement)("span",{className:"w-20 h-4 bg-gray-200 rounded-md"})),(0,e.createElement)("div",{className:"w-full"},(0,e.createElement)("div",{className:"mt-6 mb-3.5"},(0,e.createElement)("span",{className:"block h-4 w-28 bg-gray-200 rounded-md mb-4"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-10/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md mb-4 w-8/12"}),(0,e.createElement)("span",{className:"block h-4 bg-gray-200 rounded-md w-1/2 mb-4"}))))},CA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-design-tab is-placeholder"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__settings"},(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field wcf-product-field"},(0,e.createElement)("div",{className:"wcf-selection-field"},(0,e.createElement)("label",null)))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"wcf-select2-field wcf-product-field"},(0,e.createElement)("div",{className:"wcf-selection-field"},(0,e.createElement)("label",null)))))))),(0,e.createElement)("div",{className:"wcf-order-bump-save-settings"},(0,e.createElement)("span",null))),(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__preview"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__preview--title"},(0,e.createElement)("label",null)),(0,e.createElement)("div",{className:"wcf-bump-order-wrap wcf-bump-order-style-1 wcf-after-order"},(0,e.createElement)("div",{className:"wcf-bump-order-content"},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("span",null)),(0,e.createElement)("div",{className:"wcf-content-container"},(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight"})),(0,e.createElement)("div",{className:"wcf-bump-order-desc"})))))))},YA=function(){return(0,e.createElement)("div",{className:"wcf-order-bump-setting-tab is-placeholder"},(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-one"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-two"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field wcf-section-heading-field"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",null))))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-one"})))),(0,e.createElement)("tr",null,(0,e.createElement)("th",{scope:"row"},(0,e.createElement)("div",{className:"wcf-field__data--label"},(0,e.createElement)("label",{className:"wcf-field-two"})))))),(0,e.createElement)("div",{className:"wcf-order-bump-save-settings"},(0,e.createElement)("span",null)))},UA=function(){return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--enable_option"},(0,e.createElement)(aw,{width:"65%"})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group"},Array(3).fill().map((t,a)=>(0,e.createElement)("div",{className:"wcf-order-bumps-rule",key:t},(0,e.createElement)("div",{className:"wcf-order-bumps-rule--select-box"},(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"})),2!==a&&(0,e.createElement)("div",{className:"wcf-order-bumps-rule__and"},(0,e.createElement)(nw,{height:"25px",width:"5%"}))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or"},(0,e.createElement)(nw,{height:"35px",width:"5%"}),(0,e.createElement)(nw,{height:"45px",width:"12%"})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules-save-settings"},(0,e.createElement)(nw,{height:"45px",width:"12%"})))},QA=new function(){const e=this;this.compare=function(e,t,a){switch(a){case"==":return e==t;case"!=":return e!=t;case"!==":return e!==t;case"in":return-1!==t.indexOf(e);case"!in":return-1===t.indexOf(e);case"contains":return-1!==e.indexOf(t);case"!contains":return-1===e.indexOf(t);case"<":return e<t;case"<=":return e<=t;case">":return e>t;case">=":return e>=t;default:return e===t}},this.check=function(t,a){const r="or"===t.relation;let n=!r;return t.fields.map(function(t){let i;return i=t.fields?e.check(t,a):e.compare(a[t.name],t.value,t.operator),r?(i&&(n=!0),!i):i?"":n=!1}),n},this.isActiveControl=function(t,a){const r=!!t?.conditions&&t?.conditions;return!(r&&!e.check(r,a))}},PA=function(){const[{page_settings:t,current_ob:a}]=Bc();if(null===t||"undefined"===t)return(0,e.createElement)(CA,null);const r=t?.settings["multiple-order-bump-design"];return(0,e.createElement)("div",{className:"wcf-order-bump-design-tab"},(0,e.createElement)("div",{className:"wcf-order-bump-design-tab__settings"},r&&Object.keys(r.fields).map(t=>{const n=r.fields[t];let i="";return"borders"===n.id&&(i="grid grid-cols-4 gap-x-4"),"shadow"===n.id&&(i="grid grid-cols-5 gap-x-2"),n.section_fields?(0,e.createElement)("div",{key:t,className:`wcf-order-bump-design-tab--${n.id}-section ${i} p-5 border border-gray-200 rounded-md mb-5`},(0,e.createElement)("div",{className:"wcf-order-bump-deign-tab--heading-section col-span-full"},(0,e.createElement)(wy,{label:n.title,labelClass:"block text-base font-semibold text-gray-800 mb-5"})),Object.keys(n.section_fields).map(t=>{const r=n.section_fields[t],i=a[r.name],s=QA.isActiveControl(r,a);return(0,e.createElement)(Sy,{key:t,data:r,value:i,isActive:s,field:t,displayAs:"div",tabName:"ob-design"})})):(0,e.createElement)("div",{key:t,className:"wcf-order-bump-design-tab--section mb-5"},(0,e.createElement)(Sy,{key:n.name,data:n,value:a[n.name],isActive:QA.isActiveControl(n,a),field:n.name,displayAs:"div",tabName:"ob-design"}))})))};function FA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z"}))}const RA=t.forwardRef(FA),HA=function(){const[{page_settings:a,current_ob:r},n]=Bc(),[i,s]=(0,t.useState)(r?.product[0]?r?.product[0]:""),[o,l]=(0,t.useState)(!1),[c,u]=(0,t.useState)(),d=(0,z.__)("Add","cartflows"),[m,g]=(0,t.useState)({isInProcessing:!1,buttonText:d}),{isInProcessing:p,buttonText:f}=m,h=a?.settings["multiple-order-bump-product"],M=[{value:"",label:"Original",icon:(0,e.createElement)(Vc,{className:"w-5 h-5"})},{value:"discount_percent",label:"Percentage",icon:(0,e.createElement)(Gc,{className:"w-5 h-5"})},{value:"discount_price",label:"Price",icon:(0,e.createElement)(Jc,{className:"w-5 h-5"})},{value:"coupon",label:"Coupon",icon:(0,e.createElement)(RA,{className:"w-5 h-5"})}];return""!==i&&function(){const e=r.discount_type,t=parseFloat(r.discount_value),a=parseFloat(i.original_price);let n=0;"discount_percent"===e?t>0&&(n=a-a*t/100):"discount_price"===e&&t>0&&(n=a-t),i.sell_price=n.toFixed(2)}(),(0,t.useEffect)(()=>{const e=r?.product?.[0];s(e||""),l(!(e&&!e?.is_deleted))},[r]),null===a||"undefined"===a?(0,e.createElement)(OA,null):(0,e.createElement)("div",{className:"wcf-order-bump-product-tab"},""===i&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"border border-gray-200 bg-gray-25 text-center text-sm font-normal rounded-md p-5"},(0,z.__)("Once you have add product, it will be displayed here.","cartflows")),(0,e.createElement)("input",{type:"hidden",name:"product"}),(0,e.createElement)("div",{className:"wcf-ob-product-selection-field__add-new flex justify-between gap-5 mt-5"},(0,e.createElement)(by,{name:"",desc:"",field:"product",value:"",allowed_products:"",include_products:"braintree-subscription, braintree-variable-subscription",excluded_products:"grouped",placeholder:(0,z.__)("Search for a Product","cartflows"),onChangeCB:u}),(0,e.createElement)("div",{className:"wcf-select-product-button inline-flex"},(0,e.createElement)("button",{type:"button",className:Dn()("wcf-button",p?"wcf-disabled":"wcf-secondary-button"),onClick:function(e){e.preventDefault();const t=c?.value;"active"===cartflows_admin.woocommerce_status&&t&&(g({isInProcessing:!0,buttonText:(0,z.__)("Adding…","cartflows")}),A()({path:`/cartflows-pro/v1/admin/ob-product-data/${t}`}).then(e=>{n({type:"ADD_OB_PRODUCT",product:e}),g({isInProcessing:!1,buttonText:d})}),u())}},!p&&(0,e.createElement)(Sn,{className:"w-4 h-4 stroke-2","aria-hidden":"true"}),p&&(0,e.createElement)(Cn,{className:"w-4 h-4 stroke-2 animate-spin","aria-hidden":"true"}),f)))),""!==i&&(0,e.createElement)(e.Fragment,null,o&&(0,e.createElement)("div",{className:"border border-primary-500 bg-primary-25 text-center text-primary-500 text-xs font-normal rounded-md p-5 mb-5"},(0,z.__)("The product previously added as an Order Bump has been deleted. Please add a new product.","cartflows")),(0,e.createElement)("div",{className:"wcf-ob-product-selection--selected-product flex items-center gap-3 p-3 border border-gray-200 rounded-md"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-title whitespace-nowrap text-sm font-medium text-gray-900 w-2/4"},(0,e.createElement)("div",{className:"flex gap-3 items-center"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-image w-20 h-20"},(0,e.createElement)("img",{src:i.product_image?i.product_image:cartflows_admin.image_placeholder,className:"wcf-ob-product-image rounded-md w-full h-full aspect-{3/2} object-contain",alt:i.label})),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-title_text"},(0,e.createElement)("div",{className:"wcf-ob-product-repeater-field__title whitespace-normal text-left","data-product_id":i.value},xn(String(i?.label))),(0,e.createElement)("input",{type:"hidden",name:"product",value:i.value?i.value:""}),(0,e.createElement)("div",{className:"wcf-ob-product-repeater-field__reg-price mt-1 "},(0,e.createElement)("div",{className:"flex gap-2"},(0,e.createElement)("span",{className:`wcf-ob-product--reg-price ${0<r.discount_value?"line-through text-gray-400":""} `},cartflows_admin.woo_currency+i.original_price),0<r.discount_value&&(0,e.createElement)("span",{className:"wcf-ob-product--sale-price"},cartflows_admin.woo_currency+i.sell_price))),"coupon"===r.discount_type&&(0,e.createElement)("span",{className:"coupon-message text-xs mt-0.5 text-gray-500"},(0,z.__)("Coupon will apply on checkout page","cartflows"))))),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-discount__wrapper flex items-center gap-3 justify-start w-[45%]"},(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-qty whitespace-nowrap text-sm text-gray-500"},(0,e.createElement)(bp,{id:"",name:"quantity",class:"!w-16 !h-11 input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0 "+("no"===r.display_quantity_field?"disabled":""),value:r.quantity,min:"1",readonly:"no"===r.display_quantity_field})),(0,e.createElement)("div",{className:"wcf-ob-product-selection--product-discount flex whitespace-nowrap text-sm text-gray-500"},(0,e.createElement)(hN,{name:"discount_type",value:r.discount_type,class:"!block !w-16 !m-0",options:M}),"coupon"!==r.discount_type?(0,e.createElement)(bp,{id:"",class:"input-field !w-16 !min-h-[44px] !text-sm font-normal !rounded-tr-md !rounded-tb-md !rounded-tl-none text-gray-400 !border !border-l-0 !border-gray-200 focus:!ring-0 focus:!ring-transparent focus:!shadow-none !outline-0 !outline-none !m-0",name:"discount_value",value:""===r.discount_type?"":r.discount_value,readonly:""===r.discount_type?"readonly":"",placeholder:""===r.discount_type?"":"0",min:"1",step:"any"}):(0,e.createElement)(Dy,{wrapperClass:"w-[200px] bg-white",fieldClass:"!border-l-0 !rounded-r-md !rounded-l-none",name:"discount_coupon",placeholder:(0,z.__)("Search for a coupon","cartflows"),multiple:!1,allow_clear:!0,value:""===r.discount_type?"":r.discount_coupon}))),(0,e.createElement)("div",{className:"wcf-product-selection-actions whitespace-nowrap text-right text-sm font-medium w-[5%]"},(0,e.createElement)("div",{className:"wcf-delete-product-item p-2 text-gray-400 hover:text-primary-500 cursor-pointer flex justify-center items-center",onClick:function(){n({type:"REMOVE_OB_PRODUCT",product:""}),s("")}},(0,e.createElement)(au,{className:"h-18 w-18"})))),(0,e.createElement)("div",{className:"flex mt-5"},(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,h&&h.fields&&Object.keys(h.fields).map(t=>{const a=h.fields[t],n=a.name,i=r[n],s=QA.isActiveControl(a,r);return(0,e.createElement)(Sy,{key:t,data:a,value:i,isActive:s,field:t})}))))))},BA=function(){const[{page_settings:t,current_ob:a}]=Bc();if(null===t||"undefined"===t)return(0,e.createElement)(CA,null);const r=t?.settings["multiple-order-bump-content"];return(0,e.createElement)("div",{className:"wcf-order-bump-content-tab"},(0,e.createElement)("div",{className:"wcf-order-bump-content-tab__settings"},Object.keys(r.fields).map(t=>{const n=r.fields[t],i=a[n.name],s=QA.isActiveControl(n,a);return(0,e.createElement)(Sy,{key:t,data:n,value:i,isActive:s,field:t,options:a,displayAs:"div",tabName:"order-bump-content"})})))},WA=function({rules:t,group_id:a,g_index:r,groups_length:n}){const[{page_settings:i},s]=Bc(),o=i?.settings["multiple-order-bump-rules"],l=o.conditions,c=e=>{const t=e.target.getAttribute("rule_id");a&&t&&s({type:"REMOVE_OB_RULE",name:"rules",rule_id:t,group_id:a})};return(0,e.createElement)(e.Fragment,null,t.map((i,u)=>{const d=i?.rule_id,m=t[u],g=o.field_data[m.condition];return(0,e.createElement)(e.Fragment,null,0!==u&&(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules__condition-label"},(0,e.createElement)("div",{className:"wcf--condition-label__and_group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf--condition-label__and_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("AND","cartflows"))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules flex gap-3 items-center","data-rule-id":d,key:d},(0,e.createElement)("input",{type:"hidden",name:`rules[${r}][rules][${u}][rule_id]`,value:d}),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--rule_fields grid gap-3 items-center w-full \n\t\t\t\t\t\t\t\t\t"+(g?.fields?.some(e=>"product"===e.type)?"grid-cols-2":"grid-cols-3")},(0,e.createElement)(In,{name:`rules[${r}][rules][${u}][condition]`,wrapperClass:"block",options:l,onSelect:()=>{s({type:"RESET_OB_RULE_VALUE",name:"rules",group_id:a,rule_id:d})},value:m.condition}),(0,e.createElement)(In,{name:`rules[${r}][rules][${u}][operator]`,wrapperClass:"block",options:g.operator,value:xn(m.operator)}),function(t,a,n){const i=n.value;let s="";const o=`rules[${r}][rules][${a}][value]`;return t.map(t=>{switch(t.type){case"select2":s=(0,e.createElement)(Pc,{name:`${o}[]`,value:i,placeholder:t.placeholder,tooltip:t.tooltip,options:t.options,isMulti:t.isMulti,isSearchable:t?.enable_search});break;case"number":s=(0,e.createElement)(bp,{name:o,value:i,min:0,placeholder:t.placeholder,tooltip:t.tooltip});break;case"coupon":s="exist"===n.operator||"not_exist"===n.operator?(0,e.createElement)(In,{name:o,options:[{label:"in parent order",value:"parent_order"}]}):(0,e.createElement)(Dy,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti});break;case"product":s=(0,e.createElement)(by,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti,sectionClass:"col-span-full",showLabelOnly:!0})}return s})}(g.fields,u,m)),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--rule_actions"},function(t,r){return 1===t&&1===n?"":(0,e.createElement)(au,{className:"w-5 h-6 stroke-2 p-0.5 text-gray-400 cursor-pointer hover:text-primary-700 focus:text-primary-700",onClick:c,group_id:a,rule_id:r})}(t.length,d))))}))},VA=function(){const[{options:a,current_ob:r},n]=Bc(),[i,s]=(0,t.useState)({ruleGroupId:"",isOpen:!1}),{ruleGroupId:o,isOpen:l}=i;if(null===a||"undefined"===r)return(0,e.createElement)(UA,null);const c=r.rules;if(void 0===c)return(0,e.createElement)(Ny,{content:(0,z.__)("Please Update the CartFlows Pro to the latest version to use the conditional order bump feature.","cartflows")});const u=()=>{const e={group_id:Math.random().toString(36).substring(2,5),rules:[{rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""}]};n({type:"ADD_NEW_OB_GROUP",name:"rules",newGroup:e})},d=e=>{const t=e.target.getAttribute("data-group_id"),a={rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""};n({type:"ADD_NEW_OB_RULE",name:"rules",newRule:a,group_id:t})},m=function(e){const t=e.target.getAttribute("data-group_id");s({ruleGroupId:t,isOpen:o!==t||!l})};return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--enable_option"},(0,e.createElement)(Yy,{name:"is_rule",value:r.is_rule,label:(0,z.__)("Enable conditional order bump ","cartflows"),tooltip:(0,z.__)("By enabling this option, you can create the conditions to display the order bump.","cartflows")})),"yes"===r.is_rule&&c&&(0,e.createElement)("div",{className:"mt-8"},(0,e.createElement)(Fc.ReactSortable,{id:"wcf-order-bump-sortable-wrapper",className:"wcf-order-bump--sortable-wrapper flex flex-col gap-4",list:c,setList:e=>n({type:"SET_OB_RULES_GROUPS",groups:e,fieldName:"rules"}),swapThreshold:.8,direction:"vertical",animation:150,handle:".wcf-order-bumps-rules-page--group_wrapper",filter:".wcf-order-bumps-rules--rule_fields, .wcf-order-bumps-rules--rule_actions, .wcf-field wcf-select-option, .wcf-order-bumps-rules--add-rule__repeater .wcf-button.wcf-button--secondary, .wcf-field__data--content, .wcf-order-bumps-rules-page--group_wrapper__footer, .wcf-checkout-rules--group_header__right",preventOnFilter:!1,onStart:function(){document.getElementsByClassName("wcf-order-bumps-rules--or_group__button")[0].setAttribute("style","display:none")},onEnd:function(){document.getElementsByClassName("wcf-order-bumps-rules--or_group__button")[0].setAttribute("style","display:inline-block")}},c.map((t,a)=>{const r=t.group_id,n=t.rules;return(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--group_wrapper",key:r},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group border border-gray-200 rounded-lg mb-6","data-group-id":r},(0,e.createElement)("input",{type:"hidden",name:`rules[${a}][group_id]`,value:r}),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group-header bg-white p-4 rounded-lg flex items-center justify-between"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_header__left flex gap-2 items-center"},(0,e.createElement)("div",{className:"wcf-order-bumps-rule--sortable-toggle flex cursor-move text-gray-500"},(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-2","aria-hidden":"true"}),(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-4","aria-hidden":"true"})),(0,e.createElement)("span",{className:"wcf-group-header--text font-sm font-normal text-gray-400"},(0,z.__)("Show this order bump if following conditions are true","cartflows"))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_header__right flex gap-2 items-center"},o===r&&l?(0,e.createElement)(_w,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:m,"data-group_id":r}):(0,e.createElement)(Ew,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:m,"data-group_id":r}))),(0,e.createElement)("div",{id:`wcf-order-bumps-rules--group-${r}`,className:"pt-7 px-7 pb-4 border-t border-gray-200 "+(o===r&&l?"visible":"hidden")},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--group_rules--wrapper flex flex-col gap-4"},0!==n.length&&(0,e.createElement)(WA,{rules:n,group_id:r,g_index:a,groups_length:c.length})),(0,e.createElement)("div",{className:"wcf-order-bumps-rules--add-rule__repeater flex"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--add-rule__button text-sm font-medium flex gap-1.5 items-center cursor-pointer text-primary-500 hover:text-primary-600 focus:text-primary-600 mt-5","data-group_id":r,onClick:d},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Condition","cartflows"))))),(0,e.createElement)("div",{className:"wcf-order-bumps-rules-page--group_wrapper__footer"},(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or_group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf-order-bumps-rules--or_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("OR","cartflows")))),parseInt(a)+1===c.length&&(0,e.createElement)("div",{className:"wcf-order-bumps-rules--or_group__button mt-4"},(0,e.createElement)("span",{className:"wcf-order-bumps-rules--or_group_button or-button wcf-button wcf-secondary-button",onClick:u},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Conditions Group","cartflows")))))}))))},ZA=function(){const[{current_ob:a}]=Bc(),[r,n]=(0,t.useState)(!1),i=()=>{n(!0)},s=()=>{n(!1)},o=a,l=e=>{let t=o?.product;return e&&t&&(Array.isArray(t)&&(t=o?.product[0]),e=(e=(e=(e=e.replace("{{product_name}}",t?.product_name)).replace("{{product_price}}",t?.display_price?t?.display_price:t?.original_price)).replace("{{product_desc}}",t?.product_desc)).replace("{{quantity}}",o?.quantity)),e},c=()=>(()=>{let e=o?.product;return Array.isArray(e)&&(e=o?.product[0]),"variable"===e?.type||!0===e?.is_variable})()?(0,e.createElement)("div",{className:"wcf-order-bump-choose-variation-preview"},(0,z.__)("Choose a variation","cartflows")):null,u=o?.position,d=xn(l(o?.checkbox_label)||""),m=xn(l(o?.hl_text)||""),g=xn(l(o?.desc_text)||""),p=o?.show_arrow,f=o?.style,h=xn(l(o?.title_text)||""),M=o?.action_element,y=o?.show_animation,N=o?.enable_show_image,w=o?.display_quantity_field,x="yes"===y?"wcf-blink":"",b=(0,e.createElement)("svg",{version:"1.1",className:`wcf-pointing-arrow ${x}`,id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"20px",height:"15px",fill:"red",viewBox:"310 253 90 70",enableBackground:"new 310 253 90 70"},(0,e.createElement)("g",null,(0,e.createElement)("g",null,(0,e.createElement)("path",{d:"M364.348,253.174c-0.623,0.26-1.029,0.867-1.029,1.54v18.257h-51.653c-0.919,0-1.666,0.747-1.666,1.666v26.658c0,0.92,0.747,1.666,1.666,1.666h51.653v18.327c0,0.673,0.406,1.28,1.026,1.54c0.623,0.257,1.34,0.116,1.816-0.36l33.349-33.238 c0.313-0.313,0.49-0.737,0.49-1.18c0-0.443-0.177-0.866-0.487-1.179l-33.349-33.335 C365.688,253.058,364.971,252.915,364.348,253.174z"})))),D=o?.bg_color,v=o?.border_style,j=o?.border_color,_=o?.box_border_width,I=o?.box_border_radius,E=o?.box_shadow_color,L=""!==o?.box_shadow_horizontal?o?.box_shadow_horizontal:0,T=""!==o?.box_shadow_vertical?o?.box_shadow_vertical:0,A=""!==o?.box_shadow_blur?o?.box_shadow_blur:0,k=""!==o?.box_shadow_spread?o?.box_shadow_spread:0,S=o?.label_color?o?.label_color:"#7a7a7a",O=o?.label_bg_color,C=o?.desc_text_color,Y=o?.hl_text_color,U=o?.button_text_color,Q=o?.button_text_hover_color,P=o?.button_color,F=o?.button_border_width,R=o?.button_border_style,H=o?.button_border_color,B=o?.button_border_radius,W=o?.button_hover_color,V=o?.title_text_color,Z=o?.label_border_style,G=o?.label_border_width,X=o?.label_border_radius,J=o?.label_border_color,$={background:D,borderStyle:v,borderColor:j,borderRadius:""!==I?I+"px":"4px",borderWidth:""!==_?_+"px":"1px",boxShadow:L+"px "+T+"px "+A+"px "+k+"px "+E};let q={},K={},ee={};"style-1"===f?(q={borderColor:j,borderBottomStyle:"inherit"!==v?v:"solid",background:O,borderWidth:_+"px"},$.borderStyle="inherit"!==v?v:"solid"):"style-2"===f?(q={borderColor:j,borderTopStyle:"inherit"!==v?v:"solid",background:O,borderWidth:_+"px"},$.borderStyle="inherit"!==v?v:"solid"):"style-3"===f?$.borderStyle="inherit"!==v?v:"solid":"style-4"===f?($.borderStyle="inherit"!==v?v:"solid",ee={color:r?Q:U,background:r?W:P,borderWidth:""!==F?F+"px":"1px",borderStyle:"inherit"!==R?R:"none",borderColor:H,borderRadius:""!==B?B+"px":"3px"}):"style-5"===f&&($.borderStyle="inherit"!==v?v:"",K={borderStyle:"inherit"!==Z?Z:"",borderWidth:G+"px",borderRadius:X+"px",borderColor:J,background:O,padding:O?"5px 10px":"5px 0"},ee={color:r?Q:U,background:r?W:P,borderWidth:""!==F?F+"px":"1px",borderStyle:"inherit"!==R?R:"solid",borderColor:H,borderRadius:""!==B?B+"px":"3px"});let te="",ae="left",re="auto";"yes"===N&&(te=o?.product_image,ae=o?.ob_image_position,re=""!==o?.ob_image_width?o?.ob_image_width+"px":"auto"),(0,t.useEffect)(()=>{const e=document.getElementById("wcf-order-bump-preview-wrapper"),t=e.offsetTop-25,a=window.addEventListener("scroll",()=>{window.pageYOffset>t?e.classList.add("sticky"):e.classList.remove("sticky")});return()=>{window.removeEventListener("scroll",a)}},[]);const ne=function(){let t="";return"yes"===w&&(t=(0,e.createElement)("div",{className:"wcf-ob-qty-selection-wrap"},(0,e.createElement)("span",{className:"wcf-ob-qty-selection-btn wcf-ob-qty-decrement wcf-ob-qty-change-icon"},"-"),(0,e.createElement)("input",{type:"number",className:"wcf-order-bump-quantity-updater",name:"wcf_order_bump_quantity",placeholder:"1",defaultValue:o?.quantity,min:"1"}),(0,e.createElement)("span",{className:"wcf-ob-qty-selection-btn wcf-ob-qty-increment wcf-ob-qty-change-icon"},"+"))),t};return(0,e.createElement)("div",{id:"wcf-order-bump-preview-wrapper",className:"wcf-order-bump-preview-wrapper"},(0,e.createElement)("div",{className:`wcf-bump-order-wrap wcf-bump-order-${f} wcf-${u}`,style:$},function(){let t="";return"style-1"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap",style:q},"right"!==ae&&(0,e.createElement)("label",{style:{color:S}},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("span",{className:"wcf-bump-order-label"},d)),"right"===ae&&(0,e.createElement)("label",{style:{color:S}},(0,e.createElement)("span",{className:"wcf-bump-order-label"},d),(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b)),(0,e.createElement)("div",{className:"wcf-content-container"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight",style:{color:Y}},m)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})))):"style-2"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-offer"},(0,e.createElement)("span",{className:"wcf-bump-order-bump-highlight",style:{color:Y}},m)),(0,e.createElement)("div",{className:"wcf-content-container"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"===re?"":re}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-right"},(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-offer-content-left",style:{width:"auto"===re?"":re}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")}))),(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap",style:q},"right"!==ae&&(0,e.createElement)("label",{style:{color:S}},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("span",{className:"wcf-bump-order-label"},d)),"right"===ae&&(0,e.createElement)("label",{style:{color:S}},(0,e.createElement)("span",{className:"wcf-bump-order-label"},d),(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b))):"style-3"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},""!==te&&"top"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-action"},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-image",style:{maxWidth:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},""===te&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),""!==te&&"top"===ae&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""})),(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne())),"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h),""===te&&(0,e.createElement)(e.Fragment,null,"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}))),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-image",style:{maxWidth:"auto"!==re?re:""}},(0,e.createElement)("img",{src:te,className:"wcf-image",alt:(0,z.__)("Order Bump Product Image","cartflows")})),""!==te&&(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),"yes"===p&&b))):"style-4"===f?t=(0,e.createElement)("div",{className:`wcf-bump-order-content wcf-bump-order-image-${ae} `},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:"auto"===re?"100px":re},alt:(0,z.__)("Order Bump Product Image","cartflows")})),"right"!==ae&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-info"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne())),(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows")))),"right"===ae&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-bump-order-action"},(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows"))),(0,e.createElement)("div",{className:"wcf-bump-order-text"},(0,e.createElement)("div",{className:"wcf-bump-order-info"},(0,e.createElement)("div",{className:"wcf-bump-order-label"},(0,e.createElement)("label",{style:{color:V}},h)),(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne()))),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:"auto"===re?"100px":re},alt:(0,z.__)("Order Bump Product Image","cartflows")})))):"style-5"===f&&(t=(0,e.createElement)("div",{className:"wcf-bump-order-content"},(0,e.createElement)("div",{className:"wcf-bump-order-field-wrap"},(0,e.createElement)("div",{className:`wcf-bump-order-info wcf-bump-order-image-${ae} `},""!==te&&"right"!==ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:re},alt:(0,z.__)("Order Bump Product Image","cartflows")})),(0,e.createElement)("div",{className:"wcf-bump-order-text"},""!==h&&(0,e.createElement)("div",{className:"wcf-bump-order-label",style:{color:V}},(0,e.createElement)("span",null,h)),""!==g&&(0,e.createElement)("div",{className:"wcf-bump-order-desc",style:{color:C}},g),c(),ne(),"checkbox"===M&&(0,e.createElement)("div",{className:"wcf-bump-order-action",style:K},"yes"===p&&b,(0,e.createElement)("input",{type:"checkbox",id:"wcf-bump-order-cb",className:"wcf-bump-order-cb",name:"wcf-bump-order-cb",value:""}),(0,e.createElement)("label",{style:{color:S}},d)),"button"===M&&(0,e.createElement)("div",{className:"wcf-bump-order-action wcf-ob-action-button"},(0,e.createElement)("a",{className:"wcf-bump-order-cb-button wcf-bump-add-to-cart",style:ee,onMouseEnter:i,onMouseLeave:s},(0,z.__)("Add","cartflows")))),""!==te&&"right"===ae&&(0,e.createElement)("div",{className:"wcf-bump-order-image"},(0,e.createElement)("img",{src:te,className:"wcf-image",style:{width:re},alt:(0,z.__)("Order Bump Product Image","cartflows")})))))),t}()))};function GA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"}))}const XA=t.forwardRef(GA);function JA({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const $A=t.forwardRef(JA),qA=()=>{const[{flow_id:e,step_id:a,current_ob:r},n]=Bc(),[,i]=m();return{saveOrderBump:(0,t.useCallback)(()=>{i({status:"PROCESSING"});const t=document.querySelector(".wcf-slide-out-panel--form");if(!t)return i({status:"RESET"}),Promise.resolve(!1);if(null===r)return i({status:"SAVED"}),Promise.resolve(!0);if("undefined"!=typeof tinymce){const e=tinymce.get("wcf-order-bump-desc-editor");e&&e.save()}const s=new window.FormData(t),o=r.id;return s.append("action","cartflows_pro_save_order_bump_settings"),s.append("security",cartflows_admin.save_order_bump_settings_nonce),s.append("post_id",e),s.append("step_id",a),s.append("ob_id",o),A()({url:cartflows_admin.ajax_url,method:"POST",body:s}).then(e=>{if(e.data&&e.data.success){const e=new window.FormData;return e.append("action","cartflows_pro_get_current_order_bump"),e.append("security",cartflows_admin.get_current_order_bump_nonce),e.append("ob_id",o),e.append("step_id",a),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(e=>(e.data&&e.data.success&&e.data.current_ob&&n({type:"SET_CURRENT_OB",current_ob:e.data.current_ob,ob_id:o}),i({status:"SAVED"}),window.wcfUnsavedChanges=!1,!0))}return i({status:"RESET"}),!1}).catch(e=>(console.error(e),i({status:"RESET"}),!1))},[e,a,r,n,i])}},KA=function(a){const[{step_id:r,options:n,current_ob:i},s]=Bc(),[o,l]=(0,t.useState)("product"),c=new URLSearchParams((0,p.useLocation)().search),u=a.ob_id,d=c.get("obtab"),m=PN(),{saveOrderBump:g}=qA();!function(){const[{current_ob:e},a]=Bc(),r=function(t){const{name:r,value:n}=t.detail;if(r.includes("[")){const t=r.split("["),i=[];for(let e=1;e<t.length;e++)i.push(t[e].split("]")[0]);const s=r.substr(0,r.indexOf("[")),o=e[s];switch(i.length){case 2:o[i[0]][i[1]]=n;break;case 4:o[i[0]][i[1]][i[2]][i[3]]=n}a({type:"SET_OB_OPTION",name:s,value:o})}void 0!==e&&(window.wcfUnsavedChanges=!0,a({type:"SET_OB_OPTION",name:r,value:n}))},n=[{type:"select"},{type:"select2"},{type:"checkbox"},{type:"text"},{type:"textarea"},{type:"code"},{type:"number"},{type:"radio"},{type:"color"},{type:"font"},{type:"product"},{type:"coupon"},{type:"image-selector"},{type:"wpeditor"},{type:"toggle"},{type:"selectioncard"}];(0,t.useEffect)(()=>(e&&n.map(function(e){return document.addEventListener(`wcf:${e.type}:change`,r),""}),()=>{n.map(function(e){return document.removeEventListener(`wcf:${e.type}:change`,r),""})}),[e])}();const f=[{name:(0,z.__)("Product","cartflows"),slug:"product",icon:(0,e.createElement)(NL,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Content","cartflows"),slug:"content",icon:(0,e.createElement)(XA,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Styles","cartflows"),slug:"styles",icon:(0,e.createElement)(xA,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Conditions","cartflows"),slug:"conditions",icon:(0,e.createElement)($A,{className:"w-18 h-18 stroke-2"})}];if((0,t.useEffect)(()=>((async()=>{!function(){const e=new window.FormData;e.append("action","cartflows_pro_get_current_order_bump"),e.append("security",cartflows_admin.get_current_order_bump_nonce),e.append("ob_id",u),e.append("step_id",r),A()({url:cartflows_admin.ajax_url,method:"POST",body:e}).then(e=>{e.data.success&&s({type:"SET_CURRENT_OB",current_ob:e.data.current_ob,ob_id:u})})}(),null!==n&&"undefined"!==n||A()({path:`/cartflows/v1/admin/step-data/${r}`}).then(e=>{if(e.billing_fields){const t=Object.entries(e.billing_fields.fields).map(([e,t])=>({...t,key:e}));e.billing_fields=t}if(e.shipping_fields){const t=Object.entries(e.shipping_fields.fields).map(([e,t])=>({...t,key:e}));e.shipping_fields=t}s({type:"SET_STEP_DATA",data:e})})})(),()=>{}),[]),null===i||"undefined"===i){let t="";switch(d){case"design":case"content":t=(0,e.createElement)(CA,null);break;case"product":default:t=(0,e.createElement)(OA,null);break;case"settings":t=(0,e.createElement)(YA,null);break;case"conditions":t=(0,e.createElement)(UA,null)}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-page-wrapper wcf-order-bump-page-wrapper"},t))}if(i&&u!==i.id)return"";return(0,e.createElement)("div",{className:"wcf-order-bump-page-wrapper p-6 bg-gray-50 rounded-b-lg"},(0,e.createElement)("div",{className:"wcf-order-bump-content-tab__preview bg-gray-100"},(0,e.createElement)(ZA,null)),(0,e.createElement)("div",{className:"wcf-order-bump--tabs-wrapper border border-gray-200 isolate inline-flex rounded-md shadow-sm w-full mt-8 mb-8 gap-0.5"},f.map(t=>{const a=t.slug===o?"z-10 text-primary-600 bg-primary-25 outline-none ring-1 ring-primary-300 rounded-lg shadow shadow-primary-lg":"";return(0,e.createElement)("button",{type:"button",className:Dn()("wcf-order-bump--tab flex justify-center gap-2 relative text-center w-1/3 items-center px-4 py-2 text-sm font-medium text-gray-400 hover:bg-primary-25 hover:ring-1 hover:ring-primary-300 hover:rounded-lg hover:text-primary-600",a),onClick:()=>{!async function(e){e!==o?(await async function(){return!!window.wcfUnsavedChanges&&await m({title:(0,z.__)("Save Changes","cartflows"),description:(0,z.__)("You have made changes. Do you want to save the changes?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows"),onConfirm:g})}()||l(e),window.wcfUnsavedChanges=!1):l(e)}(t.slug)},key:t.slug},t.icon?t.icon:"",(0,e.createElement)("span",{className:"text-center"},t.name))})),function(){let t=(0,e.createElement)("h1",null,"404 Not Found");switch(o){case"styles":t=(0,e.createElement)(PA,null);break;case"product":default:t=(0,e.createElement)(HA,null);break;case"content":t=(0,e.createElement)(BA,null);break;case"conditions":t=(0,e.createElement)(VA,null)}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",null,t))}())},ez=function(a){const{flow_id:r,step_id:n,data:i,callback:s}=a,[{},o]=Bc(),[l,c]=(0,t.useState)(i.status),[u,d]=(0,t.useState)(!1),[m,g]=(0,t.useState)(""),[p,f]=(0,t.useState)(!1),[h,M]=(0,t.useState)(!1),y=(0,t.createRef)(),[N,w]=(0,t.useState)(""),x=PN();(0,t.useEffect)(()=>{c(l)},[l,N]);let b=i.title;const D=function(e){e.preventDefault(),f(!0)},v=function(e){e.preventDefault(),f(!1)},j=function(e){e.preventDefault(),M(!0);const t=e.target.getAttribute("data-ob_id"),a=y.current.value,r=new window.FormData;r.append("action","cartflows_pro_update_order_bump_title"),r.append("security",cartflows_admin.update_order_bump_title_nonce),r.append("step_id",n),r.append("new_title",a),r.append("ob_id",t),A()({url:cartflows_admin.ajax_url,method:"POST",body:r}).then(()=>{o({type:"SET_OB_TITLE",title:a,name:"wcf-order-bumps",ob_id:t}),M(!1),f(!1)})},_=function(e){event.preventDefault();const t=e.target.getAttribute("data-ob_id");w(!N&&t?t:"")};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump border-b border-gray-200 last:border-0",onDragEnd:s},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper flex items-center relative p-6 text-sm gap-2"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product w-3/4"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title flex items-center gap-2"},(0,e.createElement)("span",{className:"text-sm font-medium text-gray-800 flex gap-2 justify-center items-center"},function(){""===b&&(b=(0,z.__)("(no title)","cartflows"));let t=Mn(b,cartflows_admin.title_length.max,cartflows_admin.title_length.display_length),a=(0,e.createElement)("a",{href:"#",className:"wcf-ob-header__title--edit flex p-1 cursor-pointer text-gray-500 hover:text-primary-500 hover:bg-gray-100 focus:bg-gray-100 relative wcf-inline-tooltip","data-tooltip":(0,z.__)("Edit Step Name","cartflows"),onClick:D},(0,e.createElement)(ON,{className:"w-4 h-4 stroke-1"}));return p&&(t=(0,e.createElement)(xp,{attr:{ref:y},id:"new-step-title",value:b,autocomplete:"off",class:"new-step-title text-sm font-medium text-gray-800 !border-gray-200 !outline-none !shadow-none !px-3 !py-1"}),a=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"wcf-button--small wcf-button wcf-primary-button "+(h?"wcf-disabled":""),href:"#",onClick:j,"data-ob_id":i.id},h&&(0,e.createElement)(MN,null),(0,z.__)("Save","cartflows")),(0,e.createElement)("button",{className:"wcf-button--small wcf-button wcf-secondary-button",href:"#",onClick:v},(0,z.__)("Cancel","cartflows")))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"wcf-ob-header__title--text"},t),(0,e.createElement)("span",{className:"wcf-ob-header__title--buttons flex gap-2"},a))}()),""===i.product&&(0,e.createElement)("span",{className:"wcf-badge wcf-badge--warning text-xs border-0"},(0,e.createElement)(FE,{className:"w-4 h-4 stroke-2"}),(0,z.__)("No product","cartflows")))),(0,e.createElement)("div",{className:"wcf_order_bump__status w-[12%] flex gap-2"},(0,e.createElement)("button",{type:"button",className:Dn()("bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-2",l?"bg-primary-600":"bg-gray-200"),role:"switch",onClick:function(e){d(!0);const t=e.target.getAttribute("data-ob_id"),a=new window.FormData;a.append("action","cartflows_pro_update_order_bump_status"),a.append("security",cartflows_admin.update_order_bump_status_nonce),a.append("ob_id",t),a.append("post_id",r),a.append("step_id",n),a.append("ob_status",!l),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(()=>{o({type:"SET_OB_STATUS",name:"wcf-order-bumps",newStatus:!l,ob_id:t}),c(!l),d(!1)})},"data-wcf-order-bump-switch":l,"data-ob_id":i.id},(0,e.createElement)("span",{"aria-hidden":"true",className:Dn()(l?"translate-x-5":"translate-x-0","translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")})),u&&(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-2 text-primary-500 animate-spin"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions flex justify-between w-[12%]"},(0,e.createElement)("span",{className:"wcf-clone-bump-button cursor-pointer text-gray-500 hover:text-primary-500 p-1 hover:bg-gray-100 focus:bg-gray-100 rounded relative wcf-inline-tooltip",id:i.id,onClick:e=>{e.preventDefault();const t=new window.FormData,a=e.target.closest(".wcf-clone-bump-button").getAttribute("id");g("clone"),t.append("action","cartflows_pro_clone_order_bump"),t.append("security",cartflows_admin.clone_order_bump_nonce),t.append("ob_id",a),t.append("step_id",n),A()({url:cartflows_admin.ajax_url,method:"POST",body:t}).then(e=>{e.success&&(o({type:"UPDATE_ORDER_BUMP",name:"wcf-order-bumps",order_bumps:e.data.order_bumps}),g(""))})},"data-tooltip":(0,z.__)("Duplicate Order Bump","cartflows")},"clone"===m?(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-1 animate-spin"}):(0,e.createElement)(WE,{className:"w-18 h-18 stroke-1"})),(0,e.createElement)("a",{className:"wcf-setting-bump-button cursor-pointer text-gray-500 p-1 hover:bg-primary-50 hover:text-primary-500 focus:bg-primary-50 rounded relative wcf-inline-tooltip "+(N===i.id?"bg-primary-50 text-primary-500":""),"data-ob_id":i.id,"data-tooltip":(0,z.__)("Edit Order Bump","cartflows"),onClick:_},(0,e.createElement)($A,{className:"w-18 h-18 stroke-1","data-ob_id":i.id,onClick:_})),(0,e.createElement)("span",{className:"wcf-remove-order-bump-button cursor-pointer text-gray-500 hover:text-primary-500 p-1 hover:bg-gray-100 focus:bg-gray-100 rounded relative wcf-inline-tooltip after:-left-16",id:i.id,onClick:async function(e){if(e.preventDefault(),!await x({title:(0,z.__)("Trash Order Bump","cartflows"),description:(0,z.__)("Do you really want to trash this order bump permanently?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")}))return;const t=e.target.closest(".wcf-remove-order-bump-button").getAttribute("id");g("delete");const a=new window.FormData;a.append("action","cartflows_pro_delete_order_bump"),a.append("security",cartflows_admin.delete_order_bump_nonce),a.append("ob_id",t),a.append("post_id",r),a.append("step_id",n),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(e=>{e.success&&(o({type:"REMOVE_ORDER_BUMP",name:"wcf-order-bumps",ob_id:t}),g(""))})},"data-tooltip":(0,z.__)("Delete Order Bump","cartflows")},"delete"===m?(0,e.createElement)(Cn,{className:"w-18 h-18 stroke-2 animate-spin"}):(0,e.createElement)(au,{className:"w-18 h-18 stroke-1"}))))),N&&(0,e.createElement)(KA,{ob_id:N}))},tz=function(){return(0,e.createElement)("div",{className:"wcf-multiple-order-bumps is-placeholder"},(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__add-new"},(0,e.createElement)("span",{className:"wcf-add-new-order-bump wcf-button--primary"})),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__header"},(0,e.createElement)("div",{className:"wcf-column wcf-column--title"},"Title"),(0,e.createElement)("div",{className:"wcf-column wcf-column--status"},"Status"),(0,e.createElement)("div",{className:"wcf-column wcf-column--actions"},"Actions")),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__content"},(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump"},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title"},(0,e.createElement)("span",{title:"ob"}))),(0,e.createElement)("div",{className:"wcf_order_bump__status"},(0,e.createElement)("span",{className:"wcf-ob-status"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions"},(0,e.createElement)("span",{title:"Edit Order Bump"}))))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-order-bump"},(0,e.createElement)("div",{className:"wcf-order-bump__content-wrapper"},(0,e.createElement)("div",{className:"wcf-order-bump__data wcf-column--product"},(0,e.createElement)("div",{className:"wcf-order-bump__data-title"},(0,e.createElement)("span",{title:"ob"}))),(0,e.createElement)("div",{className:"wcf_order_bump__status"},(0,e.createElement)("span",{className:"wcf-ob-status"})),(0,e.createElement)("div",{className:"wcf-order-bump__action wcf-column--actions"},(0,e.createElement)("span",{title:"Edit Order Bump"})))))))},az=function(){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-multiple-order-bumps wcf-multiple-order-bumps-cta"},(0,e.createElement)("span",{className:"wcf-accordion-button relative flex justify-between items-center w-full py-4 px-0 text-base font-semibold text-gray-800 text-left transition focus:outline-none"},(0,e.createElement)("span",{className:"flex gap-2 items-center"},(0,e.createElement)("span",null,(0,z.__)("Order Bumps","cartflows")),(0,e.createElement)("span",{className:"wcf-pro-badge px-2 py-0.5 text-xs text-primary-600 ml-auto rounded-[14px] shadow-[0px_6px_16px_-2px_rgba(240,100,52,0.4)]"},(0,e.createElement)("span",null,(0,z.__)("PRO","cartflows"))))),(0,e.createElement)(KN,{heading:(0,z.__)("Increase Your Revenue with Smart Order Bumps","cartflows"),subHeading:(0,z.__)("Boost sales with CartFlows’ Order Bump! Offer personalized add-ons at checkout to increase revenue effortlessly. Quick to set up, no coding needed!","cartflows")})))},rz=function(){const[{options:a,step_id:r,flow_id:n,page_settings:i},s]=Bc(),[{license_status:o}]=m(),[l,c]=(0,t.useState)(),[u,d]=(0,t.useState)(""),g=(0,z.__)("Add","cartflows"),[p,f]=(0,t.useState)({button_text:g,is_processing:!1}),{button_text:h,is_processing:M}=p;if(!wcfCartflowsTypePlusPro()||"Activated"!==o)return(0,e.createElement)(az,null);if(null===a||"undefined"===i)return(0,e.createElement)(tz,null);const y=i,N=a["wcf-order-bumps"],w=Object.keys(N).length,x=i?.settings["multiple-order-bump-design"],b=()=>{const e=a["wcf-order-bumps"],t=[];Object.keys(e).map(a=>(t.push(e[a].id),""));const n=new window.FormData;n.append("action","cartflows_pro_reorder_order_bumps"),n.append("security",cartflows_admin.reorder_order_bumps_nonce),n.append("step_id",r),n.append("sorted_obs",t),A()({url:cartflows_admin.ajax_url,method:"POST",body:n}).then(()=>{})};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",{className:"text-base font-semibold text-gray-800 py-4"},(0,z.__)("Order Bumps","cartflows")),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps--wrapper py-2"},w>0&&(0,e.createElement)("div",{className:"wcf-multiple-order-bumps -mx-4 mt-4 ring-1 ring-gray-200 sm:mx-0 sm:rounded-lg"},(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__header flex items-center border-b border-gray-200 px-6 py-4 text-left text-sm font-medium text-gray-800"},(0,e.createElement)("span",{className:"wcf-column wcf-column--title w-3/4"},(0,z.__)("Title","cartflows")),(0,e.createElement)("span",{className:"wcf-column wcf-column--status w-[13%]"},(0,z.__)("Status","cartflows")),(0,e.createElement)("span",{className:"wcf-column wcf-column--actions w-[12%]"},(0,e.createElement)("span",{className:"sr-only"},(0,z.__)("Actions","cartflows")))),(0,e.createElement)("div",{className:"wcf-multiple-order-bumps__content"},N&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Fc.ReactSortable,{list:N,setList:e=>s({type:"SET_OB",obs:e,fieldName:"wcf-order-bumps",step_id:r,flow_id:n}),swapThreshold:.8,direction:"vertical",animation:150,handle:".wcf-order-bump",filter:".wcf-order-bump__action, .wcf_order_bump__status, .wcf-order-bump__data-title a",preventOnFilter:!1},N.map(t=>(0,e.createElement)(ez,{key:t.id,flow_id:n,step_id:r,data:t,title:t.title,settings:y.settings["multiple-order-bump"],design_settings:x,callback:b})))))),0===w&&(0,e.createElement)("div",{className:"border border-gray-200 bg-gray-25 rounded-md px-5 py-7 text-sm text-gray-600 text-center"},(0,z.__)("Create an order bump.","cartflows")),(0,e.createElement)("div",{className:"flex wcf-multiple-order-bumps__add-new mt-5 gap-3"},(0,e.createElement)(En,{name:"",value:l,sectionClass:"block text-left w-full",wrapperClass:"block",class:"!w-full !h-auto input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0 !placeholder-gray-400",placeholder:(0,z.__)("Enter order bump name","cartflows"),onChangeCB:c,desc:u,descClass:"absolute text-sm font-normal text-primary-500 mt-2"}),(0,e.createElement)("a",{className:"wcf-add-new-order-bump wcf-button "+(M?"wcf-disabled":"wcf-secondary-button"),onClick:function(e){if(e.preventDefault(),void 0!==l){d(""),f({button_text:(0,z.__)("Adding…","cartflows"),is_processing:!0});const t={title:l,id:Math.random().toString(36).substring(2,5)},a=new window.FormData;a.append("action","cartflows_pro_add_order_bump"),a.append("security",cartflows_admin.add_order_bump_nonce),a.append("ob_id",t.id),a.append("post_id",n),a.append("step_id",r),a.append("title",l),A()({url:cartflows_admin.ajax_url,method:"POST",body:a}).then(t=>{t.success&&(s({type:"UPDATE_ORDER_BUMP",name:"wcf-order-bumps",order_bumps:t.data.order_bumps}),c(""),f({button_text:g,is_processing:!1})),e.target.blur()})}else d((0,z.__)("Please enter the order bump title","cartflows")),e.target.blur()}},M?(0,e.createElement)(MN,null):(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,e.createElement)("span",null,h)))),(0,e.createElement)(Ny,{content:(0,z.sprintf)(
49 49 // translators: %1$s: link html start, %2$s: link html end
50 50 // translators: %1$s: link html start, %2$s: link html end
51 51 (0,z.__)("For more information about order bump settings please %1$sClick here.%2$s","cartflows"),'<a href="https://cartflows.com/docs/how-to-add-order-bumps-to-woocommerce-sales-funnel" class="text-gray-600 hover:text-[#F06434]" target="_blank">',"</a>")}))},nz=function(){return(0,e.createElement)("div",{className:"wcf-checkout-offer-settings wcf-checkout__section is-placeholder"},(0,e.createElement)("div",{className:"wcf-list-options"},(0,e.createElement)("div",{className:"wcf-list-options__title"},(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("table",null,(0,e.createElement)("tbody",null,(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"checkbox-title"})),(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"title"})),(0,e.createElement)("tr",null,(0,e.createElement)("div",{className:"title"})))),(0,e.createElement)("div",{className:"wcf-order-bump-save-settings"},(0,e.createElement)("div",{className:"wcf-field wcf-submit"},(0,e.createElement)("div",{className:"wcf-checkout-offer__button"})))))},iz=function(t){const[{page_settings:a,options:r}]=Bc(),n=e=>{let t="";const a=e.name;if(a&&a.includes("[")){const n=a.split("["),i=[];for(let e=1;e<n.length;e++)i.push(n[e].split("]")[0]);const s=a.substr(0,a.indexOf("[")),o=r[s];if("wcf-pre-checkout-offer-product[original_price]"===a||"wcf-pre-checkout-offer-product[sell_price]"===a){const t=r["wcf-pre-checkout-offer-product"];if(""===t||null==t||t.length<=0)return(0,z.__)("No product Selected","cartflows");const n=Array.isArray(t)?parseFloat(t[0].original_price):parseFloat(t.original_price);if("wcf-pre-checkout-offer-product[original_price]"===a)return n;if("wcf-pre-checkout-offer-product[sell_price]"===a&&n){const t=r["wcf-pre-checkout-offer-discount"],a=parseFloat(r["wcf-pre-checkout-offer-discount-value"]);let i=n;return"discount_percent"===t?a>0&&(i=(n-n*a/100).toFixed(2)):"discount_price"===t&&a>0&&(i=(n-a).toFixed(2)),e.class=i<0?"error_field":"",i}}t=o[i[0]]}else t=r[e.name]?r[e.name]:"";return t};let i=[];switch(t.tab){case"product":default:i=a?.settings["checkout-offer-product"];break;case"content":i=a?.settings["checkout-offer-content"];break;case"styles":i=a?.settings["checkout-offer-styles"]}const s=function(a){return Object.keys(a.section_fields).map(i=>{const s=a.section_fields[i],o=n(s),l=yn.isActiveControl(s,r);return(0,e.createElement)(Sy,{key:i,data:s,value:o,isActive:l,field:i,tabName:t.tab?t.tab:"",displayAs:t.displayAs?t.displayAs:""})})};return(0,e.createElement)("div",{className:"wcf-list-options wcf-co-list-options"},(0,e.createElement)("div",{className:"wcf-co-options-wrapper",id:"wcf-co-options-wrapper"},i&&Object.keys(i.fields).map(a=>{const o=i.fields[a];return o.section_fields?(0,e.createElement)("div",{key:a,className:`wcf-${t.tab?t.tab:"setting"}-tab--${o.id}-section p-5 border border-gray-200 rounded-md mb-5`},(0,e.createElement)("div",{className:`wcf-${t.tab?t.tab:"setting"}-tab--heading-section col-span-full`},(0,e.createElement)(wy,{label:o.title,labelClass:"block text-base font-semibold text-gray-800 mb-5"})),t.displayAs&&"tr"===t.displayAs?(0,e.createElement)("table",{className:"w-full"},(0,e.createElement)("tbody",null,s(o))):(0,e.createElement)("div",{className:"wcf-co-list-options-container"},s(o))):(0,e.createElement)("div",{key:a,className:`wcf-${t.tab?t.tab:"setting"}-tab--section mb-5`},t.displayAs&&"tr"===t.displayAs?(0,e.createElement)("table",{className:"wcf-full"},(0,e.createElement)("tbody",null,(0,e.createElement)(Sy,{key:a,data:o,value:n(o),isActive:yn.isActiveControl(o,r),field:o,tabName:t.tab?t.tab:"",displayAs:t.displayAs?t.displayAs:""}))):(0,e.createElement)("div",{className:"wcf-co-list-options-container"},(0,e.createElement)(Sy,{key:a,data:o,value:n(o),isActive:yn.isActiveControl(o,r),field:o,tabName:t.tab?t.tab:"",displayAs:t.displayAs?t.displayAs:""})))})))};function sz({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))}const oz=t.forwardRef(sz);function lz({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))}const cz=t.forwardRef(lz),uz=function(){const[{options:a}]=Bc(),[r,n]=(0,t.useState)("");(0,t.useEffect)(()=>{const e=document.getElementById("wcf-checkout-offer-preview-wrapper"),t=e.offsetTop-25,a=window.addEventListener("scroll",()=>{window.pageYOffset>t?e.classList.add("sticky"):e.classList.remove("sticky")});return()=>{window.removeEventListener("scroll",a)}},[]);let i=a["wcf-pre-checkout-offer-product"];null!==i&&Array.isArray(i)&&(i=i[0]);const s=a["wcf-pre-checkout-offer-discount"],o=parseFloat(a["wcf-pre-checkout-offer-discount-value"]);let l="";const c=i?parseFloat(i.original_price).toFixed(2):0;"discount_percent"===s?o>0&&(l=(c-c*o/100).toFixed(2)):"discount_price"===s&&o>0&&(l=(c-o).toFixed(2));const u=i&&i.product_image?i.product_image:cartflows_admin.image_placeholder;return(0,e.createElement)("div",{id:"wcf-checkout-offer-preview-wrapper",className:"fullscreen"===r?"wcf-checkout-offer-preview-wrapper fullscreen":"wcf-checkout-offer-preview-wrapper"},(0,e.createElement)("div",{className:"mt-8 bg-gray-50 p-6 -mx-6"},(0,e.createElement)("div",{className:"wcf-pre-checkout-offer--header flex justify-between items-center mb-5 p-2.5"},(0,e.createElement)(wy,{label:(0,z.__)("Preview","cartflows"),labelClass:"block text-base font-semibold text-gray-800"}),""===r&&(0,e.createElement)("div",{className:"wcf-co-preview-mode wcf-full-screen-preview-button p-2.5 text-gray-400 hover:text-gray-500 cursor-pointer",onClick:()=>n("fullscreen")},(0,e.createElement)(oz,{className:"w-5 h-5 stroke-2",title:(0,z.__)("View in Full Screen","cartflows")})),"fullscreen"===r&&(0,e.createElement)("div",{className:"wcf-co-preview-mode wcf-full-screen-preview-exit-button p-2.5 text-gray-400 hover:text-gray-500",onClick:()=>n("")},(0,e.createElement)(cz,{className:"w-5 h-5 stroke-2",title:(0,z.__)("Exit Full Screen","cartflows")}))),(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-wrapper wcf-pre-checkout-full-width"},(0,e.createElement)("div",{id:"wcf-pre-checkout-offer-modal",style:{backgroundColor:a["wcf-pre-checkout-offer-model-bg-color"]},className:"bg-white border border-gray-200 rounded-md"},(0,e.createElement)("div",{className:"wcf-content-main-wrapper"},(0,e.createElement)("div",{className:"wcf-lightbox-content p-6",style:{backgroundColor:a["wcf-pre-checkout-offer-model-bg-color"]}},(0,e.createElement)("div",{className:"wcf-content-modal-progress-bar mb-8"},(0,e.createElement)("div",{className:"wcf-progress-bar-nav",style:{color:a["wcf-pre-checkout-offer-desc-color"]}},(0,e.createElement)("div",{className:"wcf-pre-checkout-progress grid grid-cols-3 text-center text-sm font-normal text-gray-600 max-w-2xl mx-auto"},(0,e.createElement)("div",{className:"wcf-nav-bar-step active"},(0,e.createElement)("div",{className:"wcf-nav-bar-title mb-3",style:{color:a["wcf-pre-checkout-offer-desc-color"]}},(0,z.__)("Order Submitted","cartflows")),(0,e.createElement)("div",{className:"wcf-nav-bar-step-line relative"},(0,e.createElement)("div",{className:"wcf-progress-nav-step",style:{backgroundColor:a["wcf-pre-checkout-offer-navbar-color"]}},(0,e.createElement)("span",{className:"before"})),(0,e.createElement)("span",{className:"order-after",style:{backgroundColor:a["wcf-pre-checkout-offer-navbar-color"]}}))),(0,e.createElement)("div",{className:"wcf-nav-bar-step active inprogress"},(0,e.createElement)("div",{className:"wcf-nav-bar-title mb-3",style:{color:a["wcf-pre-checkout-offer-desc-color"]}},(0,z.__)("Special Offer","cartflows")),(0,e.createElement)("div",{className:"wcf-nav-bar-step-line relative"},(0,e.createElement)("span",{className:"before",style:{backgroundColor:a["wcf-pre-checkout-offer-navbar-color"]}}),(0,e.createElement)("div",{className:"wcf-progress-nav-step",style:{backgroundColor:a["wcf-pre-checkout-offer-navbar-color"]}},(0,e.createElement)("span",{className:"before"})),(0,e.createElement)("span",{className:"after"}))),(0,e.createElement)("div",{className:"wcf-nav-bar-step"},(0,e.createElement)("div",{className:"wcf-nav-bar-title mb-3"},(0,z.__)("Order Receipt","cartflows")),(0,e.createElement)("div",{className:"wcf-nav-bar-step-line relative"},(0,e.createElement)("span",{className:"before"}),(0,e.createElement)("div",{className:"wcf-progress-nav-step"})))))),(0,e.createElement)("div",{className:"wcf-content-main-head text-center mb-8"},(0,e.createElement)("div",{className:"wcf-content-modal-title"},(0,e.createElement)("h1",{style:{color:a["wcf-pre-checkout-offer-title-color"]},className:"text-xl font-semibold text-gray-800 mb-2.5"},a["wcf-pre-checkout-offer-popup-title"])),(0,e.createElement)("div",{className:"wcf-content-modal-sub-title"},(0,e.createElement)("span",{style:{color:a["wcf-pre-checkout-offer-subtitle-color"]},className:"text-sm font-normal text-600"},a["wcf-pre-checkout-offer-popup-sub-title"]))),(0,e.createElement)("div",{id:"wcf-pre-checkout-offer-content",className:"woocommerce border-2 border-gray-200 border-dashed rounded items-center",style:{backgroundColor:a["wcf-pre-checkout-offer-model-bg-color"]}},(0,e.createElement)("div",{className:"flex gap-4 p-5 items-center"},(0,e.createElement)("div",{className:"wcf-pre-checkout-info wcf-pre-checkout-img w-2/5"},(0,e.createElement)("img",{src:u,alt:"Checkout Offer Product",className:"border border-gray-200"})),(0,e.createElement)("div",{className:"wcf-pre-checkout-info wcf-pre-checkout-offer-product-details w-3/5"},(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-product-title"},(0,e.createElement)("h1",{style:{color:a["wcf-pre-checkout-offer-title-color"]}},a["wcf-pre-checkout-offer-product-title"])),(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-price",style:{color:a["wcf-pre-checkout-offer-desc-color"],fontWeight:500}},cartflows_admin.woo_currency,""!==l&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("del",{className:"wcf-regular-price"},isNaN(c)?0:c),(0,e.createElement)("span",{className:"wcf-discount-price"}," ",l)),""===l&&(0,e.createElement)("span",{className:"wcf-regular-price"},isNaN(c)?0:c)),(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-desc"},(0,e.createElement)("span",{style:{color:a["wcf-pre-checkout-offer-desc-color"],lineHeight:"0"}},xn((a["wcf-pre-checkout-offer-desc"]||"").toString()))),(0,e.createElement)("input",{type:"hidden",value:"add",className:"wcf-pre-checkout-offer-action"}))),(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-actions flex flex-col gap-3 p-5"},(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-btn-action wcf-pre-checkout-add-cart-btn"},(0,e.createElement)("button",{className:"wcf-pre-checkout-offer-btn alt !w-full text-base !bg-primary-500 !rounded !text-white !font-semibold px-4 py-3 !text-center",style:{backgroundColor:a["wcf-pre-checkout-offer-button-color"],borderColor:a["wcf-pre-checkout-offer-button-color"]}},a["wcf-pre-checkout-offer-popup-btn-text"])),(0,e.createElement)("div",{className:"wcf-pre-checkout-offer-btn-action wcf-pre-checkout-skip-btn text-center"},(0,e.createElement)("a",{className:"wcf-pre-checkout-skip text-gray-400",href:"#",style:{color:a["wcf-pre-checkout-offer-desc-color"]}},a["wcf-pre-checkout-offer-popup-skip-btn-text"]))))))))))},dz=function(){const[{settings_data:a,options:r}]=Bc(),[n,i]=(0,t.useState)("product"),s=PN();if(!wcfCartflowsPro())return(0,e.createElement)(xy,{feature:"Checkout Offer",plan_required:"starter"});const o=[{name:(0,z.__)("Product","cartflows"),slug:"product",icon:(0,e.createElement)(NL,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Content","cartflows"),slug:"content",icon:(0,e.createElement)(XA,{className:"w-18 h-18 stroke-2"})},{name:(0,z.__)("Styles","cartflows"),slug:"styles",icon:(0,e.createElement)(xA,{className:"w-18 h-18 stroke-2"})}];if(void 0===a.settings)return(0,e.createElement)(nz,null);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Yy,{name:"wcf-pre-checkout-offer",value:r["wcf-pre-checkout-offer"],label:(0,z.__)("Enable Checkout Offer","cartflows"),fullWidth:!0}),"yes"===r["wcf-pre-checkout-offer"]&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-co-preview"},(0,e.createElement)(uz,null)),(0,e.createElement)("span",{className:"border border-gray-200 isolate inline-flex rounded-md shadow-sm w-full mt-8 mb-8 gap-0.5"},o.map(t=>{const a=t.slug===n?"z-10 text-primary-600 bg-primary-25 outline-none ring-1 ring-primary-300 rounded-lg shadow shadow-primary-lg":"";return(0,e.createElement)("button",{type:"button",className:Dn()("flex justify-center gap-2 relative text-center w-1/3 items-center px-4 py-2 text-sm font-medium text-gray-400 hover:bg-primary-25 hover:ring-1 hover:ring-primary-300 hover:rounded-lg hover:text-primary-600",a),onClick:()=>{!async function(e){e!==n?(await async function(){return!!window.wcfUnsavedChanges&&await s({title:(0,z.__)("Save Changes","cartflows"),description:(0,z.__)("You have made changes. Do you want to save the changes?","cartflows"),actionBtnText:(0,z.__)("Yes","cartflows"),cancelBtnText:(0,z.__)("No","cartflows")})}()||i(e),window.wcfUnsavedChanges=!1):i(e)}(t.slug)},key:t.slug},t.icon?t.icon:"",(0,e.createElement)("span",{className:"text-center"},t.name))})),(0,e.createElement)("div",{className:"wcf-checkout-offer-settings wcf-checkout__section"},(0,e.createElement)(iz,{tab:n,displayAs:"div"}))))},mz=function(){return(0,e.createElement)("div",{className:"wcf-checkout-rules-page"},(0,e.createElement)("div",{className:"wcf-checkout-rules-page--enable_option"},(0,e.createElement)(aw,{width:"65%"})),(0,e.createElement)("div",{className:"wcf-checkout-rules--group_wrapper"},(0,e.createElement)("div",{className:"wcf-checkout-rules--text"},(0,e.createElement)(aw,{width:"10%"}),(0,e.createElement)(nw,{width:"25%",height:"35px"}),(0,e.createElement)(aw,{width:"20%"})),(0,e.createElement)("div",{className:"wcf-checkout-rules"},Array(3).fill().map((t,a)=>(0,e.createElement)("div",{className:"wcf-checkout-rule",key:a},(0,e.createElement)("div",{className:"wcf-checkout-rule--select-box"},(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"}),(0,e.createElement)(nw,{height:"35px",width:"30%"})),2!==a&&(0,e.createElement)("div",{className:"wcf-checkout-rule__and"},(0,e.createElement)(nw,{height:"25px",width:"5%"}))))),(0,e.createElement)(nw,{height:"40px",width:"9%"})),(0,e.createElement)("div",{className:"wcf-checkout-rules--or"},(0,e.createElement)(nw,{height:"35px",width:"5%"}),(0,e.createElement)(nw,{height:"45px",width:"12%"})),(0,e.createElement)("div",{className:"wcf-checkout-rules--default-step"},(0,e.createElement)(aw,{width:"10%"}),(0,e.createElement)(nw,{width:"25%",height:"35px"}),(0,e.createElement)(aw,{width:"20%"})))},gz=function(){return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-checkout-rules-page-cta"},(0,e.createElement)("div",{className:"wcf-checkout-rules-page"},(0,e.createElement)("span",{className:"wcf-accordion-button relative flex justify-between items-center w-full py-4 px-0 text-base font-semibold text-gray-800 text-left transition focus:outline-none"},(0,e.createElement)("span",{className:"flex gap-2 items-center"},(0,e.createElement)("span",null,(0,z.__)("Dynamic Conditions","cartflows")),(0,e.createElement)("span",{className:"wcf-pro-badge px-2 py-0.5 text-xs text-primary-600 ml-auto rounded-[14px] shadow-[0px_6px_16px_-2px_rgba(240,100,52,0.4)]"},(0,e.createElement)("span",null,(0,z.__)("PRO","cartflows"))))),(0,e.createElement)(KN,{buttonLink:getUpgradeToProUrl({utm_campaign:"dynamic-offers-cta"}),heading:(0,z.__)("Show the Right Offer to the Right People – Automatically!","cartflows"),subHeading:(0,z.__)("Personalize deals based on location, cart details, and more. Upgrade to CartFlows PRO and unlock this smart feature today!","cartflows")}))))},pz=function({rules:t,group_id:a,g_index:r,groups_length:n}){const[{page_settings:i},s]=Bc(),o=i?.settings.rules,l=o.conditions,c=e=>{const t=e.target.getAttribute("rule_id");a&&t&&s({type:"REMOVE_RULE",name:"wcf-checkout-rules",rule_id:t,group_id:a})};return(0,e.createElement)(e.Fragment,null,t.map((i,u)=>{const d=i?.rule_id,m=t[u],g=o.field_data[m.condition],p=m.operator.replace(/</g,"&lt;").replace(/>/g,"&gt;"),f=((e=[])=>"wcf-checkout-rules--rule_fields flex flex-col justify-center items-center sm:grid gap-3 w-full "+(e.some(e=>"product"===e.type)?"sm:grid-cols-2":"sm:grid-cols-3"))(g?.fields);return(0,e.createElement)(e.Fragment,null,0!==u&&(0,e.createElement)("div",{className:"wcf-checkout-rules--group_rules__condition-label"},(0,e.createElement)("div",{className:"wcf--condition-label__and_group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf--condition-label__and_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("AND","cartflows"))))),(0,e.createElement)("div",{className:"wcf-checkout-rules--group_rules flex gap-3 items-center","data-rule-id":d,key:d},(0,e.createElement)("input",{type:"hidden",name:`wcf-checkout-rules[${r}][rules][${u}][rule_id]`,value:d}),(0,e.createElement)("div",{className:f},(0,e.createElement)(In,{name:`wcf-checkout-rules[${r}][rules][${u}][condition]`,wrapperClass:"block",options:l,onSelect:()=>{s({type:"RESET_RULE_VALUE",name:"wcf-checkout-rules",group_id:a,rule_id:d})},value:m.condition,sectionClass:"w-full sm:!w-auto"}),(0,e.createElement)(In,{name:`wcf-checkout-rules[${r}][rules][${u}][operator]`,wrapperClass:"block",options:g.operator,value:xn(p),sectionClass:"w-full sm:!w-auto"}),function(t,a,n){const i=n.value;let s="";const o=`wcf-checkout-rules[${r}][rules][${a}][value]`;return t.map(t=>{switch(t.type){case"multitext":s=(0,e.createElement)(Cy,{name:`${o}`,value:i,fields:t.fields});break;case"text":s=(0,e.createElement)(En,{name:`${o}`,value:i,placeholder:t.placeholder,tooltip:t.tooltip});break;case"select2":s=(0,e.createElement)(Pc,{name:`${o}[]`,value:i,placeholder:t.placeholder,tooltip:t.tooltip,options:t.options,isMulti:t.isMulti,isSearchable:t?.enable_search});break;case"number":s=(0,e.createElement)(bp,{name:o,value:i,min:0,placeholder:t.placeholder,tooltip:t.tooltip});break;case"coupon":s="exist"===n.operator||"not_exist"===n.operator?(0,e.createElement)(In,{name:o,options:[{label:"in parent order",value:"parent_order"}]}):(0,e.createElement)(Dy,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti});break;case"product":s=(0,e.createElement)(by,{name:o,placeholder:t.placeholder,tooltip:t.tooltip,value:i,isMulti:t.isMulti,sectionClass:"col-span-full",showLabelOnly:!0})}return s})}(g.fields,u,m)),(0,e.createElement)("div",{className:"wcf-checkout-rules--rule_actions"},function(t,r){return 1===t&&1===n?"":(0,e.createElement)(au,{className:"w-5 h-6 stroke-2 p-0.5 text-gray-400 cursor-pointer hover:text-primary-700 focus:text-primary-700",onClick:c,group_id:a,rule_id:r})}(t.length,d))))}))},fz=function(){const[{step_data:a,step_id:r,options:n},i]=Bc(),[s,o]=(0,t.useState)({ruleGroupId:"",isOpen:!1}),[{license_status:l}]=m(),{ruleGroupId:c,isOpen:u}=s;if(!wcfCartflowsPro()||"Activated"!==l)return(0,e.createElement)(gz,null);if(null===n)return(0,e.createElement)(mz,null);const d=n["wcf-checkout-rules"];if(void 0===d)return(0,e.createElement)(Ny,{content:(0,z.__)("Please Update the CartFlows Pro to the latest version to use the dynamic offers feature.","cartflows")});const g=()=>{const e={group_id:Math.random().toString(36).substring(2,5),rules:[{rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""}]};i({type:"ADD_NEW_GROUP",name:"wcf-checkout-rules",newGroup:e})},p=e=>{const t=e.target.getAttribute("data-group_id"),a={rule_id:Math.random().toString(36).substring(2,5),condition:"cart_item",operator:"",value:""};i({type:"ADD_NEW_RULE",name:"wcf-checkout-rules",newRule:a,group_id:t})},f=function(e){const t=e.target.getAttribute("data-group_id");o({ruleGroupId:t,isOpen:c!==t||!u})};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"wcf-checkout-rules-page"},(0,e.createElement)("div",{className:"wcf-checkout-rules-page--enable_option"},(0,e.createElement)(Yy,{name:"wcf-checkout-rules-option",value:n["wcf-checkout-rules-option"],label:(0,z.__)("Enable Dynamic Offers","cartflows"),tooltip:(0,z.__)("Turn this on to set up rules that decide when visitors should be redirected to a special offer or the next step.","cartflows"),fullWidth:!0})),"yes"===n["wcf-checkout-rules-option"]&&d&&(0,e.createElement)("div",{className:"mt-8"},(0,e.createElement)(Fc.ReactSortable,{id:"wcf-checkout-rules-sortable-wrapper",className:"wcf-checkout-rules--sortable-wrapper flex flex-col gap-4",list:d,setList:e=>i({type:"SET_RULES_GROUPS",groups:e,fieldName:"wcf-checkout-rules",step_id:r}),swapThreshold:.8,direction:"vertical",animation:150,handle:".wcf-checkout-rules--group",filter:".wcf-checkout-rules--rule_fields, .wcf-checkout-rules--rule_actions, .wcf-field.wcf-select-option, .wcf-checkout-rules--add-rule__repeater .wcf-button.wcf-button--secondary, .wcf-field__data--content, .wcf-checkout-rules-page--group_wrapper__footer, .wcf-checkout-rules--group_header",preventOnFilter:!1,onStart:function(){document.getElementsByClassName("wcf-checkout-rules--or_group__button")[0].setAttribute("style","display:none")},onEnd:function(){document.getElementsByClassName("wcf-checkout-rules--or_group__button")[0].setAttribute("style","display:inline-block")}},d.map((t,r)=>{const n=t.group_id,i=t.rules;return(0,e.createElement)("div",{className:"wcf-checkout-rules-page--group_wrapper",key:n},(0,e.createElement)("div",{className:"wcf-checkout-rules--group border border-gray-200 rounded-lg mb-6","data-group-id":n},(0,e.createElement)("input",{type:"hidden",name:`wcf-checkout-rules[${r}][group_id]`,value:n}),(0,e.createElement)("div",{className:"wcf-checkout-rules--group-header wcf-redirection-step bg-white p-4 rounded-lg flex items-center justify-between"},(0,e.createElement)("div",{className:"wcf-checkout-rules--group-header__left flex gap-2 items-center"},(0,e.createElement)("div",{className:"wcf-checkout-rule--sortable-toggle flex cursor-move text-gray-500"},(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-2","aria-hidden":"true"}),(0,e.createElement)(qc,{className:"w-6 h-6 stroke-1 -ml-4","aria-hidden":"true"})),(0,e.createElement)("div",{className:"border border-gray-200 rounded-md flex items-center gap-3 px-2.5 py-2"},(0,e.createElement)("div",{className:"text-sm font-normal text-gray-400"},(0,z.__)("Redirect to: ","cartflows")),(0,e.createElement)(In,{name:`wcf-checkout-rules[${r}][step_id]`,class:"w-full !max-w-full h-auto input-field !text-sm font-normal !rounded-none text-gray-400 !border-none focus:ring-0 focus:!border-none focus:!shadow-none !outline-0 !outline-none !m-0 !placeholder-gray-400",value:t.step_id,placeholder:(0,z.__)("Search for step…","cartflows"),options:a.step_lists,overrideCss:!0})),(0,e.createElement)("div",{className:"text-sm font-normal text-gray-400"},(0,z.__)("If the following conditions are true","cartflows"))),(0,e.createElement)("div",{className:"wcf-checkout-rules--group-header__right flex gap-2 items-center"},c===n&&u?(0,e.createElement)(_w,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:f,"data-group_id":n}):(0,e.createElement)(Ew,{className:"w-4 h-4 stroke-1 text-gray-400 hover:text-gray-500 cursor-pointer","aria-hidden":"true",onClick:f,"data-group_id":n}))),(0,e.createElement)("div",{id:`wcf-checkout-rules--group-${n}`,className:"pt-7 px-7 pb-4 bg-gray-50 border-t border-gray-200 "+(c===n&&u?"visible":"hidden")},(0,e.createElement)("div",{className:"wcf-checkout-rules--group-rules__wrapper flex flex-col gap-4"},0!==i.length&&(0,e.createElement)(pz,{rules:i,group_id:n,g_index:r,groups_length:d.length})),(0,e.createElement)("div",{className:"wcf-checkout-rules--add-rule__repeater flex"},(0,e.createElement)("div",{className:"wcf-checkout-rules--add-rule__button text-sm font-medium flex gap-1.5 items-center cursor-pointer text-primary-500 hover:text-primary-600 focus:text-primary-600 mt-5","data-group_id":n,onClick:p},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Condition","cartflows"))))),(0,e.createElement)("div",{className:"wcf-checkout-rules-page--group_wrapper__footer"},(0,e.createElement)("div",{className:"wcf-checkout-rules--or-group relative"},(0,e.createElement)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true"},(0,e.createElement)("div",{className:"w-full border-t border-gray-300 border-dashed"})),(0,e.createElement)("div",{className:"relative flex justify-center"},(0,e.createElement)("span",{className:"wcf-checkout-rules--or_group__text bg-gray-50 px-2 text-xs text-gray-400"},(0,z.__)("OR","cartflows")))),parseInt(r)+1===d.length&&(0,e.createElement)("div",{className:"wcf-checkout-rules--or_group__button mt-4"},(0,e.createElement)("span",{className:"wcf-checkout-rules--or_group_button or-button wcf-button wcf-secondary-button",onClick:g},(0,e.createElement)(Sn,{className:"w-18 h-18 stroke-2"}),(0,z.__)("Add Dynamic Offer","cartflows")))))}))),"yes"===n["wcf-checkout-rules-option"]&&(0,e.createElement)("div",{className:"wcf-checkout-rules--default-step border border-gray-200 rounded-lg p-4 flex items-center justify-between mt-8"},(0,e.createElement)("div",{className:"wcf-checkout-rules--default-step__left border border-gray-200 rounded-md flex items-center gap-3 px-2.5 py-2"},(0,e.createElement)("div",{className:"text-sm font-normal text-gray-400"},(0,z.__)("Redirect to: ","cartflows")),(0,e.createElement)(In,{name:"wcf-checkout-rules-default-step",class:"w-full !max-w-full h-auto input-field !text-sm font-normal !rounded-none text-gray-400 !border-none focus:ring-0 focus:!border-none focus:!shadow-none !outline-0 !outline-none !m-0 !placeholder-gray-400",value:n["wcf-checkout-rules-default-step"],placeholder:(0,z.__)("Search for default step…","cartflows"),options:a.step_lists,overrideCss:!0})),(0,e.createElement)("div",{className:"text-sm font-normal text-gray-400"},(0,z.__)("If all of the above conditions failed.","cartflows")))))};function hz({title:e,titleId:a,...r},n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":a},r),e?t.createElement("title",{id:a},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a2.25 2.25 0 0 0-2.25-2.25H15a3 3 0 1 1-6 0H5.25A2.25 2.25 0 0 0 3 12m18 0v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 9m18 0V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v3"}))}const Mz=t.forwardRef(hz),yz=function(t){const{innerField:a,innerFieldData:r}=t,[{options:n}]=Bc();return(0,e.createElement)("div",{className:"wcf-field-item--fields-settings__wrapper bg-gray-50 hidden p-5 border-x border-gray-200 last:border-b",id:`wcf-field-setting-${a}`},r&&Object.keys(r.field_options).map(t=>{const a=r.field_options[t];let i="";const s=function(e){const t=e.name;let a="";if(t.includes("[")){const e=t.split("["),r=[];for(let t=1;t<e.length;t++)r.push(e[t].split("]")[0]);const i=t.substr(0,t.indexOf("["));switch(r.length){case 2:a=n[i][r[0]][r[1]];break;case 3:a=n[i][r[0]][r[1]][r[2]];break;case 4:a=n[i][r[0]][r[1]][r[2]][r[3]];break;default:a=n[i][r[0]]}}else a=n[e.name]?n[e.name]:e.value;return a}(a);switch(a.type){case"text":i=(0,e.createElement)(En,{class:"w-full max-w-full input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0",name:a.name,value:s,label:a.label,placeholder:a.placeholder,readonly:a.readonly,tooltip:a.tooltip,displayAlign:"vertical"});break;case"number":i=(0,e.createElement)(bp,{class:"w-full max-w-full input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0",name:a.name,value:s,label:a.label,readonly:a.readonly,tooltip:a.tooltip,displayAlign:"vertical",min:a.min});break;case"checkbox":i=(0,e.createElement)(vn,{class:a.class,name:a.name,value:s,label:a.label,desc:a.desc,child_className:a.child_class});break;case"select":i=(0,e.createElement)(In,{class:a.class,name:a.name,value:s,label:a.label,options:a.options,tooltip:a.tooltip,displayAlign:"vertical"});break;case"doc":i=(0,e.createElement)(Ny,{content:a.content})}return(0,e.createElement)("div",{key:a.name,className:`wcf-cfe-field-setting__panel wcf-cfe-field-${t} mb-5 ${"enable-field"===t||"required-field"===t?"hidden":""}`},i)}))},Nz=function(a){const[{billing_fields:r,shipping_fields:n},i]=Bc(),{step:s,type:o,removeCallback:l}=a,[c,u]=(0,t.useState)(""),[d,m]=(0,t.useState)("");let g=[];g="billing"===o?r:n;const p=function(e){const t=e.target.getAttribute("data-name"),a=document.getElementById(`wcf-field-setting-${t}`);a.classList.contains("hidden")?(a.classList.remove("hidden"),u(t)):(a.classList.add("hidden"),u(""))},f=function(e){l(e,m)},h=({name:e,value:t,fieldName:a})=>{const s=("billing"===o?r:n).map(r=>r.field_options[a].name===e?{...r,field_options:{...r.field_options,[a]:{...r.field_options[a],value:t}}}:r);i({type:"SET_FIELDS",field_type:o,fields:s})};return(0,e.createElement)("div",{className:"py-5"},(0,e.createElement)("div",{className:`wcf-${o}-fields--header flex items-center p-3 border gap-4 bg-gray-50`},(0,e.createElement)("div",{className:"w-3/12"},(0,z.__)("Label","cartflows")),(0,e.createElement)("div",{className:"w-3/12"},(0,z.__)("ID","cartflows")),(0,e.createElement)("div",{className:"w-1/5"},(0,z.__)("Enable","cartflows")),(0,e.createElement)("div",{className:"w-1/5"},(0,z.__)("Required","cartflows")),(0,e.createElement)("div",{className:"w-1/12"},(0,z.__)("Edit","cartflows"))),(0,e.createElement)(Fc.ReactSortable,{list:[...g],setList:e=>i({type:"SET_FIELDS",field_type:o,fields:e}),direction:"vertical",animation:150,handle:".wcf-field-item-handle",filter:".wcf-field-settings-icon, .wcf-toggle-field"},g&&g.map(t=>{const a=t.key,r=t.field_options["enable-field"],n=t.field_options["required-field"];return(0,e.createElement)("div",{key:a,className:"wcf-field-item-handle "+("yes"!==r.value?"!text-gray-400":""),"data-key":a},(0,e.createElement)("div",{className:"wcf-fields-wrapper flex items-center p-3 border justify-evenly"},(0,e.createElement)("div",{className:"wcf-field--label whitespace-nowrap w-3/12 flex items-center mr-auto"},(0,e.createElement)("div",{className:"wcf-cpf--sortable-toggle flex cursor-move text-gray-400"},(0,e.createElement)(qc,{className:"w-5 h-5 stroke-1","aria-hidden":"true"}),(0,e.createElement)(qc,{className:"w-5 h-5 stroke-1 -ml-3.5","aria-hidden":"true"})),(0,e.createElement)("span",{className:"text-ellipsis overflow-hidden cursor-default"},t.label?t.label:t.placeholder," "),("billing_email"===a||"shipping_email"===a)&&"checkout"===s&&(0,e.createElement)(_y,{text:(0,z.__)("Your email address can't be edited when using the Modern Checkout Style.","cartflows")}),"billing_company"===a&&"checkout"===s&&(0,e.createElement)(_y,{text:(0,z.__)("The Company field won't be visible if you're using the Instant Layout Style.","cartflows")})),(0,e.createElement)("div",{className:"wcf-field--key whitespace-nowrap w-3/12 text-ellipsis overflow-hidden mr-auto cursor-default"},t.key),(0,e.createElement)("div",{className:"wcf-field--is-enable w-1/5"},(0,e.createElement)(Yy,{name:r.name,value:r.value,onChange:({name:e,value:t})=>h({name:e,value:t,fieldName:"enable-field"})})),(0,e.createElement)("div",{className:"wcf-field--is-required w-1/5"},(0,e.createElement)(Yy,{name:n.name,value:"yes"!==r.value?"no":n.value,isDisabled:"yes"!==r.value?"true":"",class:"yes"!==r.value?"disabled:!bg-gray-200":"",onChange:({name:e,value:t})=>h({name:e,value:t,fieldName:"required-field"})})),(0,e.createElement)("div",{className:"wcf-field-settings-icon flex gap-2 w-1/12 "},(0,e.createElement)("div",{onClick:p,"data-name":a},(0,e.createElement)(eu,{className:"p-1 h-7 w-7 cursor-pointer "+(c===a?"rounded bg-primary-50 text-primary-500":"text-gray-400 hover:text-primary-500 focus:bg-primary-50"),"data-name":a})),t.custom&&(0,e.createElement)("div",{"data-key":a,"data-type":o,onClick:f},a===d?(0,e.createElement)(Cn,{className:"wcf-delete-cpf--button-processing p-1 h-7 w-7 text-primary-500 pointer-events-none animate-spin","data-key":a,"data-type":o}):(0,e.createElement)(au,{className:"wcf-delete-cpf--button-delete p-1 h-7 w-7 text-primary-500 cursor-pointer","data-key":a,"data-type":o})))),(0,e.createElement)(yz,{innerField:a,innerFieldData:t,removecustomField:f,type:o}))})))},wz=function(a){const{addNewField:r,step_type:n}=a,i=(0,z.__)("Add New Field","cartflows"),s=(0,z.__)("Date & Time","cartflows"),[o,l]=(0,t.useState)(!1),[c,u]=(0,t.useState)(!1),[d,m]=(0,t.useState)(i),[g,p]=(0,t.useState)(),f=function(){l(!1),u(!1),x(!1),m(i)},h=function(e){e.preventDefault(),l(!1)},M=function(e){e.preventDefault(),m((0,z.__)("Adding…","cartflows")),u(!0),c||r(e,f,m)||u(!1)},[y,N]=(0,t.useState)(!1),[w,x]=(0,t.useState)(!1),[b,D]=(0,t.useState)(!0),[v,j]=(0,t.useState)(!1),[_,I]=(0,t.useState)(!1),[E,L]=(0,t.useState)(!1),[T,A]=(0,t.useState)("datetime-local"),[k,S]=(0,t.useState)(s),O=function(){x(!w)},[C,Y]=(0,t.useState)(!1),U=function(){const e=document.getElementById("wcf-checkout-custom-fields[0][type]").value;j(!1),I(!1),L(!1),D(!1),Y(!1),"text"===e||"textarea"===e?D(!0):"select"===e?L(!0):"checkbox"===e?j(!0):"radio"===e?I(!0):"file"===e&&Y(!0),N(e)},Q=function(e){let t=e.replace(/[^a-zA-Z\d ]/g," ");t=t.replace(/\s/g,"_").toLowerCase(),p(t)},P=function(e){A(e.target.value),"datetime-local"===e.target.value?S(s):S(e.target.value)},F=function(){let e="";if("datetime"!==y)return e;switch(T){case"date":e="yyyy-mm-dd";break;case"time":e="hh:mm";break;case"datetime-local":e="yyyy-mm-dd hh.mm";break;default:e=""}return e};return(0,e.createElement)("div",{className:"wcf-custom-field-box"},(0,e.createElement)("div",{className:"text-right"},(0,e.createElement)("button",{className:"wcf-add-custom-field wcf-button wcf-secondary-button focus:ring-0",onClick:function(e){e.preventDefault(),p(""),l(!o)}},(0,e.createElement)(Sn,{className:"h-18 w-18 ease-in-out duration-300 text-primary-500 "+(o?"rotate-45":"")}),o?(0,z.__)("Cancel","cartflows"):(0,z.__)("Add Custom Field","cartflows"))),(0,e.createElement)(na,{show:o,enter:"transition-all ease duration-700 transform",enterFrom:"opacity-0 translate-y-0",enterTo:"opacity-100 translate-y-5",leave:"transition-all ease duration-500 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-0"},(0,e.createElement)("div",{className:"wcf-cfe-content mt-5"},function(){const t=[{value:"billing",label:(0,z.__)("Billing","cartflows")},{value:"shipping",label:(0,z.__)("Shipping","cartflows")}],a=[{value:"text",label:(0,z.__)("Text","cartflows")},{value:"textarea",label:(0,z.__)("TextArea","cartflows")},{value:"number",label:(0,z.__)("Number","cartflows")},{value:"datetime",label:(0,z.__)("Date & Time","cartflows")},{value:"checkbox",label:(0,z.__)("Checkbox","cartflows")},{value:"radio",label:(0,z.__)("Radio","cartflows")},{value:"select",label:(0,z.__)("Select","cartflows")},{value:"hidden",label:(0,z.__)("Hidden","cartflows")},{value:"file",label:(0,z.__)("File","cartflows")}],r=[{value:"33",label:(0,z.__)("33%","cartflows")},{value:"50",label:(0,z.__)("50%","cartflows")},{value:"100",label:(0,z.__)("100%","cartflows")}],i="w-full max-w-full input-field !px-3 !py-2.5 !text-sm font-normal !rounded-md text-gray-400 !border-gray-200 focus:ring focus:!ring-primary-100 focus:!border-primary-500 focus:!shadow-none !outline-0 !outline-none !m-0";return(0,e.createElement)("form",{className:"wcf-custom-field-form--wrapper bg-white border border-gray-200 rounded-md text-left p-5"},(0,e.createElement)("h2",{className:"wcf-custom-field-form--header text-base font-semibold text-gray-800 text-left pb-5 flex justify-between items-center"},(0,z.__)("Add Custom Field","cartflows")),"checkout"===n&&(0,e.createElement)("div",{className:"wcf-custom-field-form--field-row pb-5"},(0,e.createElement)(In,{class:"wcf-cpf-add_to",name:"wcf-checkout-custom-fields[0][add_to]",options:t,label:(0,z.__)("Add To","cartflows"),displayAlign:"vertical"})),(0,e.createElement)("div",{className:"wcf-custom-field-form--field-row pb-5"},(0,e.createElement)(In,{class:"wcf-cpf-type",id:"wcf-checkout-custom-fields[0][type]",name:"wcf-checkout-custom-fields[0][type]",options:a,label:(0,z.__)("Type","cartflows"),onSelect:U,displayAlign:"vertical"})),(0,e.createElement)("div",{className:"wcf-custom-field-form--field-row pb-5"},(0,e.createElement)(En,{class:`wcf-cpf-label ${i}`,name:"wcf-checkout-custom-fields[0][label]",label:xn((0,z.sprintf)(/* translators: %$s is replaced with the HTML tag */ /* translators: %$s is replaced with the HTML tag */
52 52 (0,z.__)("Label %1$s*%2$s","cartflows"),'<span class="text-primary-300">',"</span>")),onChangeCB:Q,displayAlign:"vertical"})),(0,e.createElement)("div",{className:"wcf-custom-field-form--field-row pb-5"},(0,e.createElement)(En,{class:`wcf-cpf-name ${i}`,name:"wcf-checkout-custom-fields[0][key]",value:g,label:(0,z.__)("Field ID","cartflows"),tooltip:(0,z.sprintf)(/* translators: %$s is replaced with the HTML tag */ /* translators: %$s is replaced with the HTML tag */