Changeset 3680119
- Timestamp:
- 09/03/2026 05:07:35 PM (3 months ago)
- Location:
- corelabs-checkout-fields
- Files:
-
- 100 added
- 29 edited
-
tags/1.5.0 (added)
-
tags/1.5.0/assets (added)
-
tags/1.5.0/assets/css (added)
-
tags/1.5.0/assets/css/builder.css (added)
-
tags/1.5.0/assets/css/frontend.css (added)
-
tags/1.5.0/build (added)
-
tags/1.5.0/build/block-checkout.asset.php (added)
-
tags/1.5.0/build/block-checkout.js (added)
-
tags/1.5.0/build/frontend.asset.php (added)
-
tags/1.5.0/build/frontend.js (added)
-
tags/1.5.0/build/index-rtl.css (added)
-
tags/1.5.0/build/index.asset.php (added)
-
tags/1.5.0/build/index.css (added)
-
tags/1.5.0/build/index.js (added)
-
tags/1.5.0/build/style-block-checkout-rtl.css (added)
-
tags/1.5.0/build/style-block-checkout.css (added)
-
tags/1.5.0/composer.json (added)
-
tags/1.5.0/composer.lock (added)
-
tags/1.5.0/corelabs-checkout-fields.php (added)
-
tags/1.5.0/includes (added)
-
tags/1.5.0/includes/Admin (added)
-
tags/1.5.0/includes/Admin/BuilderAssets.php (added)
-
tags/1.5.0/includes/Admin/RestController.php (added)
-
tags/1.5.0/includes/Admin/SettingsPage.php (added)
-
tags/1.5.0/includes/Admin/SourceCatalog.php (added)
-
tags/1.5.0/includes/Checkout (added)
-
tags/1.5.0/includes/Checkout/BlockIntegration.php (added)
-
tags/1.5.0/includes/Checkout/CheckoutConditionData.php (added)
-
tags/1.5.0/includes/Checkout/ClassicRenderer.php (added)
-
tags/1.5.0/includes/Checkout/DeliveryDates.php (added)
-
tags/1.5.0/includes/Checkout/FeeCalculator.php (added)
-
tags/1.5.0/includes/Checkout/FeesIntegration.php (added)
-
tags/1.5.0/includes/Checkout/FileUploads.php (added)
-
tags/1.5.0/includes/Checkout/OrderPersistence.php (added)
-
tags/1.5.0/includes/Checkout/Sanitizer.php (added)
-
tags/1.5.0/includes/Checkout/Validator.php (added)
-
tags/1.5.0/includes/Fields (added)
-
tags/1.5.0/includes/Fields/FieldOptions.php (added)
-
tags/1.5.0/includes/Fields/FieldRepository.php (added)
-
tags/1.5.0/includes/Fields/FieldSchema.php (added)
-
tags/1.5.0/includes/Fields/FieldTypes.php (added)
-
tags/1.5.0/includes/Frontend (added)
-
tags/1.5.0/includes/Frontend/FrontendAssets.php (added)
-
tags/1.5.0/includes/Logic (added)
-
tags/1.5.0/includes/Logic/ConditionalLogic.php (added)
-
tags/1.5.0/includes/Plugin.php (added)
-
tags/1.5.0/languages (added)
-
tags/1.5.0/languages/corelabs-checkout-fields.pot (added)
-
tags/1.5.0/package.json (added)
-
tags/1.5.0/readme.txt (added)
-
tags/1.5.0/src (added)
-
tags/1.5.0/src/block-checkout (added)
-
tags/1.5.0/src/block-checkout/index.js (added)
-
tags/1.5.0/src/block-checkout/style.css (added)
-
tags/1.5.0/src/builder (added)
-
tags/1.5.0/src/builder/AppShell.jsx (added)
-
tags/1.5.0/src/builder/FieldPreview.jsx (added)
-
tags/1.5.0/src/builder/Palette.jsx (added)
-
tags/1.5.0/src/builder/PreviewCanvas.jsx (added)
-
tags/1.5.0/src/builder/SettingsPanel.jsx (added)
-
tags/1.5.0/src/builder/SimulationBar.jsx (added)
-
tags/1.5.0/src/builder/describe.js (added)
-
tags/1.5.0/src/builder/panels (added)
-
tags/1.5.0/src/builder/panels/Fee.jsx (added)
-
tags/1.5.0/src/builder/panels/General.jsx (added)
-
tags/1.5.0/src/builder/panels/Layout.jsx (added)
-
tags/1.5.0/src/builder/panels/Logic.jsx (added)
-
tags/1.5.0/src/builder/panels/Options.jsx (added)
-
tags/1.5.0/src/builder/reducer.js (added)
-
tags/1.5.0/src/builder/simulation.js (added)
-
tags/1.5.0/src/builder/store.js (added)
-
tags/1.5.0/src/builder/templates.js (added)
-
tags/1.5.0/src/checkout-conditions (added)
-
tags/1.5.0/src/checkout-conditions/data-sources.js (added)
-
tags/1.5.0/src/frontend (added)
-
tags/1.5.0/src/frontend.js (added)
-
tags/1.5.0/src/frontend/conditional-logic.js (added)
-
tags/1.5.0/src/index.js (added)
-
tags/1.5.0/src/shared (added)
-
tags/1.5.0/src/shared/FieldIcon.jsx (added)
-
tags/1.5.0/src/shared/FlameMark.jsx (added)
-
tags/1.5.0/src/shared/SupportButton.jsx (added)
-
tags/1.5.0/src/shared/UiIcon.jsx (added)
-
tags/1.5.0/src/shared/options.js (added)
-
tags/1.5.0/vendor (added)
-
tags/1.5.0/vendor/autoload.php (added)
-
tags/1.5.0/vendor/composer (added)
-
tags/1.5.0/vendor/composer/ClassLoader.php (added)
-
tags/1.5.0/vendor/composer/InstalledVersions.php (added)
-
tags/1.5.0/vendor/composer/LICENSE (added)
-
tags/1.5.0/vendor/composer/autoload_classmap.php (added)
-
tags/1.5.0/vendor/composer/autoload_namespaces.php (added)
-
tags/1.5.0/vendor/composer/autoload_psr4.php (added)
-
tags/1.5.0/vendor/composer/autoload_real.php (added)
-
tags/1.5.0/vendor/composer/autoload_static.php (added)
-
tags/1.5.0/vendor/composer/installed.json (added)
-
tags/1.5.0/vendor/composer/installed.php (added)
-
tags/1.5.0/vendor/composer/platform_check.php (added)
-
tags/1.5.0/webpack.config.js (added)
-
trunk/assets/css/builder.css (modified) (1 diff)
-
trunk/assets/css/frontend.css (modified) (1 diff)
-
trunk/build/block-checkout.asset.php (modified) (1 diff)
-
trunk/build/block-checkout.js (modified) (1 diff)
-
trunk/build/index-rtl.css (modified) (1 diff)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.css (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/build/style-block-checkout-rtl.css (modified) (1 diff)
-
trunk/build/style-block-checkout.css (modified) (1 diff)
-
trunk/corelabs-checkout-fields.php (modified) (2 diffs)
-
trunk/includes/Checkout/BlockIntegration.php (modified) (1 diff)
-
trunk/includes/Checkout/ClassicRenderer.php (modified) (1 diff)
-
trunk/includes/Checkout/DeliveryDates.php (added)
-
trunk/includes/Checkout/OrderPersistence.php (modified) (1 diff)
-
trunk/includes/Checkout/Sanitizer.php (modified) (1 diff)
-
trunk/includes/Checkout/Validator.php (modified) (1 diff)
-
trunk/includes/Fields/FieldSchema.php (modified) (1 diff)
-
trunk/includes/Fields/FieldTypes.php (modified) (1 diff)
-
trunk/languages/corelabs-checkout-fields.pot (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/block-checkout/index.js (modified) (1 diff)
-
trunk/src/block-checkout/style.css (modified) (1 diff)
-
trunk/src/builder/FieldPreview.jsx (modified) (1 diff)
-
trunk/src/builder/Palette.jsx (modified) (1 diff)
-
trunk/src/builder/panels/General.jsx (modified) (3 diffs)
-
trunk/src/builder/reducer.js (modified) (1 diff)
-
trunk/src/shared/FieldIcon.jsx (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_static.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
corelabs-checkout-fields/trunk/assets/css/builder.css
r3630465 r3680119 442 442 .clcf-optrow .clcf-optprice .components-base-control { flex: none; } 443 443 .clcf-opthelp { margin: 8px 0 0; font-size: var(--clcf-fs-sm); color: #646970; } 444 445 /* Delivery field constraints editor */ 446 .clcf-delivery-cfg .clcf-cfg-label { font-weight: 600; font-size: 12px; margin: 12px 0 6px; } 447 .clcf-weekdays { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; } 448 .clcf-weekday { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; } 449 .clcf-cfg-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; } 450 .clcf-cfg-row .components-base-control { flex: 1; margin-bottom: 0; } 451 .clcf-cfg-row input[type="date"] { flex: 1; } -
corelabs-checkout-fields/trunk/assets/css/frontend.css
r3630388 r3680119 243 243 .clcf-file-remove:hover, 244 244 .clcf-file-remove:focus-visible { opacity: 1; } 245 246 /* Delivery date + time slot selects */ 247 .clcf-delivery { display: flex; gap: 8px; flex-wrap: wrap; } 248 .clcf-delivery select { flex: 1; min-width: 130px; } -
corelabs-checkout-fields/trunk/build/block-checkout.asset.php
r3630388 r3680119 1 <?php return array('dependencies' => array('react', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => ' 0df0486aa8c370bb6db2');1 <?php return array('dependencies' => array('react', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '2d27adf455cb35a1760d'); -
corelabs-checkout-fields/trunk/build/block-checkout.js
r3630388 r3680119 1 (()=>{"use strict";var e,t={625(){const e=window.React,t=window.wp.plugins,n=["select","radio"];function i(e){return String(e&&"object"==typeof e?e.label||"":null!=e?e:"")}function r(e){if(!e||"object"!=typeof e)return 0;const t=e.price;if("number"!=typeof t&&("string"!=typeof t||""===t.trim()||isNaN(Number(t))))return 0;const n=Number(t);return isNaN(n)||n<=0?0:n}function o(e){return(e&&e.options||[]).some(e=>r(e)>0)}const c=window.wp.element,l=window.wp.data,a=window.wp.i18n;function s(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function d(e,t){if(!e||"object"!=typeof e)return!1;const n=void 0!==t[e.field]&&null!==t[e.field]?String(t[e.field]):"",i=void 0!==e.value&&null!==e.value?String(e.value):"";switch(e.operator){case"is_not":return n!==i;case"contains":return""!==i&&-1!==n.indexOf(i);case"gt":return s(n)&&s(i)&&parseFloat(n)>parseFloat(i);case"lt":return s(n)&&s(i)&&parseFloat(n)<parseFloat(i);default:return n===i}}function u(e,t){const n={};e.forEach(e=>{n[e.id]=e});const i={},r={},o=e=>{if(e in i)return i[e];if(!n[e]||r[e])return!0;r[e]=!0;const c=n[e];let l=function(e,t){if(Array.isArray(e.conditions)&&e.conditions.length){const n=e.conditionAction||"show";if("require"===n)return!0;const i=e.conditions.map(e=>d(e,t)),r="any"===e.conditionMatch?-1!==i.indexOf(!0):-1===i.indexOf(!1);return"hide"===n?!r:r}return function(e,t){if(!e||"object"!=typeof e)return!0;const n=e.action||"show";if("require"===n)return!0;const i=d(e,t);return"hide"===n?!i:i}(e.condition,t)}(c,t);var a;return(a=c,Array.isArray(a.conditions)&&a.conditions.length?a.conditions.map(e=>e.field).filter(Boolean):a.condition&&a.condition.field?[a.condition.field]:[]).forEach(e=>{l=l&&o(e)}),delete r[e],i[e]=l,l},c={};return e.forEach(e=>{c[e.id]=o(e.id)}),c}const{ExperimentalOrderMeta:p,extensionCartUpdate:f}=window.wc.blocksCheckout,h=window.CLCF_BLOCK||{fields:[],ctx:{},sources:[]};function m(e,t){const c=i(t);if(!o(e))return c;const l=function(e,t){const o=function(e,t){if(null==t||""===t||"object"==typeof t)return 0;if(!n.includes(e&&e.type||""))return 0;const o=(e&&e.options||[]).find(e=>i(e)===String(t));return void 0===o?0:r(o)}(e,t);return o>0?o:parseFloat(e&&e.price)||0}(e,c);return l<=0?c:`${c} (${"percent"===e.priceMode?`+${l}%`:`+${function(e){const t=window.wcSettings&&window.wcSettings.currency||{},n="number"==typeof t.minorUnit?t.minorUnit:2,i=t.symbol||"",r=Number(e).toFixed(n);return"right"===t.symbolPosition?`${r}${i}`:`${i}${r}`}(l)}`})`}const g={},y=(h.fields||[]).some(e=>parseFloat(e.price)>0||o(e));function b(e){const t=e&&e.shippingRates||[];for(const e of t)for(const t of e.shipping_rates||[])if(t.selected)return t.rate_id;return""}function w({field:t,value:n,onChange:r}){const o=`clcf_block_${t.id}`,c=t.label||t.id;if("heading"===t.type)return(0,e.createElement)("div",{className:"clcf-block-field clcf-block-field--heading clcf-w-"+("half"===t.width?"half":"full")},(0,e.createElement)("strong",null,c),t.description?(0,e.createElement)("p",{className:"clcf-block-field__desc"},t.description):null);const l={id:o,value:n,required:!!t.required,onChange:e=>r("checkbox"===t.type?e.target.checked?"yes":"":e.target.value)};let s;if("textarea"===t.type)s=(0,e.createElement)("textarea",{...l,rows:3,placeholder:t.placeholder||""});else if("number"===t.type)s=(0,e.createElement)("input",{type:"number",...l,placeholder:t.placeholder||"",min:t.min||void 0,max:t.max||void 0,step:t.step||void 0});else if("checkbox"===t.type)s=(0,e.createElement)("label",{className:"clcf-block-checkbox"},(0,e.createElement)("input",{type:"checkbox",id:o,required:!!t.required,checked:"yes"===n,onChange:l.onChange})," ",c);else if("select"===t.type)s=(0,e.createElement)("select",{...l},(0,e.createElement)("option",{value:""},(0,a.__)("Choose an option","corelabs-checkout-fields")),(t.options||[]).map((n,r)=>(0,e.createElement)("option",{key:r,value:i(n)},m(t,n))));else if("radio"===t.type)s=(0,e.createElement)("span",{className:"clcf-block-radios"},(t.options||[]).map((c,l)=>(0,e.createElement)("label",{key:l},(0,e.createElement)("input",{type:"radio",name:o,value:i(c),checked:n===i(c),onChange:()=>r(i(c)),required:!!t.required})," ",m(t,c))));else if("email"===t.type||"phone"===t.type||"url"===t.type||"time"===t.type){const n={email:"email",phone:"tel",url:"url",time:"time"}[t.type];s=(0,e.createElement)("input",{type:n,...l,placeholder:t.placeholder||""})}else if("date"===t.type)s=(0,e.createElement)("input",{type:"date",...l,min:t.min||void 0,max:t.max||void 0});else if("file"===t.type){const i=h.upload||{},c=Math.min(10,Math.max(1,parseInt(t.maxFiles,10)||1)),l=String(n||"").split(",").map(e=>e.trim()).filter(Boolean),d=g[t.id]||{},u=async e=>{let n=Array.from(e.target.files||[]);if(!n.length)return;const o=1===c?[]:l.slice(),a=Math.max(0,c-o.length),s=n.length>a;n=n.slice(0,a);const d=n.filter(e=>i.maxMb&&e.size>1048576*i.maxMb);n=n.filter(e=>!i.maxMb||e.size<=1048576*i.maxMb);const u={};for(const e of n)try{const t=new FormData;t.append("file",e);const n={"X-CLCF-Nonce":i.nonce};i.restNonce&&(n["X-WP-Nonce"]=i.restNonce);const r=await fetch(i.url,{method:"POST",headers:n,body:t}),c=await r.json();if(!r.ok||!c.token)throw new Error(c&&c.message||"upload failed");o.push(c.token),u[c.token]=c.name}catch(e){window.alert(e.message||"Upload failed — please try again.")}e.target.value="",d.length?window.alert(`File is too large (max ${i.maxMb} MB).`):s&&window.alert(`Only ${c} files allowed.`),g[t.id]={...g[t.id]||{},...u},r(o.join(","))},p=e=>{r(l.filter(t=>t!==e).join(","))};s=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("input",{type:"file",id:o,accept:i.accept||void 0,multiple:c>1,required:!!t.required&&!l.length,onChange:u}),l.length>0&&(0,e.createElement)("span",{className:"clcf-file-list"},l.map(t=>(0,e.createElement)("span",{key:t,className:"clcf-file-item"},(0,e.createElement)("span",{className:"clcf-file-item__name"},d[t]||(0,a.__)("Attached file","corelabs-checkout-fields")),(0,e.createElement)("button",{type:"button",className:"clcf-file-remove","aria-label":(0,a.__)("Remove file","corelabs-checkout-fields"),onClick:()=>p(t)},"×")))))}else s=(0,e.createElement)("input",{type:"text",...l,placeholder:t.placeholder||"",maxLength:t.maxLength||void 0});return(0,e.createElement)("div",{className:"clcf-block-field clcf-w-"+("half"===t.width?"half":"full")},"checkbox"!==t.type&&(0,e.createElement)("label",{htmlFor:o,className:"clcf-block-field__label"},c," ",t.required?(0,e.createElement)("abbr",{title:"required"},"*"):null),t.description&&"checkbox"!==t.type?(0,e.createElement)("small",{className:"clcf-block-field__desc"},t.description):null,s)}(0,t.registerPlugin)("clcf-checkout-fields",{render:function(){const t=h.fields||[],[n,i]=(0,c.useState)(()=>function(e){const t={};return e.forEach(e=>{"heading"!==e.type&&(t[e.id]=void 0!==e.default&&null!==e.default?String(e.default):"")}),t}(t)),r=(0,l.useSelect)(e=>{const t=e("wc/store/cart"),n=e("wc/store/payment"),i=t?t.getCartData():{},r=t?t.getCustomerData():{};return{serverCtx:(i&&i.extensions&&i.extensions.clcf?i.extensions.clcf:{}).ctx||{},paymentMethod:n&&n.getActivePaymentMethod?n.getActivePaymentMethod():"",shippingMethod:b(i),billingCountry:r&&r.billingAddress&&r.billingAddress.country||"",shippingCountry:r&&r.shippingAddress&&r.shippingAddress.country||""}},[]),o={...r.serverCtx,paymentMethod:r.paymentMethod,shippingMethod:r.shippingMethod||r.serverCtx.shippingMethod||"",billingCountry:r.billingCountry||r.serverCtx.billingCountry||"",shippingCountry:r.shippingCountry||r.serverCtx.shippingCountry||""},a=function(e,t={}){const n={};Object.keys(e||{}).forEach(t=>{const i=e[t];n[String(t)]=null==i||"object"==typeof i?"":String(i)});const i=t.role?String(t.role):"";return n["@user_role"]=""!==i?i:"guest",(t.cartCategories||[]).forEach(e=>{n["@cart_has_category:"+parseInt(e,10)]="yes"}),(t.cartProducts||[]).forEach(e=>{n["@cart_has_product:"+parseInt(e,10)]="yes"}),n["@cart_qty"]=String(parseInt(t.cartQty||0,10)),n["@cart_subtotal"]=String(Number(t.cartSubtotal||0)),n["@shipping_method"]=String(t.shippingMethod||""),n["@payment_method"]=String(t.paymentMethod||""),n["@billing_country"]=String(t.billingCountry||""),n["@shipping_country"]=String(t.shippingCountry||""),n}(n,o),s=u(t,a);(0,c.useEffect)(()=>{(0,l.dispatch)("wc/store/checkout").setExtensionData("clcf",{fields:n}),y&&"function"==typeof f&&f({namespace:"clcf",data:{fields:n}})},[n]);const d=t.filter(e=>s[e.id]);return d.length?(0,e.createElement)(p,null,(0,e.createElement)("div",{className:"clcf-block-fields clcf-grid"},d.map(t=>(0,e.createElement)(w,{key:t.id,field:t,value:n[t.id]||"",onChange:e=>((e,t)=>i(n=>({...n,[e]:t})))(t.id,e)})))):null},scope:"woocommerce-checkout"})}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,i),o.exports}i.m=t,e=[],i.O=(t,n,r,o)=>{if(!n){var c=1/0;for(d=0;d<e.length;d++){for(var[n,r,o]=e[d],l=!0,a=0;a<n.length;a++)(!1&o||c>=o)&&Object.keys(i.O).every(e=>i.O[e](n[a]))?n.splice(a--,1):(l=!1,o<c&&(c=o));if(l){e.splice(d--,1);var s=r();void 0!==s&&(t=s)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={611:0,2:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[c,l,a]=n,s=0;if(c.some(t=>0!==e[t])){for(r in l)i.o(l,r)&&(i.m[r]=l[r]);if(a)var d=a(i)}for(t&&t(n);s<c.length;s++)o=c[s],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return i.O(d)},n=globalThis.webpackChunkcorelabs_checkout_fields=globalThis.webpackChunkcorelabs_checkout_fields||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=i.O(void 0,[2],()=>i(625));r=i.O(r)})();1 (()=>{"use strict";var e,t={625(){const e=window.React,t=window.wp.plugins,n=["select","radio"];function i(e){return String(e&&"object"==typeof e?e.label||"":null!=e?e:"")}function r(e){if(!e||"object"!=typeof e)return 0;const t=e.price;if("number"!=typeof t&&("string"!=typeof t||""===t.trim()||isNaN(Number(t))))return 0;const n=Number(t);return isNaN(n)||n<=0?0:n}function o(e){return(e&&e.options||[]).some(e=>r(e)>0)}const l=window.wp.element,c=window.wp.data,a=window.wp.i18n;function s(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function d(e,t){if(!e||"object"!=typeof e)return!1;const n=void 0!==t[e.field]&&null!==t[e.field]?String(t[e.field]):"",i=void 0!==e.value&&null!==e.value?String(e.value):"";switch(e.operator){case"is_not":return n!==i;case"contains":return""!==i&&-1!==n.indexOf(i);case"gt":return s(n)&&s(i)&&parseFloat(n)>parseFloat(i);case"lt":return s(n)&&s(i)&&parseFloat(n)<parseFloat(i);default:return n===i}}function u(e,t){const n={};e.forEach(e=>{n[e.id]=e});const i={},r={},o=e=>{if(e in i)return i[e];if(!n[e]||r[e])return!0;r[e]=!0;const l=n[e];let c=function(e,t){if(Array.isArray(e.conditions)&&e.conditions.length){const n=e.conditionAction||"show";if("require"===n)return!0;const i=e.conditions.map(e=>d(e,t)),r="any"===e.conditionMatch?-1!==i.indexOf(!0):-1===i.indexOf(!1);return"hide"===n?!r:r}return function(e,t){if(!e||"object"!=typeof e)return!0;const n=e.action||"show";if("require"===n)return!0;const i=d(e,t);return"hide"===n?!i:i}(e.condition,t)}(l,t);var a;return(a=l,Array.isArray(a.conditions)&&a.conditions.length?a.conditions.map(e=>e.field).filter(Boolean):a.condition&&a.condition.field?[a.condition.field]:[]).forEach(e=>{c=c&&o(e)}),delete r[e],i[e]=c,c},l={};return e.forEach(e=>{l[e.id]=o(e.id)}),l}const{ExperimentalOrderMeta:p,extensionCartUpdate:f}=window.wc.blocksCheckout,m=window.CLCF_BLOCK||{fields:[],ctx:{},sources:[]};function h(e,t){const l=i(t);if(!o(e))return l;const c=function(e,t){const o=function(e,t){if(null==t||""===t||"object"==typeof t)return 0;if(!n.includes(e&&e.type||""))return 0;const o=(e&&e.options||[]).find(e=>i(e)===String(t));return void 0===o?0:r(o)}(e,t);return o>0?o:parseFloat(e&&e.price)||0}(e,l);return c<=0?l:`${l} (${"percent"===e.priceMode?`+${c}%`:`+${function(e){const t=window.wcSettings&&window.wcSettings.currency||{},n="number"==typeof t.minorUnit?t.minorUnit:2,i=t.symbol||"",r=Number(e).toFixed(n);return"right"===t.symbolPosition?`${r}${i}`:`${i}${r}`}(c)}`})`}const g={},y=(m.fields||[]).some(e=>parseFloat(e.price)>0||o(e));function b(e){const t=e&&e.shippingRates||[];for(const e of t)for(const t of e.shipping_rates||[])if(t.selected)return t.rate_id;return""}function v({field:t,value:n,onChange:r}){const o=`clcf_block_${t.id}`,l=t.label||t.id;if("heading"===t.type)return(0,e.createElement)("div",{className:"clcf-block-field clcf-block-field--heading clcf-w-"+("half"===t.width?"half":"full")},(0,e.createElement)("strong",null,l),t.description?(0,e.createElement)("p",{className:"clcf-block-field__desc"},t.description):null);const c={id:o,value:n,required:!!t.required,onChange:e=>r("checkbox"===t.type?e.target.checked?"yes":"":e.target.value)};let s;if("textarea"===t.type)s=(0,e.createElement)("textarea",{...c,rows:3,placeholder:t.placeholder||""});else if("number"===t.type)s=(0,e.createElement)("input",{type:"number",...c,placeholder:t.placeholder||"",min:t.min||void 0,max:t.max||void 0,step:t.step||void 0});else if("checkbox"===t.type)s=(0,e.createElement)("label",{className:"clcf-block-checkbox"},(0,e.createElement)("input",{type:"checkbox",id:o,required:!!t.required,checked:"yes"===n,onChange:c.onChange})," ",l);else if("select"===t.type)s=(0,e.createElement)("select",{...c},(0,e.createElement)("option",{value:""},(0,a.__)("Choose an option","corelabs-checkout-fields")),(t.options||[]).map((n,r)=>(0,e.createElement)("option",{key:r,value:i(n)},h(t,n))));else if("radio"===t.type)s=(0,e.createElement)("span",{className:"clcf-block-radios"},(t.options||[]).map((l,c)=>(0,e.createElement)("label",{key:c},(0,e.createElement)("input",{type:"radio",name:o,value:i(l),checked:n===i(l),onChange:()=>r(i(l)),required:!!t.required})," ",h(t,l))));else if("email"===t.type||"phone"===t.type||"url"===t.type||"time"===t.type){const n={email:"email",phone:"tel",url:"url",time:"time"}[t.type];s=(0,e.createElement)("input",{type:n,...c,placeholder:t.placeholder||""})}else if("date"===t.type)s=(0,e.createElement)("input",{type:"date",...c,min:t.min||void 0,max:t.max||void 0});else if("delivery"===t.type){const[i="",l=""]=String(n||"").split("|"),c=t.timeSlots||[],d=(e,t)=>r(`${e}|${t}`);s=(0,e.createElement)("span",{className:"clcf-block-delivery"},(0,e.createElement)("select",{id:o,required:!!t.required,value:i,onChange:e=>d(e.target.value,l)},(0,e.createElement)("option",{value:""},(0,a.__)("Choose a date","corelabs-checkout-fields")),(t.validDates||[]).map(t=>(0,e.createElement)("option",{key:t.value,value:t.value},t.label))),c.length>0&&(0,e.createElement)("select",{className:"clcf-block-delivery__slot",required:!!t.required,value:l,onChange:e=>d(i,e.target.value)},(0,e.createElement)("option",{value:""},(0,a.__)("Choose a time","corelabs-checkout-fields")),c.map((t,n)=>(0,e.createElement)("option",{key:n,value:t},t))))}else if("file"===t.type){const i=m.upload||{},l=Math.min(10,Math.max(1,parseInt(t.maxFiles,10)||1)),c=String(n||"").split(",").map(e=>e.trim()).filter(Boolean),d=g[t.id]||{},u=async e=>{let n=Array.from(e.target.files||[]);if(!n.length)return;const o=1===l?[]:c.slice(),a=Math.max(0,l-o.length),s=n.length>a;n=n.slice(0,a);const d=n.filter(e=>i.maxMb&&e.size>1048576*i.maxMb);n=n.filter(e=>!i.maxMb||e.size<=1048576*i.maxMb);const u={};for(const e of n)try{const t=new FormData;t.append("file",e);const n={"X-CLCF-Nonce":i.nonce};i.restNonce&&(n["X-WP-Nonce"]=i.restNonce);const r=await fetch(i.url,{method:"POST",headers:n,body:t}),l=await r.json();if(!r.ok||!l.token)throw new Error(l&&l.message||"upload failed");o.push(l.token),u[l.token]=l.name}catch(e){window.alert(e.message||"Upload failed — please try again.")}e.target.value="",d.length?window.alert(`File is too large (max ${i.maxMb} MB).`):s&&window.alert(`Only ${l} files allowed.`),g[t.id]={...g[t.id]||{},...u},r(o.join(","))},p=e=>{r(c.filter(t=>t!==e).join(","))};s=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("input",{type:"file",id:o,accept:i.accept||void 0,multiple:l>1,required:!!t.required&&!c.length,onChange:u}),c.length>0&&(0,e.createElement)("span",{className:"clcf-file-list"},c.map(t=>(0,e.createElement)("span",{key:t,className:"clcf-file-item"},(0,e.createElement)("span",{className:"clcf-file-item__name"},d[t]||(0,a.__)("Attached file","corelabs-checkout-fields")),(0,e.createElement)("button",{type:"button",className:"clcf-file-remove","aria-label":(0,a.__)("Remove file","corelabs-checkout-fields"),onClick:()=>p(t)},"×")))))}else s=(0,e.createElement)("input",{type:"text",...c,placeholder:t.placeholder||"",maxLength:t.maxLength||void 0});return(0,e.createElement)("div",{className:"clcf-block-field clcf-w-"+("half"===t.width?"half":"full")},"checkbox"!==t.type&&(0,e.createElement)("label",{htmlFor:o,className:"clcf-block-field__label"},l," ",t.required?(0,e.createElement)("abbr",{title:"required"},"*"):null),t.description&&"checkbox"!==t.type?(0,e.createElement)("small",{className:"clcf-block-field__desc"},t.description):null,s)}(0,t.registerPlugin)("clcf-checkout-fields",{render:function(){const t=m.fields||[],[n,i]=(0,l.useState)(()=>function(e){const t={};return e.forEach(e=>{"heading"!==e.type&&(t[e.id]=void 0!==e.default&&null!==e.default?String(e.default):"")}),t}(t)),r=(0,c.useSelect)(e=>{const t=e("wc/store/cart"),n=e("wc/store/payment"),i=t?t.getCartData():{},r=t?t.getCustomerData():{};return{serverCtx:(i&&i.extensions&&i.extensions.clcf?i.extensions.clcf:{}).ctx||{},paymentMethod:n&&n.getActivePaymentMethod?n.getActivePaymentMethod():"",shippingMethod:b(i),billingCountry:r&&r.billingAddress&&r.billingAddress.country||"",shippingCountry:r&&r.shippingAddress&&r.shippingAddress.country||""}},[]),o={...r.serverCtx,paymentMethod:r.paymentMethod,shippingMethod:r.shippingMethod||r.serverCtx.shippingMethod||"",billingCountry:r.billingCountry||r.serverCtx.billingCountry||"",shippingCountry:r.shippingCountry||r.serverCtx.shippingCountry||""},a=function(e,t={}){const n={};Object.keys(e||{}).forEach(t=>{const i=e[t];n[String(t)]=null==i||"object"==typeof i?"":String(i)});const i=t.role?String(t.role):"";return n["@user_role"]=""!==i?i:"guest",(t.cartCategories||[]).forEach(e=>{n["@cart_has_category:"+parseInt(e,10)]="yes"}),(t.cartProducts||[]).forEach(e=>{n["@cart_has_product:"+parseInt(e,10)]="yes"}),n["@cart_qty"]=String(parseInt(t.cartQty||0,10)),n["@cart_subtotal"]=String(Number(t.cartSubtotal||0)),n["@shipping_method"]=String(t.shippingMethod||""),n["@payment_method"]=String(t.paymentMethod||""),n["@billing_country"]=String(t.billingCountry||""),n["@shipping_country"]=String(t.shippingCountry||""),n}(n,o),s=u(t,a);(0,l.useEffect)(()=>{(0,c.dispatch)("wc/store/checkout").setExtensionData("clcf",{fields:n}),y&&"function"==typeof f&&f({namespace:"clcf",data:{fields:n}})},[n]);const d=t.filter(e=>s[e.id]);return d.length?(0,e.createElement)(p,null,(0,e.createElement)("div",{className:"clcf-block-fields clcf-grid"},d.map(t=>(0,e.createElement)(v,{key:t.id,field:t,value:n[t.id]||"",onChange:e=>((e,t)=>i(n=>({...n,[e]:t})))(t.id,e)})))):null},scope:"woocommerce-checkout"})}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,i),o.exports}i.m=t,e=[],i.O=(t,n,r,o)=>{if(!n){var l=1/0;for(d=0;d<e.length;d++){for(var[n,r,o]=e[d],c=!0,a=0;a<n.length;a++)(!1&o||l>=o)&&Object.keys(i.O).every(e=>i.O[e](n[a]))?n.splice(a--,1):(c=!1,o<l&&(l=o));if(c){e.splice(d--,1);var s=r();void 0!==s&&(t=s)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={611:0,2:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[l,c,a]=n,s=0;if(l.some(t=>0!==e[t])){for(r in c)i.o(c,r)&&(i.m[r]=c[r]);if(a)var d=a(i)}for(t&&t(n);s<l.length;s++)o=l[s],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return i.O(d)},n=globalThis.webpackChunkcorelabs_checkout_fields=globalThis.webpackChunkcorelabs_checkout_fields||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=i.O(void 0,[2],()=>i(625));r=i.O(r)})(); -
corelabs-checkout-fields/trunk/build/index-rtl.css
r3630465 r3680119 1 :root{--clcf-fs-xs:11px;--clcf-fs-sm:12px;--clcf-fs-md:13px;--clcf-fs-lg:15px;--clcf-fs-xl:17px;--clcf-fw-med:600;--clcf-fw-bold:700;--clcf-flame:#f97316;--clcf-flame-deep:#ea580c;--clcf-flame-soft:#ffedd5;--clcf-flame-border:#fed7aa;--clcf-coal:#1c1917;--clcf-coal-2:#292524;--clcf-ink:#1f2328;--clcf-ink-2:#57606a;--clcf-ink-3:#8b949e;--clcf-bg:#f6f5f4;--clcf-panel:#fff;--clcf-line:#e7e5e4;--clcf-line-2:#d6d3d1;--clcf-green:#10b981;--clcf-green-soft:#d1fae5;--clcf-green-ink:#065f46;--clcf-r:12px;--clcf-r-sm:8px;--clcf-shadow:0 1px 2px rgba(28,25,23,.06),0 8px 24px -12px rgba(28,25,23,.14)}body.clcf-builder-page #wpcontent{padding-right:0}body.clcf-builder-page #wpbody-content{padding-bottom:0}body.clcf-builder-page #wpbody-content>.error,body.clcf-builder-page #wpbody-content>.notice,body.clcf-builder-page #wpbody-content>.update-nag,body.clcf-builder-page #wpfooter{display:none}.clcf-region-tag select,.clcf-sim select,.clcf-tok select{background:none;border:0;height:100%;line-height:1;margin:0;max-width:none;min-height:0;padding:0}.clcf-app{background:var(--clcf-bg);color:var(--clcf-ink);display:flex;flex-direction:column;font-size:var(--clcf-fs-md);height:calc(100vh - 32px);overflow:hidden}.clcf-app *,.clcf-app :after,.clcf-app :before{box-sizing:border-box}.clcf-hdr{background:var(--clcf-coal);color:#fff;container-name:clcf-hdr;container-type:inline-size;flex:none;gap:16px;height:58px;padding:0 20px}.clcf-hdr,.clcf-logo{align-items:center;display:flex}.clcf-logo{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);gap:10px}.clcf-logo .clcf-mark{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:8px;color:#fff;display:flex;height:28px;justify-content:center;width:28px}.clcf-logo .clcf-flame{display:block}.clcf-logo .clcf-sub{color:#a8a29e;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);margin-right:2px}.clcf-hdr>*{flex:none}.clcf-hdr .clcf-grow{flex:1}.clcf-hdr .clcf-logo,.clcf-hdr .clcf-status,.clcf-hdr button{white-space:nowrap}.clcf-uic{display:block;flex:none}.clcf-status{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);gap:7px}.clcf-status .clcf-dot{background:#57534e;border-radius:50%;height:7px;width:7px}.clcf-status.is-dirty .clcf-dot{background:#f59e0b}.clcf-status.is-saved .clcf-dot{background:var(--clcf-green)}.clcf-status.is-error{color:#fca5a5}.clcf-status.is-error .clcf-dot{background:#ef4444}.clcf-btn-ghost{align-items:center;background:transparent;border:1px solid #44403c;border-radius:var(--clcf-r-sm);color:#d6d3d1;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 14px}.clcf-btn-ghost:hover:not(:disabled){border-color:#78716c;color:#fff}.clcf-btn-ghost:disabled{cursor:default;opacity:.4}.clcf-btn-primary{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border:none;border-radius:var(--clcf-r-sm);box-shadow:0 4px 14px -4px rgba(234,88,12,.6);color:#fff;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 18px}.clcf-btn-primary:hover{filter:brightness(1.06)}.clcf-btn-primary:disabled{cursor:default;opacity:.6}@container clcf-hdr (max-width: 760px){.clcf-status .clcf-lbl-wide{display:none}.clcf-status{gap:0}}@container clcf-hdr (max-width: 640px){.clcf-hdr button .clcf-lbl-wide{display:none}.clcf-hdr .clcf-btn-ghost{padding:0 11px}}.clcf-hdr .clcf-support .clcf-uic{color:#fb7185}.clcf-hdr .clcf-support:hover{border-color:#fb7185;color:#fff}.clcf-support-modal{max-width:540px}.clcf-support-modal p{color:var(--clcf-ink-2);font-size:var(--clcf-fs-md);line-height:1.65;margin:0 0 14px}.clcf-support-actions{align-items:center;display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.clcf-support-actions a{text-decoration:none}.clcf-linkbtn{background:none;border:0;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 6px}.clcf-linkbtn:hover{text-decoration:underline}.clcf-support-actions .clcf-linkbtn{margin-right:auto}.clcf-btn-ghost.is-light{background:#fff;border-color:var(--clcf-line-2);color:var(--clcf-ink-2)}.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-primary,a.clcf-btn-primary:active,a.clcf-btn-primary:focus,a.clcf-btn-primary:hover{color:#fff;text-decoration:none}a.clcf-btn-ghost,a.clcf-btn-ghost:active,a.clcf-btn-ghost:focus,a.clcf-btn-ghost:hover{box-shadow:none;text-decoration:none}a.clcf-btn-ghost.is-light,a.clcf-btn-ghost.is-light:focus{color:var(--clcf-ink-2)}a.clcf-btn-ghost.is-light:active,a.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-ghost:focus-visible,a.clcf-btn-primary:focus-visible{outline:2px solid var(--clcf-flame);outline-offset:2px}.clcf-work{display:grid;flex:1;grid-template-columns:252px 1fr 340px;min-height:0}@media (max-width:1100px){.clcf-work{grid-template-columns:220px 1fr 300px}}.clcf-sec-label{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.08em;margin:4px 6px 10px;text-transform:uppercase}.clcf-palette{background:var(--clcf-panel);border-left:1px solid var(--clcf-line);overflow-y:auto;padding:18px 14px}.clcf-ptypes{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:22px}.clcf-ptype{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;display:flex;flex-direction:column;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:72px;justify-content:center}.clcf-ptype:hover{border-color:var(--clcf-flame-border);box-shadow:var(--clcf-shadow)}.clcf-ptype .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:7px;color:var(--clcf-flame-deep);display:flex;height:26px;justify-content:center;width:26px}.clcf-fic{display:block}.clcf-tpl{border:1px dashed var(--clcf-line-2);border-radius:var(--clcf-r);padding:12px}.clcf-tpl h4{font-size:var(--clcf-fs-md);margin:0 0 4px}.clcf-tpl p{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);line-height:1.45;margin:0 0 9px}.clcf-tpl .clcf-chips{display:flex;flex-wrap:wrap;gap:6px}.clcf-chip{background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;color:var(--clcf-flame-deep);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 9px}.clcf-chip:hover{background:#fee7cd}.clcf-canvas-col{display:flex;flex-direction:column;min-height:0}.clcf-simbar{align-items:center;background:var(--clcf-coal-2);border-radius:var(--clcf-r);color:#d6d3d1;display:flex;flex:none;flex-wrap:wrap;gap:10px;margin:16px 22px 0;padding:10px 14px}.clcf-simbar .clcf-lbl{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;letter-spacing:.04em}.clcf-simbar .clcf-lbl .clcf-eye{background:var(--clcf-flame);border-radius:5px;height:16px;width:16px}.clcf-sim{align-items:center;background:hsla(0,0%,100%,.08);border:1px solid hsla(0,0%,100%,.14);border-radius:999px;color:#e7e5e4;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:30px;padding:0 11px;position:relative}.clcf-sim select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-sim.is-active{background:rgba(249,115,22,.18);border-color:rgba(249,115,22,.55);color:#fdba74}.clcf-sim .clcf-car{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid;height:0;opacity:.7;width:0}.clcf-simbar .clcf-hint{color:#78716c;font-size:var(--clcf-fs-sm);margin-right:auto}.clcf-canvas{flex:1;overflow-y:auto;padding:16px 22px 22px}.clcf-sheet{background:var(--clcf-panel);border:1px solid var(--clcf-line);border-radius:16px;box-shadow:var(--clcf-shadow);margin:0 auto;max-width:660px;padding:26px 30px}.clcf-shead{align-items:center;display:flex;justify-content:space-between;margin-bottom:18px}.clcf-shead h2{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);margin:0}.clcf-region-tag{border:1px dashed var(--clcf-line-2);border-radius:999px;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 11px;position:relative}.clcf-region-tag select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-wcrow{display:flex;gap:12px;margin-bottom:12px}.clcf-wcph{flex:1}.clcf-wcph .clcf-cap{background:#ece9e6;border-radius:5px;height:9px;margin-bottom:7px;width:34%}.clcf-wcph .clcf-box{background:#f3f1ef;border:1px solid #e9e6e3;border-radius:9px;height:34px}.clcf-fgrid{display:grid;gap:14px 12px;grid-template-columns:1fr 1fr;margin-top:6px}.clcf-fld{background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);cursor:pointer;padding:12px 14px 13px;position:relative}.clcf-fld.clcf-w-full{grid-column:1/-1}.clcf-fld:hover{border-color:var(--clcf-flame-border)}.clcf-fld.is-selected{border:2px solid var(--clcf-flame);box-shadow:0 0 0 4px rgba(249,115,22,.12),var(--clcf-shadow);padding:11px 13px 12px}.clcf-fld.is-dragging{opacity:.45}.clcf-fld.is-drop-target{outline:2px dashed var(--clcf-flame-border);outline-offset:3px}.clcf-fld .clcf-flabel{align-items:center;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:6px;margin-bottom:7px}.clcf-fld .clcf-req{color:#dc2626}.clcf-fld .clcf-fdesc{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);margin:-3px 0 7px}.clcf-fld .clcf-input{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:9px;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-md);min-height:36px;padding:6px 12px}.clcf-fld .clcf-input--area{align-items:flex-start;min-height:58px}.clcf-fld .clcf-input--check{justify-content:center;width:36px}.clcf-fld .clcf-opts{color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:10px}.clcf-fld .clcf-opts .clcf-radio{border:2px solid var(--clcf-line-2);border-radius:50%;display:inline-block;height:15px;margin-left:5px;vertical-align:-3px;width:15px}.clcf-fld .clcf-heading-preview{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold)}.clcf-fld .clcf-grip{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:7px;box-shadow:var(--clcf-shadow);color:var(--clcf-ink-3);cursor:grab;display:flex;font-size:var(--clcf-fs-sm);height:30px;justify-content:center;right:-13px;position:absolute;top:50%;transform:translateY(-50%);width:22px}.clcf-fld .clcf-ops{display:flex;gap:4px;position:absolute;left:10px;top:-13px}.clcf-op{align-items:center;background:var(--clcf-coal);border:none;border-radius:7px;box-shadow:0 4px 10px -2px rgba(28,25,23,.4);color:#fff;cursor:pointer;display:flex;font-size:var(--clcf-fs-sm);height:26px;justify-content:center;width:26px}.clcf-op:hover{background:var(--clcf-flame-deep)}.clcf-logic-flag{align-items:center;background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;bottom:-11px;color:var(--clcf-flame-deep);display:inline-flex;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);gap:6px;right:12px;letter-spacing:.03em;max-width:90%;overflow:hidden;padding:3px 9px;position:absolute;text-overflow:ellipsis;white-space:nowrap;z-index:1}.clcf-hiddenbar{align-items:center;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-med);gap:9px;margin-top:18px}.clcf-hiddenbar .clcf-line{background:var(--clcf-line);flex:1;height:1px}.clcf-fld.is-ghost{background:#fafaf9;border:1.5px dashed var(--clcf-line-2);opacity:.75}.clcf-fld.is-ghost .clcf-flabel{color:var(--clcf-ink-3)}.clcf-fld.is-ghost .clcf-input{background:#f5f5f4;border-style:dashed}.clcf-empty{color:var(--clcf-ink-2);margin:60px auto 0;max-width:480px;text-align:center}.clcf-empty .clcf-empty-ic{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:18px;box-shadow:0 14px 30px -10px rgba(234,88,12,.5);color:#fff;display:flex;font-size:26px;font-weight:var(--clcf-fw-bold);height:64px;justify-content:center;margin:0 auto 18px;width:64px}.clcf-empty h3{color:var(--clcf-ink);font-size:var(--clcf-fs-xl);margin:0 0 8px}.clcf-empty p{font-size:var(--clcf-fs-md);line-height:1.55;margin:0}.clcf-settings{background:var(--clcf-panel);border-right:1px solid var(--clcf-line);display:flex;flex-direction:column;min-height:0}.clcf-sp-head{flex:none;padding:16px 18px 0}.clcf-sp-title{align-items:center;display:flex;gap:10px;margin-bottom:14px}.clcf-sp-title .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:8px;color:var(--clcf-flame-deep);display:flex;flex:none;height:30px;justify-content:center;width:30px}.clcf-input--icon{align-items:center;display:flex;gap:7px}.clcf-sp-title h3{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);line-height:1.25;margin:0}.clcf-sp-title small{color:var(--clcf-ink-3);display:block;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-med)}.clcf-tabs{border-bottom:1px solid var(--clcf-line);display:flex;gap:2px}.clcf-tab{background:none;border:none;border-bottom:2px solid transparent;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:9px 13px}.clcf-tab.is-on{border-bottom-color:var(--clcf-flame);color:var(--clcf-flame-deep)}.clcf-sp-body{flex:1;overflow-y:auto;padding:16px 18px}.clcf-sp-empty{color:var(--clcf-ink-3);font-size:var(--clcf-fs-md);line-height:1.6;padding:40px 24px;text-align:center}.clcf-sp-foot{align-items:center;border-top:1px solid var(--clcf-line);color:var(--clcf-ink-3);display:flex;flex:none;font-size:var(--clcf-fs-sm);gap:8px;padding:13px 18px}.clcf-kbd{background:#fff;border:1px solid var(--clcf-line-2);border-radius:5px;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:2px 6px}.clcf-sp-body .components-base-control{margin-bottom:14px}.clcf-sp-body .components-base-control__label{color:var(--clcf-ink-2);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.05em;text-transform:uppercase}.clcf-sp-body .components-select-control__input,.clcf-sp-body .components-text-control__input,.clcf-sp-body .components-textarea-control__input{border-color:var(--clcf-line-2);border-radius:var(--clcf-r-sm)}.clcf-sp-body .components-text-control__input:focus,.clcf-sp-body .components-textarea-control__input:focus{border-color:var(--clcf-flame);box-shadow:0 0 0 1px var(--clcf-flame)}.clcf-rule-card{background:#fafaf9;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);padding:13px 14px}.clcf-rule-when{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-sentence{align-items:center;color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:6px}.clcf-sentence+.clcf-sentence{margin-top:8px}.clcf-tok{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:8px;color:var(--clcf-ink);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:6px;padding:5px 10px;position:relative}.clcf-tok select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-tok input{background:transparent;border:none;color:inherit;font:inherit;outline:none;padding:0;width:72px}.clcf-tok.clcf-tok--src{background:var(--clcf-flame-soft);border-color:var(--clcf-flame-border);color:var(--clcf-flame-deep)}.clcf-tok.clcf-tok--val{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}.clcf-tok .clcf-car{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid;height:0;opacity:.55;width:0}.clcf-rule-x{background:none;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 4px}.clcf-rule-x:hover{color:#dc2626}.clcf-andor{border:1px solid var(--clcf-line-2);border-radius:8px;display:inline-flex;margin:10px 0;overflow:hidden}.clcf-andor button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:5px 13px}.clcf-andor button.is-on{background:var(--clcf-coal);color:#fff}.clcf-addrule{align-items:center;background:none;border:none;color:var(--clcf-flame-deep);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;margin-top:11px;padding:0}.clcf-then{margin-top:16px}.clcf-then-lbl{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-seg{border:1px solid var(--clcf-line-2);border-radius:9px;display:flex;overflow:hidden}.clcf-seg button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;flex:1;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:8px 0;text-align:center}.clcf-seg button.is-on{background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));color:#fff}.clcf-widthpick{display:flex;gap:10px;margin-bottom:16px}.clcf-widthpick button{background:#fff;border:1px solid var(--clcf-line-2);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;flex:1;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:10px}.clcf-widthpick button.is-on{border-color:var(--clcf-flame);box-shadow:0 0 0 3px rgba(249,115,22,.12);color:var(--clcf-flame-deep)}.clcf-widthpick .clcf-diagram{display:flex;gap:4px;margin-bottom:7px}.clcf-widthpick .clcf-diagram span{background:var(--clcf-line);border-radius:4px;flex:1;height:12px}.clcf-widthpick .clcf-diagram span.is-hl{background:var(--clcf-flame)}.clcf-optrow{align-items:flex-end;display:flex;gap:6px;margin-bottom:6px}.clcf-optrow .components-base-control{flex:1;margin-bottom:0!important}.clcf-optrow .clcf-optprice{flex:0 0 84px}.clcf-optrow .clcf-optprice .components-base-control{flex:none}.clcf-opthelp{color:#646970;font-size:var(--clcf-fs-sm);margin:8px 0 0} 1 :root{--clcf-fs-xs:11px;--clcf-fs-sm:12px;--clcf-fs-md:13px;--clcf-fs-lg:15px;--clcf-fs-xl:17px;--clcf-fw-med:600;--clcf-fw-bold:700;--clcf-flame:#f97316;--clcf-flame-deep:#ea580c;--clcf-flame-soft:#ffedd5;--clcf-flame-border:#fed7aa;--clcf-coal:#1c1917;--clcf-coal-2:#292524;--clcf-ink:#1f2328;--clcf-ink-2:#57606a;--clcf-ink-3:#8b949e;--clcf-bg:#f6f5f4;--clcf-panel:#fff;--clcf-line:#e7e5e4;--clcf-line-2:#d6d3d1;--clcf-green:#10b981;--clcf-green-soft:#d1fae5;--clcf-green-ink:#065f46;--clcf-r:12px;--clcf-r-sm:8px;--clcf-shadow:0 1px 2px rgba(28,25,23,.06),0 8px 24px -12px rgba(28,25,23,.14)}body.clcf-builder-page #wpcontent{padding-right:0}body.clcf-builder-page #wpbody-content{padding-bottom:0}body.clcf-builder-page #wpbody-content>.error,body.clcf-builder-page #wpbody-content>.notice,body.clcf-builder-page #wpbody-content>.update-nag,body.clcf-builder-page #wpfooter{display:none}.clcf-region-tag select,.clcf-sim select,.clcf-tok select{background:none;border:0;height:100%;line-height:1;margin:0;max-width:none;min-height:0;padding:0}.clcf-app{background:var(--clcf-bg);color:var(--clcf-ink);display:flex;flex-direction:column;font-size:var(--clcf-fs-md);height:calc(100vh - 32px);overflow:hidden}.clcf-app *,.clcf-app :after,.clcf-app :before{box-sizing:border-box}.clcf-hdr{background:var(--clcf-coal);color:#fff;container-name:clcf-hdr;container-type:inline-size;flex:none;gap:16px;height:58px;padding:0 20px}.clcf-hdr,.clcf-logo{align-items:center;display:flex}.clcf-logo{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);gap:10px}.clcf-logo .clcf-mark{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:8px;color:#fff;display:flex;height:28px;justify-content:center;width:28px}.clcf-logo .clcf-flame{display:block}.clcf-logo .clcf-sub{color:#a8a29e;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);margin-right:2px}.clcf-hdr>*{flex:none}.clcf-hdr .clcf-grow{flex:1}.clcf-hdr .clcf-logo,.clcf-hdr .clcf-status,.clcf-hdr button{white-space:nowrap}.clcf-uic{display:block;flex:none}.clcf-status{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);gap:7px}.clcf-status .clcf-dot{background:#57534e;border-radius:50%;height:7px;width:7px}.clcf-status.is-dirty .clcf-dot{background:#f59e0b}.clcf-status.is-saved .clcf-dot{background:var(--clcf-green)}.clcf-status.is-error{color:#fca5a5}.clcf-status.is-error .clcf-dot{background:#ef4444}.clcf-btn-ghost{align-items:center;background:transparent;border:1px solid #44403c;border-radius:var(--clcf-r-sm);color:#d6d3d1;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 14px}.clcf-btn-ghost:hover:not(:disabled){border-color:#78716c;color:#fff}.clcf-btn-ghost:disabled{cursor:default;opacity:.4}.clcf-btn-primary{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border:none;border-radius:var(--clcf-r-sm);box-shadow:0 4px 14px -4px rgba(234,88,12,.6);color:#fff;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 18px}.clcf-btn-primary:hover{filter:brightness(1.06)}.clcf-btn-primary:disabled{cursor:default;opacity:.6}@container clcf-hdr (max-width: 760px){.clcf-status .clcf-lbl-wide{display:none}.clcf-status{gap:0}}@container clcf-hdr (max-width: 640px){.clcf-hdr button .clcf-lbl-wide{display:none}.clcf-hdr .clcf-btn-ghost{padding:0 11px}}.clcf-hdr .clcf-support .clcf-uic{color:#fb7185}.clcf-hdr .clcf-support:hover{border-color:#fb7185;color:#fff}.clcf-support-modal{max-width:540px}.clcf-support-modal p{color:var(--clcf-ink-2);font-size:var(--clcf-fs-md);line-height:1.65;margin:0 0 14px}.clcf-support-actions{align-items:center;display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.clcf-support-actions a{text-decoration:none}.clcf-linkbtn{background:none;border:0;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 6px}.clcf-linkbtn:hover{text-decoration:underline}.clcf-support-actions .clcf-linkbtn{margin-right:auto}.clcf-btn-ghost.is-light{background:#fff;border-color:var(--clcf-line-2);color:var(--clcf-ink-2)}.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-primary,a.clcf-btn-primary:active,a.clcf-btn-primary:focus,a.clcf-btn-primary:hover{color:#fff;text-decoration:none}a.clcf-btn-ghost,a.clcf-btn-ghost:active,a.clcf-btn-ghost:focus,a.clcf-btn-ghost:hover{box-shadow:none;text-decoration:none}a.clcf-btn-ghost.is-light,a.clcf-btn-ghost.is-light:focus{color:var(--clcf-ink-2)}a.clcf-btn-ghost.is-light:active,a.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-ghost:focus-visible,a.clcf-btn-primary:focus-visible{outline:2px solid var(--clcf-flame);outline-offset:2px}.clcf-work{display:grid;flex:1;grid-template-columns:252px 1fr 340px;min-height:0}@media (max-width:1100px){.clcf-work{grid-template-columns:220px 1fr 300px}}.clcf-sec-label{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.08em;margin:4px 6px 10px;text-transform:uppercase}.clcf-palette{background:var(--clcf-panel);border-left:1px solid var(--clcf-line);overflow-y:auto;padding:18px 14px}.clcf-ptypes{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:22px}.clcf-ptype{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;display:flex;flex-direction:column;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:72px;justify-content:center}.clcf-ptype:hover{border-color:var(--clcf-flame-border);box-shadow:var(--clcf-shadow)}.clcf-ptype .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:7px;color:var(--clcf-flame-deep);display:flex;height:26px;justify-content:center;width:26px}.clcf-fic{display:block}.clcf-tpl{border:1px dashed var(--clcf-line-2);border-radius:var(--clcf-r);padding:12px}.clcf-tpl h4{font-size:var(--clcf-fs-md);margin:0 0 4px}.clcf-tpl p{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);line-height:1.45;margin:0 0 9px}.clcf-tpl .clcf-chips{display:flex;flex-wrap:wrap;gap:6px}.clcf-chip{background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;color:var(--clcf-flame-deep);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 9px}.clcf-chip:hover{background:#fee7cd}.clcf-canvas-col{display:flex;flex-direction:column;min-height:0}.clcf-simbar{align-items:center;background:var(--clcf-coal-2);border-radius:var(--clcf-r);color:#d6d3d1;display:flex;flex:none;flex-wrap:wrap;gap:10px;margin:16px 22px 0;padding:10px 14px}.clcf-simbar .clcf-lbl{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;letter-spacing:.04em}.clcf-simbar .clcf-lbl .clcf-eye{background:var(--clcf-flame);border-radius:5px;height:16px;width:16px}.clcf-sim{align-items:center;background:hsla(0,0%,100%,.08);border:1px solid hsla(0,0%,100%,.14);border-radius:999px;color:#e7e5e4;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:30px;padding:0 11px;position:relative}.clcf-sim select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-sim.is-active{background:rgba(249,115,22,.18);border-color:rgba(249,115,22,.55);color:#fdba74}.clcf-sim .clcf-car{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid;height:0;opacity:.7;width:0}.clcf-simbar .clcf-hint{color:#78716c;font-size:var(--clcf-fs-sm);margin-right:auto}.clcf-canvas{flex:1;overflow-y:auto;padding:16px 22px 22px}.clcf-sheet{background:var(--clcf-panel);border:1px solid var(--clcf-line);border-radius:16px;box-shadow:var(--clcf-shadow);margin:0 auto;max-width:660px;padding:26px 30px}.clcf-shead{align-items:center;display:flex;justify-content:space-between;margin-bottom:18px}.clcf-shead h2{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);margin:0}.clcf-region-tag{border:1px dashed var(--clcf-line-2);border-radius:999px;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 11px;position:relative}.clcf-region-tag select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-wcrow{display:flex;gap:12px;margin-bottom:12px}.clcf-wcph{flex:1}.clcf-wcph .clcf-cap{background:#ece9e6;border-radius:5px;height:9px;margin-bottom:7px;width:34%}.clcf-wcph .clcf-box{background:#f3f1ef;border:1px solid #e9e6e3;border-radius:9px;height:34px}.clcf-fgrid{display:grid;gap:14px 12px;grid-template-columns:1fr 1fr;margin-top:6px}.clcf-fld{background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);cursor:pointer;padding:12px 14px 13px;position:relative}.clcf-fld.clcf-w-full{grid-column:1/-1}.clcf-fld:hover{border-color:var(--clcf-flame-border)}.clcf-fld.is-selected{border:2px solid var(--clcf-flame);box-shadow:0 0 0 4px rgba(249,115,22,.12),var(--clcf-shadow);padding:11px 13px 12px}.clcf-fld.is-dragging{opacity:.45}.clcf-fld.is-drop-target{outline:2px dashed var(--clcf-flame-border);outline-offset:3px}.clcf-fld .clcf-flabel{align-items:center;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:6px;margin-bottom:7px}.clcf-fld .clcf-req{color:#dc2626}.clcf-fld .clcf-fdesc{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);margin:-3px 0 7px}.clcf-fld .clcf-input{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:9px;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-md);min-height:36px;padding:6px 12px}.clcf-fld .clcf-input--area{align-items:flex-start;min-height:58px}.clcf-fld .clcf-input--check{justify-content:center;width:36px}.clcf-fld .clcf-opts{color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:10px}.clcf-fld .clcf-opts .clcf-radio{border:2px solid var(--clcf-line-2);border-radius:50%;display:inline-block;height:15px;margin-left:5px;vertical-align:-3px;width:15px}.clcf-fld .clcf-heading-preview{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold)}.clcf-fld .clcf-grip{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:7px;box-shadow:var(--clcf-shadow);color:var(--clcf-ink-3);cursor:grab;display:flex;font-size:var(--clcf-fs-sm);height:30px;justify-content:center;right:-13px;position:absolute;top:50%;transform:translateY(-50%);width:22px}.clcf-fld .clcf-ops{display:flex;gap:4px;position:absolute;left:10px;top:-13px}.clcf-op{align-items:center;background:var(--clcf-coal);border:none;border-radius:7px;box-shadow:0 4px 10px -2px rgba(28,25,23,.4);color:#fff;cursor:pointer;display:flex;font-size:var(--clcf-fs-sm);height:26px;justify-content:center;width:26px}.clcf-op:hover{background:var(--clcf-flame-deep)}.clcf-logic-flag{align-items:center;background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;bottom:-11px;color:var(--clcf-flame-deep);display:inline-flex;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);gap:6px;right:12px;letter-spacing:.03em;max-width:90%;overflow:hidden;padding:3px 9px;position:absolute;text-overflow:ellipsis;white-space:nowrap;z-index:1}.clcf-hiddenbar{align-items:center;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-med);gap:9px;margin-top:18px}.clcf-hiddenbar .clcf-line{background:var(--clcf-line);flex:1;height:1px}.clcf-fld.is-ghost{background:#fafaf9;border:1.5px dashed var(--clcf-line-2);opacity:.75}.clcf-fld.is-ghost .clcf-flabel{color:var(--clcf-ink-3)}.clcf-fld.is-ghost .clcf-input{background:#f5f5f4;border-style:dashed}.clcf-empty{color:var(--clcf-ink-2);margin:60px auto 0;max-width:480px;text-align:center}.clcf-empty .clcf-empty-ic{align-items:center;background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:18px;box-shadow:0 14px 30px -10px rgba(234,88,12,.5);color:#fff;display:flex;font-size:26px;font-weight:var(--clcf-fw-bold);height:64px;justify-content:center;margin:0 auto 18px;width:64px}.clcf-empty h3{color:var(--clcf-ink);font-size:var(--clcf-fs-xl);margin:0 0 8px}.clcf-empty p{font-size:var(--clcf-fs-md);line-height:1.55;margin:0}.clcf-settings{background:var(--clcf-panel);border-right:1px solid var(--clcf-line);display:flex;flex-direction:column;min-height:0}.clcf-sp-head{flex:none;padding:16px 18px 0}.clcf-sp-title{align-items:center;display:flex;gap:10px;margin-bottom:14px}.clcf-sp-title .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:8px;color:var(--clcf-flame-deep);display:flex;flex:none;height:30px;justify-content:center;width:30px}.clcf-input--icon{align-items:center;display:flex;gap:7px}.clcf-sp-title h3{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);line-height:1.25;margin:0}.clcf-sp-title small{color:var(--clcf-ink-3);display:block;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-med)}.clcf-tabs{border-bottom:1px solid var(--clcf-line);display:flex;gap:2px}.clcf-tab{background:none;border:none;border-bottom:2px solid transparent;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:9px 13px}.clcf-tab.is-on{border-bottom-color:var(--clcf-flame);color:var(--clcf-flame-deep)}.clcf-sp-body{flex:1;overflow-y:auto;padding:16px 18px}.clcf-sp-empty{color:var(--clcf-ink-3);font-size:var(--clcf-fs-md);line-height:1.6;padding:40px 24px;text-align:center}.clcf-sp-foot{align-items:center;border-top:1px solid var(--clcf-line);color:var(--clcf-ink-3);display:flex;flex:none;font-size:var(--clcf-fs-sm);gap:8px;padding:13px 18px}.clcf-kbd{background:#fff;border:1px solid var(--clcf-line-2);border-radius:5px;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:2px 6px}.clcf-sp-body .components-base-control{margin-bottom:14px}.clcf-sp-body .components-base-control__label{color:var(--clcf-ink-2);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.05em;text-transform:uppercase}.clcf-sp-body .components-select-control__input,.clcf-sp-body .components-text-control__input,.clcf-sp-body .components-textarea-control__input{border-color:var(--clcf-line-2);border-radius:var(--clcf-r-sm)}.clcf-sp-body .components-text-control__input:focus,.clcf-sp-body .components-textarea-control__input:focus{border-color:var(--clcf-flame);box-shadow:0 0 0 1px var(--clcf-flame)}.clcf-rule-card{background:#fafaf9;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);padding:13px 14px}.clcf-rule-when{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-sentence{align-items:center;color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:6px}.clcf-sentence+.clcf-sentence{margin-top:8px}.clcf-tok{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:8px;color:var(--clcf-ink);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:6px;padding:5px 10px;position:relative}.clcf-tok select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-tok input{background:transparent;border:none;color:inherit;font:inherit;outline:none;padding:0;width:72px}.clcf-tok.clcf-tok--src{background:var(--clcf-flame-soft);border-color:var(--clcf-flame-border);color:var(--clcf-flame-deep)}.clcf-tok.clcf-tok--val{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}.clcf-tok .clcf-car{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid;height:0;opacity:.55;width:0}.clcf-rule-x{background:none;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 4px}.clcf-rule-x:hover{color:#dc2626}.clcf-andor{border:1px solid var(--clcf-line-2);border-radius:8px;display:inline-flex;margin:10px 0;overflow:hidden}.clcf-andor button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:5px 13px}.clcf-andor button.is-on{background:var(--clcf-coal);color:#fff}.clcf-addrule{align-items:center;background:none;border:none;color:var(--clcf-flame-deep);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;margin-top:11px;padding:0}.clcf-then{margin-top:16px}.clcf-then-lbl{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-seg{border:1px solid var(--clcf-line-2);border-radius:9px;display:flex;overflow:hidden}.clcf-seg button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;flex:1;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:8px 0;text-align:center}.clcf-seg button.is-on{background:linear-gradient(-135deg,var(--clcf-flame),var(--clcf-flame-deep));color:#fff}.clcf-widthpick{display:flex;gap:10px;margin-bottom:16px}.clcf-widthpick button{background:#fff;border:1px solid var(--clcf-line-2);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;flex:1;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:10px}.clcf-widthpick button.is-on{border-color:var(--clcf-flame);box-shadow:0 0 0 3px rgba(249,115,22,.12);color:var(--clcf-flame-deep)}.clcf-widthpick .clcf-diagram{display:flex;gap:4px;margin-bottom:7px}.clcf-widthpick .clcf-diagram span{background:var(--clcf-line);border-radius:4px;flex:1;height:12px}.clcf-widthpick .clcf-diagram span.is-hl{background:var(--clcf-flame)}.clcf-optrow{align-items:flex-end;display:flex;gap:6px;margin-bottom:6px}.clcf-optrow .components-base-control{flex:1;margin-bottom:0!important}.clcf-optrow .clcf-optprice{flex:0 0 84px}.clcf-optrow .clcf-optprice .components-base-control{flex:none}.clcf-opthelp{color:#646970;font-size:var(--clcf-fs-sm);margin:8px 0 0}.clcf-delivery-cfg .clcf-cfg-label{font-size:12px;font-weight:600;margin:12px 0 6px}.clcf-weekdays{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:4px}.clcf-weekday{align-items:center;display:inline-flex;font-size:12px;gap:4px}.clcf-cfg-row{align-items:center;display:flex;gap:6px;margin-bottom:4px}.clcf-cfg-row .components-base-control{flex:1;margin-bottom:0}.clcf-cfg-row input[type=date]{flex:1} -
corelabs-checkout-fields/trunk/build/index.asset.php
r3630465 r3680119 1 <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => ' 756733100ae5a280cfb5');1 <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'ff4dfe44ce8789289f30'); -
corelabs-checkout-fields/trunk/build/index.css
r3630465 r3680119 1 :root{--clcf-fs-xs:11px;--clcf-fs-sm:12px;--clcf-fs-md:13px;--clcf-fs-lg:15px;--clcf-fs-xl:17px;--clcf-fw-med:600;--clcf-fw-bold:700;--clcf-flame:#f97316;--clcf-flame-deep:#ea580c;--clcf-flame-soft:#ffedd5;--clcf-flame-border:#fed7aa;--clcf-coal:#1c1917;--clcf-coal-2:#292524;--clcf-ink:#1f2328;--clcf-ink-2:#57606a;--clcf-ink-3:#8b949e;--clcf-bg:#f6f5f4;--clcf-panel:#fff;--clcf-line:#e7e5e4;--clcf-line-2:#d6d3d1;--clcf-green:#10b981;--clcf-green-soft:#d1fae5;--clcf-green-ink:#065f46;--clcf-r:12px;--clcf-r-sm:8px;--clcf-shadow:0 1px 2px rgba(28,25,23,.06),0 8px 24px -12px rgba(28,25,23,.14)}body.clcf-builder-page #wpcontent{padding-left:0}body.clcf-builder-page #wpbody-content{padding-bottom:0}body.clcf-builder-page #wpbody-content>.error,body.clcf-builder-page #wpbody-content>.notice,body.clcf-builder-page #wpbody-content>.update-nag,body.clcf-builder-page #wpfooter{display:none}.clcf-region-tag select,.clcf-sim select,.clcf-tok select{background:none;border:0;height:100%;line-height:1;margin:0;max-width:none;min-height:0;padding:0}.clcf-app{background:var(--clcf-bg);color:var(--clcf-ink);display:flex;flex-direction:column;font-size:var(--clcf-fs-md);height:calc(100vh - 32px);overflow:hidden}.clcf-app *,.clcf-app :after,.clcf-app :before{box-sizing:border-box}.clcf-hdr{background:var(--clcf-coal);color:#fff;container-name:clcf-hdr;container-type:inline-size;flex:none;gap:16px;height:58px;padding:0 20px}.clcf-hdr,.clcf-logo{align-items:center;display:flex}.clcf-logo{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);gap:10px}.clcf-logo .clcf-mark{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:8px;color:#fff;display:flex;height:28px;justify-content:center;width:28px}.clcf-logo .clcf-flame{display:block}.clcf-logo .clcf-sub{color:#a8a29e;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);margin-left:2px}.clcf-hdr>*{flex:none}.clcf-hdr .clcf-grow{flex:1}.clcf-hdr .clcf-logo,.clcf-hdr .clcf-status,.clcf-hdr button{white-space:nowrap}.clcf-uic{display:block;flex:none}.clcf-status{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);gap:7px}.clcf-status .clcf-dot{background:#57534e;border-radius:50%;height:7px;width:7px}.clcf-status.is-dirty .clcf-dot{background:#f59e0b}.clcf-status.is-saved .clcf-dot{background:var(--clcf-green)}.clcf-status.is-error{color:#fca5a5}.clcf-status.is-error .clcf-dot{background:#ef4444}.clcf-btn-ghost{align-items:center;background:transparent;border:1px solid #44403c;border-radius:var(--clcf-r-sm);color:#d6d3d1;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 14px}.clcf-btn-ghost:hover:not(:disabled){border-color:#78716c;color:#fff}.clcf-btn-ghost:disabled{cursor:default;opacity:.4}.clcf-btn-primary{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border:none;border-radius:var(--clcf-r-sm);box-shadow:0 4px 14px -4px rgba(234,88,12,.6);color:#fff;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 18px}.clcf-btn-primary:hover{filter:brightness(1.06)}.clcf-btn-primary:disabled{cursor:default;opacity:.6}@container clcf-hdr (max-width: 760px){.clcf-status .clcf-lbl-wide{display:none}.clcf-status{gap:0}}@container clcf-hdr (max-width: 640px){.clcf-hdr button .clcf-lbl-wide{display:none}.clcf-hdr .clcf-btn-ghost{padding:0 11px}}.clcf-hdr .clcf-support .clcf-uic{color:#fb7185}.clcf-hdr .clcf-support:hover{border-color:#fb7185;color:#fff}.clcf-support-modal{max-width:540px}.clcf-support-modal p{color:var(--clcf-ink-2);font-size:var(--clcf-fs-md);line-height:1.65;margin:0 0 14px}.clcf-support-actions{align-items:center;display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.clcf-support-actions a{text-decoration:none}.clcf-linkbtn{background:none;border:0;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 6px}.clcf-linkbtn:hover{text-decoration:underline}.clcf-support-actions .clcf-linkbtn{margin-left:auto}.clcf-btn-ghost.is-light{background:#fff;border-color:var(--clcf-line-2);color:var(--clcf-ink-2)}.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-primary,a.clcf-btn-primary:active,a.clcf-btn-primary:focus,a.clcf-btn-primary:hover{color:#fff;text-decoration:none}a.clcf-btn-ghost,a.clcf-btn-ghost:active,a.clcf-btn-ghost:focus,a.clcf-btn-ghost:hover{box-shadow:none;text-decoration:none}a.clcf-btn-ghost.is-light,a.clcf-btn-ghost.is-light:focus{color:var(--clcf-ink-2)}a.clcf-btn-ghost.is-light:active,a.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-ghost:focus-visible,a.clcf-btn-primary:focus-visible{outline:2px solid var(--clcf-flame);outline-offset:2px}.clcf-work{display:grid;flex:1;grid-template-columns:252px 1fr 340px;min-height:0}@media (max-width:1100px){.clcf-work{grid-template-columns:220px 1fr 300px}}.clcf-sec-label{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.08em;margin:4px 6px 10px;text-transform:uppercase}.clcf-palette{background:var(--clcf-panel);border-right:1px solid var(--clcf-line);overflow-y:auto;padding:18px 14px}.clcf-ptypes{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:22px}.clcf-ptype{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;display:flex;flex-direction:column;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:72px;justify-content:center}.clcf-ptype:hover{border-color:var(--clcf-flame-border);box-shadow:var(--clcf-shadow)}.clcf-ptype .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:7px;color:var(--clcf-flame-deep);display:flex;height:26px;justify-content:center;width:26px}.clcf-fic{display:block}.clcf-tpl{border:1px dashed var(--clcf-line-2);border-radius:var(--clcf-r);padding:12px}.clcf-tpl h4{font-size:var(--clcf-fs-md);margin:0 0 4px}.clcf-tpl p{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);line-height:1.45;margin:0 0 9px}.clcf-tpl .clcf-chips{display:flex;flex-wrap:wrap;gap:6px}.clcf-chip{background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;color:var(--clcf-flame-deep);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 9px}.clcf-chip:hover{background:#fee7cd}.clcf-canvas-col{display:flex;flex-direction:column;min-height:0}.clcf-simbar{align-items:center;background:var(--clcf-coal-2);border-radius:var(--clcf-r);color:#d6d3d1;display:flex;flex:none;flex-wrap:wrap;gap:10px;margin:16px 22px 0;padding:10px 14px}.clcf-simbar .clcf-lbl{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;letter-spacing:.04em}.clcf-simbar .clcf-lbl .clcf-eye{background:var(--clcf-flame);border-radius:5px;height:16px;width:16px}.clcf-sim{align-items:center;background:hsla(0,0%,100%,.08);border:1px solid hsla(0,0%,100%,.14);border-radius:999px;color:#e7e5e4;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:30px;padding:0 11px;position:relative}.clcf-sim select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-sim.is-active{background:rgba(249,115,22,.18);border-color:rgba(249,115,22,.55);color:#fdba74}.clcf-sim .clcf-car{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid;height:0;opacity:.7;width:0}.clcf-simbar .clcf-hint{color:#78716c;font-size:var(--clcf-fs-sm);margin-left:auto}.clcf-canvas{flex:1;overflow-y:auto;padding:16px 22px 22px}.clcf-sheet{background:var(--clcf-panel);border:1px solid var(--clcf-line);border-radius:16px;box-shadow:var(--clcf-shadow);margin:0 auto;max-width:660px;padding:26px 30px}.clcf-shead{align-items:center;display:flex;justify-content:space-between;margin-bottom:18px}.clcf-shead h2{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);margin:0}.clcf-region-tag{border:1px dashed var(--clcf-line-2);border-radius:999px;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 11px;position:relative}.clcf-region-tag select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-wcrow{display:flex;gap:12px;margin-bottom:12px}.clcf-wcph{flex:1}.clcf-wcph .clcf-cap{background:#ece9e6;border-radius:5px;height:9px;margin-bottom:7px;width:34%}.clcf-wcph .clcf-box{background:#f3f1ef;border:1px solid #e9e6e3;border-radius:9px;height:34px}.clcf-fgrid{display:grid;gap:14px 12px;grid-template-columns:1fr 1fr;margin-top:6px}.clcf-fld{background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);cursor:pointer;padding:12px 14px 13px;position:relative}.clcf-fld.clcf-w-full{grid-column:1/-1}.clcf-fld:hover{border-color:var(--clcf-flame-border)}.clcf-fld.is-selected{border:2px solid var(--clcf-flame);box-shadow:0 0 0 4px rgba(249,115,22,.12),var(--clcf-shadow);padding:11px 13px 12px}.clcf-fld.is-dragging{opacity:.45}.clcf-fld.is-drop-target{outline:2px dashed var(--clcf-flame-border);outline-offset:3px}.clcf-fld .clcf-flabel{align-items:center;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:6px;margin-bottom:7px}.clcf-fld .clcf-req{color:#dc2626}.clcf-fld .clcf-fdesc{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);margin:-3px 0 7px}.clcf-fld .clcf-input{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:9px;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-md);min-height:36px;padding:6px 12px}.clcf-fld .clcf-input--area{align-items:flex-start;min-height:58px}.clcf-fld .clcf-input--check{justify-content:center;width:36px}.clcf-fld .clcf-opts{color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:10px}.clcf-fld .clcf-opts .clcf-radio{border:2px solid var(--clcf-line-2);border-radius:50%;display:inline-block;height:15px;margin-right:5px;vertical-align:-3px;width:15px}.clcf-fld .clcf-heading-preview{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold)}.clcf-fld .clcf-grip{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:7px;box-shadow:var(--clcf-shadow);color:var(--clcf-ink-3);cursor:grab;display:flex;font-size:var(--clcf-fs-sm);height:30px;justify-content:center;left:-13px;position:absolute;top:50%;transform:translateY(-50%);width:22px}.clcf-fld .clcf-ops{display:flex;gap:4px;position:absolute;right:10px;top:-13px}.clcf-op{align-items:center;background:var(--clcf-coal);border:none;border-radius:7px;box-shadow:0 4px 10px -2px rgba(28,25,23,.4);color:#fff;cursor:pointer;display:flex;font-size:var(--clcf-fs-sm);height:26px;justify-content:center;width:26px}.clcf-op:hover{background:var(--clcf-flame-deep)}.clcf-logic-flag{align-items:center;background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;bottom:-11px;color:var(--clcf-flame-deep);display:inline-flex;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);gap:6px;left:12px;letter-spacing:.03em;max-width:90%;overflow:hidden;padding:3px 9px;position:absolute;text-overflow:ellipsis;white-space:nowrap;z-index:1}.clcf-hiddenbar{align-items:center;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-med);gap:9px;margin-top:18px}.clcf-hiddenbar .clcf-line{background:var(--clcf-line);flex:1;height:1px}.clcf-fld.is-ghost{background:#fafaf9;border:1.5px dashed var(--clcf-line-2);opacity:.75}.clcf-fld.is-ghost .clcf-flabel{color:var(--clcf-ink-3)}.clcf-fld.is-ghost .clcf-input{background:#f5f5f4;border-style:dashed}.clcf-empty{color:var(--clcf-ink-2);margin:60px auto 0;max-width:480px;text-align:center}.clcf-empty .clcf-empty-ic{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:18px;box-shadow:0 14px 30px -10px rgba(234,88,12,.5);color:#fff;display:flex;font-size:26px;font-weight:var(--clcf-fw-bold);height:64px;justify-content:center;margin:0 auto 18px;width:64px}.clcf-empty h3{color:var(--clcf-ink);font-size:var(--clcf-fs-xl);margin:0 0 8px}.clcf-empty p{font-size:var(--clcf-fs-md);line-height:1.55;margin:0}.clcf-settings{background:var(--clcf-panel);border-left:1px solid var(--clcf-line);display:flex;flex-direction:column;min-height:0}.clcf-sp-head{flex:none;padding:16px 18px 0}.clcf-sp-title{align-items:center;display:flex;gap:10px;margin-bottom:14px}.clcf-sp-title .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:8px;color:var(--clcf-flame-deep);display:flex;flex:none;height:30px;justify-content:center;width:30px}.clcf-input--icon{align-items:center;display:flex;gap:7px}.clcf-sp-title h3{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);line-height:1.25;margin:0}.clcf-sp-title small{color:var(--clcf-ink-3);display:block;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-med)}.clcf-tabs{border-bottom:1px solid var(--clcf-line);display:flex;gap:2px}.clcf-tab{background:none;border:none;border-bottom:2px solid transparent;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:9px 13px}.clcf-tab.is-on{border-bottom-color:var(--clcf-flame);color:var(--clcf-flame-deep)}.clcf-sp-body{flex:1;overflow-y:auto;padding:16px 18px}.clcf-sp-empty{color:var(--clcf-ink-3);font-size:var(--clcf-fs-md);line-height:1.6;padding:40px 24px;text-align:center}.clcf-sp-foot{align-items:center;border-top:1px solid var(--clcf-line);color:var(--clcf-ink-3);display:flex;flex:none;font-size:var(--clcf-fs-sm);gap:8px;padding:13px 18px}.clcf-kbd{background:#fff;border:1px solid var(--clcf-line-2);border-radius:5px;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:2px 6px}.clcf-sp-body .components-base-control{margin-bottom:14px}.clcf-sp-body .components-base-control__label{color:var(--clcf-ink-2);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.05em;text-transform:uppercase}.clcf-sp-body .components-select-control__input,.clcf-sp-body .components-text-control__input,.clcf-sp-body .components-textarea-control__input{border-color:var(--clcf-line-2);border-radius:var(--clcf-r-sm)}.clcf-sp-body .components-text-control__input:focus,.clcf-sp-body .components-textarea-control__input:focus{border-color:var(--clcf-flame);box-shadow:0 0 0 1px var(--clcf-flame)}.clcf-rule-card{background:#fafaf9;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);padding:13px 14px}.clcf-rule-when{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-sentence{align-items:center;color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:6px}.clcf-sentence+.clcf-sentence{margin-top:8px}.clcf-tok{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:8px;color:var(--clcf-ink);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:6px;padding:5px 10px;position:relative}.clcf-tok select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-tok input{background:transparent;border:none;color:inherit;font:inherit;outline:none;padding:0;width:72px}.clcf-tok.clcf-tok--src{background:var(--clcf-flame-soft);border-color:var(--clcf-flame-border);color:var(--clcf-flame-deep)}.clcf-tok.clcf-tok--val{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}.clcf-tok .clcf-car{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid;height:0;opacity:.55;width:0}.clcf-rule-x{background:none;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 4px}.clcf-rule-x:hover{color:#dc2626}.clcf-andor{border:1px solid var(--clcf-line-2);border-radius:8px;display:inline-flex;margin:10px 0;overflow:hidden}.clcf-andor button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:5px 13px}.clcf-andor button.is-on{background:var(--clcf-coal);color:#fff}.clcf-addrule{align-items:center;background:none;border:none;color:var(--clcf-flame-deep);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;margin-top:11px;padding:0}.clcf-then{margin-top:16px}.clcf-then-lbl{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-seg{border:1px solid var(--clcf-line-2);border-radius:9px;display:flex;overflow:hidden}.clcf-seg button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;flex:1;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:8px 0;text-align:center}.clcf-seg button.is-on{background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));color:#fff}.clcf-widthpick{display:flex;gap:10px;margin-bottom:16px}.clcf-widthpick button{background:#fff;border:1px solid var(--clcf-line-2);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;flex:1;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:10px}.clcf-widthpick button.is-on{border-color:var(--clcf-flame);box-shadow:0 0 0 3px rgba(249,115,22,.12);color:var(--clcf-flame-deep)}.clcf-widthpick .clcf-diagram{display:flex;gap:4px;margin-bottom:7px}.clcf-widthpick .clcf-diagram span{background:var(--clcf-line);border-radius:4px;flex:1;height:12px}.clcf-widthpick .clcf-diagram span.is-hl{background:var(--clcf-flame)}.clcf-optrow{align-items:flex-end;display:flex;gap:6px;margin-bottom:6px}.clcf-optrow .components-base-control{flex:1;margin-bottom:0!important}.clcf-optrow .clcf-optprice{flex:0 0 84px}.clcf-optrow .clcf-optprice .components-base-control{flex:none}.clcf-opthelp{color:#646970;font-size:var(--clcf-fs-sm);margin:8px 0 0} 1 :root{--clcf-fs-xs:11px;--clcf-fs-sm:12px;--clcf-fs-md:13px;--clcf-fs-lg:15px;--clcf-fs-xl:17px;--clcf-fw-med:600;--clcf-fw-bold:700;--clcf-flame:#f97316;--clcf-flame-deep:#ea580c;--clcf-flame-soft:#ffedd5;--clcf-flame-border:#fed7aa;--clcf-coal:#1c1917;--clcf-coal-2:#292524;--clcf-ink:#1f2328;--clcf-ink-2:#57606a;--clcf-ink-3:#8b949e;--clcf-bg:#f6f5f4;--clcf-panel:#fff;--clcf-line:#e7e5e4;--clcf-line-2:#d6d3d1;--clcf-green:#10b981;--clcf-green-soft:#d1fae5;--clcf-green-ink:#065f46;--clcf-r:12px;--clcf-r-sm:8px;--clcf-shadow:0 1px 2px rgba(28,25,23,.06),0 8px 24px -12px rgba(28,25,23,.14)}body.clcf-builder-page #wpcontent{padding-left:0}body.clcf-builder-page #wpbody-content{padding-bottom:0}body.clcf-builder-page #wpbody-content>.error,body.clcf-builder-page #wpbody-content>.notice,body.clcf-builder-page #wpbody-content>.update-nag,body.clcf-builder-page #wpfooter{display:none}.clcf-region-tag select,.clcf-sim select,.clcf-tok select{background:none;border:0;height:100%;line-height:1;margin:0;max-width:none;min-height:0;padding:0}.clcf-app{background:var(--clcf-bg);color:var(--clcf-ink);display:flex;flex-direction:column;font-size:var(--clcf-fs-md);height:calc(100vh - 32px);overflow:hidden}.clcf-app *,.clcf-app :after,.clcf-app :before{box-sizing:border-box}.clcf-hdr{background:var(--clcf-coal);color:#fff;container-name:clcf-hdr;container-type:inline-size;flex:none;gap:16px;height:58px;padding:0 20px}.clcf-hdr,.clcf-logo{align-items:center;display:flex}.clcf-logo{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);gap:10px}.clcf-logo .clcf-mark{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:8px;color:#fff;display:flex;height:28px;justify-content:center;width:28px}.clcf-logo .clcf-flame{display:block}.clcf-logo .clcf-sub{color:#a8a29e;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);margin-left:2px}.clcf-hdr>*{flex:none}.clcf-hdr .clcf-grow{flex:1}.clcf-hdr .clcf-logo,.clcf-hdr .clcf-status,.clcf-hdr button{white-space:nowrap}.clcf-uic{display:block;flex:none}.clcf-status{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-med);gap:7px}.clcf-status .clcf-dot{background:#57534e;border-radius:50%;height:7px;width:7px}.clcf-status.is-dirty .clcf-dot{background:#f59e0b}.clcf-status.is-saved .clcf-dot{background:var(--clcf-green)}.clcf-status.is-error{color:#fca5a5}.clcf-status.is-error .clcf-dot{background:#ef4444}.clcf-btn-ghost{align-items:center;background:transparent;border:1px solid #44403c;border-radius:var(--clcf-r-sm);color:#d6d3d1;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 14px}.clcf-btn-ghost:hover:not(:disabled){border-color:#78716c;color:#fff}.clcf-btn-ghost:disabled{cursor:default;opacity:.4}.clcf-btn-primary{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border:none;border-radius:var(--clcf-r-sm);box-shadow:0 4px 14px -4px rgba(234,88,12,.6);color:#fff;cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;height:34px;padding:0 18px}.clcf-btn-primary:hover{filter:brightness(1.06)}.clcf-btn-primary:disabled{cursor:default;opacity:.6}@container clcf-hdr (max-width: 760px){.clcf-status .clcf-lbl-wide{display:none}.clcf-status{gap:0}}@container clcf-hdr (max-width: 640px){.clcf-hdr button .clcf-lbl-wide{display:none}.clcf-hdr .clcf-btn-ghost{padding:0 11px}}.clcf-hdr .clcf-support .clcf-uic{color:#fb7185}.clcf-hdr .clcf-support:hover{border-color:#fb7185;color:#fff}.clcf-support-modal{max-width:540px}.clcf-support-modal p{color:var(--clcf-ink-2);font-size:var(--clcf-fs-md);line-height:1.65;margin:0 0 14px}.clcf-support-actions{align-items:center;display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.clcf-support-actions a{text-decoration:none}.clcf-linkbtn{background:none;border:0;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 6px}.clcf-linkbtn:hover{text-decoration:underline}.clcf-support-actions .clcf-linkbtn{margin-left:auto}.clcf-btn-ghost.is-light{background:#fff;border-color:var(--clcf-line-2);color:var(--clcf-ink-2)}.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-primary,a.clcf-btn-primary:active,a.clcf-btn-primary:focus,a.clcf-btn-primary:hover{color:#fff;text-decoration:none}a.clcf-btn-ghost,a.clcf-btn-ghost:active,a.clcf-btn-ghost:focus,a.clcf-btn-ghost:hover{box-shadow:none;text-decoration:none}a.clcf-btn-ghost.is-light,a.clcf-btn-ghost.is-light:focus{color:var(--clcf-ink-2)}a.clcf-btn-ghost.is-light:active,a.clcf-btn-ghost.is-light:hover{border-color:var(--clcf-ink-3);color:var(--clcf-ink)}a.clcf-btn-ghost:focus-visible,a.clcf-btn-primary:focus-visible{outline:2px solid var(--clcf-flame);outline-offset:2px}.clcf-work{display:grid;flex:1;grid-template-columns:252px 1fr 340px;min-height:0}@media (max-width:1100px){.clcf-work{grid-template-columns:220px 1fr 300px}}.clcf-sec-label{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.08em;margin:4px 6px 10px;text-transform:uppercase}.clcf-palette{background:var(--clcf-panel);border-right:1px solid var(--clcf-line);overflow-y:auto;padding:18px 14px}.clcf-ptypes{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:22px}.clcf-ptype{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;display:flex;flex-direction:column;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:72px;justify-content:center}.clcf-ptype:hover{border-color:var(--clcf-flame-border);box-shadow:var(--clcf-shadow)}.clcf-ptype .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:7px;color:var(--clcf-flame-deep);display:flex;height:26px;justify-content:center;width:26px}.clcf-fic{display:block}.clcf-tpl{border:1px dashed var(--clcf-line-2);border-radius:var(--clcf-r);padding:12px}.clcf-tpl h4{font-size:var(--clcf-fs-md);margin:0 0 4px}.clcf-tpl p{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);line-height:1.45;margin:0 0 9px}.clcf-tpl .clcf-chips{display:flex;flex-wrap:wrap;gap:6px}.clcf-chip{background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;color:var(--clcf-flame-deep);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 9px}.clcf-chip:hover{background:#fee7cd}.clcf-canvas-col{display:flex;flex-direction:column;min-height:0}.clcf-simbar{align-items:center;background:var(--clcf-coal-2);border-radius:var(--clcf-r);color:#d6d3d1;display:flex;flex:none;flex-wrap:wrap;gap:10px;margin:16px 22px 0;padding:10px 14px}.clcf-simbar .clcf-lbl{align-items:center;color:#a8a29e;display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;letter-spacing:.04em}.clcf-simbar .clcf-lbl .clcf-eye{background:var(--clcf-flame);border-radius:5px;height:16px;width:16px}.clcf-sim{align-items:center;background:hsla(0,0%,100%,.08);border:1px solid hsla(0,0%,100%,.14);border-radius:999px;color:#e7e5e4;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:7px;height:30px;padding:0 11px;position:relative}.clcf-sim select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-sim.is-active{background:rgba(249,115,22,.18);border-color:rgba(249,115,22,.55);color:#fdba74}.clcf-sim .clcf-car{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid;height:0;opacity:.7;width:0}.clcf-simbar .clcf-hint{color:#78716c;font-size:var(--clcf-fs-sm);margin-left:auto}.clcf-canvas{flex:1;overflow-y:auto;padding:16px 22px 22px}.clcf-sheet{background:var(--clcf-panel);border:1px solid var(--clcf-line);border-radius:16px;box-shadow:var(--clcf-shadow);margin:0 auto;max-width:660px;padding:26px 30px}.clcf-shead{align-items:center;display:flex;justify-content:space-between;margin-bottom:18px}.clcf-shead h2{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);margin:0}.clcf-region-tag{border:1px dashed var(--clcf-line-2);border-radius:999px;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:4px 11px;position:relative}.clcf-region-tag select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-wcrow{display:flex;gap:12px;margin-bottom:12px}.clcf-wcph{flex:1}.clcf-wcph .clcf-cap{background:#ece9e6;border-radius:5px;height:9px;margin-bottom:7px;width:34%}.clcf-wcph .clcf-box{background:#f3f1ef;border:1px solid #e9e6e3;border-radius:9px;height:34px}.clcf-fgrid{display:grid;gap:14px 12px;grid-template-columns:1fr 1fr;margin-top:6px}.clcf-fld{background:#fff;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);cursor:pointer;padding:12px 14px 13px;position:relative}.clcf-fld.clcf-w-full{grid-column:1/-1}.clcf-fld:hover{border-color:var(--clcf-flame-border)}.clcf-fld.is-selected{border:2px solid var(--clcf-flame);box-shadow:0 0 0 4px rgba(249,115,22,.12),var(--clcf-shadow);padding:11px 13px 12px}.clcf-fld.is-dragging{opacity:.45}.clcf-fld.is-drop-target{outline:2px dashed var(--clcf-flame-border);outline-offset:3px}.clcf-fld .clcf-flabel{align-items:center;display:flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:6px;margin-bottom:7px}.clcf-fld .clcf-req{color:#dc2626}.clcf-fld .clcf-fdesc{color:var(--clcf-ink-3);font-size:var(--clcf-fs-sm);margin:-3px 0 7px}.clcf-fld .clcf-input{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:9px;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-md);min-height:36px;padding:6px 12px}.clcf-fld .clcf-input--area{align-items:flex-start;min-height:58px}.clcf-fld .clcf-input--check{justify-content:center;width:36px}.clcf-fld .clcf-opts{color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:10px}.clcf-fld .clcf-opts .clcf-radio{border:2px solid var(--clcf-line-2);border-radius:50%;display:inline-block;height:15px;margin-right:5px;vertical-align:-3px;width:15px}.clcf-fld .clcf-heading-preview{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold)}.clcf-fld .clcf-grip{align-items:center;background:#fff;border:1px solid var(--clcf-line);border-radius:7px;box-shadow:var(--clcf-shadow);color:var(--clcf-ink-3);cursor:grab;display:flex;font-size:var(--clcf-fs-sm);height:30px;justify-content:center;left:-13px;position:absolute;top:50%;transform:translateY(-50%);width:22px}.clcf-fld .clcf-ops{display:flex;gap:4px;position:absolute;right:10px;top:-13px}.clcf-op{align-items:center;background:var(--clcf-coal);border:none;border-radius:7px;box-shadow:0 4px 10px -2px rgba(28,25,23,.4);color:#fff;cursor:pointer;display:flex;font-size:var(--clcf-fs-sm);height:26px;justify-content:center;width:26px}.clcf-op:hover{background:var(--clcf-flame-deep)}.clcf-logic-flag{align-items:center;background:var(--clcf-flame-soft);border:1px solid var(--clcf-flame-border);border-radius:999px;bottom:-11px;color:var(--clcf-flame-deep);display:inline-flex;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);gap:6px;left:12px;letter-spacing:.03em;max-width:90%;overflow:hidden;padding:3px 9px;position:absolute;text-overflow:ellipsis;white-space:nowrap;z-index:1}.clcf-hiddenbar{align-items:center;color:var(--clcf-ink-3);display:flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-med);gap:9px;margin-top:18px}.clcf-hiddenbar .clcf-line{background:var(--clcf-line);flex:1;height:1px}.clcf-fld.is-ghost{background:#fafaf9;border:1.5px dashed var(--clcf-line-2);opacity:.75}.clcf-fld.is-ghost .clcf-flabel{color:var(--clcf-ink-3)}.clcf-fld.is-ghost .clcf-input{background:#f5f5f4;border-style:dashed}.clcf-empty{color:var(--clcf-ink-2);margin:60px auto 0;max-width:480px;text-align:center}.clcf-empty .clcf-empty-ic{align-items:center;background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));border-radius:18px;box-shadow:0 14px 30px -10px rgba(234,88,12,.5);color:#fff;display:flex;font-size:26px;font-weight:var(--clcf-fw-bold);height:64px;justify-content:center;margin:0 auto 18px;width:64px}.clcf-empty h3{color:var(--clcf-ink);font-size:var(--clcf-fs-xl);margin:0 0 8px}.clcf-empty p{font-size:var(--clcf-fs-md);line-height:1.55;margin:0}.clcf-settings{background:var(--clcf-panel);border-left:1px solid var(--clcf-line);display:flex;flex-direction:column;min-height:0}.clcf-sp-head{flex:none;padding:16px 18px 0}.clcf-sp-title{align-items:center;display:flex;gap:10px;margin-bottom:14px}.clcf-sp-title .clcf-ic{align-items:center;background:var(--clcf-flame-soft);border-radius:8px;color:var(--clcf-flame-deep);display:flex;flex:none;height:30px;justify-content:center;width:30px}.clcf-input--icon{align-items:center;display:flex;gap:7px}.clcf-sp-title h3{font-size:var(--clcf-fs-lg);font-weight:var(--clcf-fw-bold);line-height:1.25;margin:0}.clcf-sp-title small{color:var(--clcf-ink-3);display:block;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-med)}.clcf-tabs{border-bottom:1px solid var(--clcf-line);display:flex;gap:2px}.clcf-tab{background:none;border:none;border-bottom:2px solid transparent;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:9px 13px}.clcf-tab.is-on{border-bottom-color:var(--clcf-flame);color:var(--clcf-flame-deep)}.clcf-sp-body{flex:1;overflow-y:auto;padding:16px 18px}.clcf-sp-empty{color:var(--clcf-ink-3);font-size:var(--clcf-fs-md);line-height:1.6;padding:40px 24px;text-align:center}.clcf-sp-foot{align-items:center;border-top:1px solid var(--clcf-line);color:var(--clcf-ink-3);display:flex;flex:none;font-size:var(--clcf-fs-sm);gap:8px;padding:13px 18px}.clcf-kbd{background:#fff;border:1px solid var(--clcf-line-2);border-radius:5px;font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);padding:2px 6px}.clcf-sp-body .components-base-control{margin-bottom:14px}.clcf-sp-body .components-base-control__label{color:var(--clcf-ink-2);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.05em;text-transform:uppercase}.clcf-sp-body .components-select-control__input,.clcf-sp-body .components-text-control__input,.clcf-sp-body .components-textarea-control__input{border-color:var(--clcf-line-2);border-radius:var(--clcf-r-sm)}.clcf-sp-body .components-text-control__input:focus,.clcf-sp-body .components-textarea-control__input:focus{border-color:var(--clcf-flame);box-shadow:0 0 0 1px var(--clcf-flame)}.clcf-rule-card{background:#fafaf9;border:1px solid var(--clcf-line);border-radius:var(--clcf-r);padding:13px 14px}.clcf-rule-when{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-sentence{align-items:center;color:var(--clcf-ink-2);display:flex;flex-wrap:wrap;font-size:var(--clcf-fs-md);gap:6px}.clcf-sentence+.clcf-sentence{margin-top:8px}.clcf-tok{align-items:center;background:#fff;border:1px solid var(--clcf-line-2);border-radius:8px;color:var(--clcf-ink);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);gap:6px;padding:5px 10px;position:relative}.clcf-tok select{cursor:pointer;inset:0;opacity:0;position:absolute;width:100%}.clcf-tok input{background:transparent;border:none;color:inherit;font:inherit;outline:none;padding:0;width:72px}.clcf-tok.clcf-tok--src{background:var(--clcf-flame-soft);border-color:var(--clcf-flame-border);color:var(--clcf-flame-deep)}.clcf-tok.clcf-tok--val{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}.clcf-tok .clcf-car{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid;height:0;opacity:.55;width:0}.clcf-rule-x{background:none;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-md);padding:2px 4px}.clcf-rule-x:hover{color:#dc2626}.clcf-andor{border:1px solid var(--clcf-line-2);border-radius:8px;display:inline-flex;margin:10px 0;overflow:hidden}.clcf-andor button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:5px 13px}.clcf-andor button.is-on{background:var(--clcf-coal);color:#fff}.clcf-addrule{align-items:center;background:none;border:none;color:var(--clcf-flame-deep);cursor:pointer;display:inline-flex;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);gap:7px;margin-top:11px;padding:0}.clcf-then{margin-top:16px}.clcf-then-lbl{color:var(--clcf-ink-3);font-size:var(--clcf-fs-xs);font-weight:var(--clcf-fw-bold);letter-spacing:.07em;margin-bottom:9px;text-transform:uppercase}.clcf-seg{border:1px solid var(--clcf-line-2);border-radius:9px;display:flex;overflow:hidden}.clcf-seg button{background:#fff;border:none;color:var(--clcf-ink-3);cursor:pointer;flex:1;font-size:var(--clcf-fs-md);font-weight:var(--clcf-fw-bold);padding:8px 0;text-align:center}.clcf-seg button.is-on{background:linear-gradient(135deg,var(--clcf-flame),var(--clcf-flame-deep));color:#fff}.clcf-widthpick{display:flex;gap:10px;margin-bottom:16px}.clcf-widthpick button{background:#fff;border:1px solid var(--clcf-line-2);border-radius:var(--clcf-r);color:var(--clcf-ink-2);cursor:pointer;flex:1;font-size:var(--clcf-fs-sm);font-weight:var(--clcf-fw-bold);padding:10px}.clcf-widthpick button.is-on{border-color:var(--clcf-flame);box-shadow:0 0 0 3px rgba(249,115,22,.12);color:var(--clcf-flame-deep)}.clcf-widthpick .clcf-diagram{display:flex;gap:4px;margin-bottom:7px}.clcf-widthpick .clcf-diagram span{background:var(--clcf-line);border-radius:4px;flex:1;height:12px}.clcf-widthpick .clcf-diagram span.is-hl{background:var(--clcf-flame)}.clcf-optrow{align-items:flex-end;display:flex;gap:6px;margin-bottom:6px}.clcf-optrow .components-base-control{flex:1;margin-bottom:0!important}.clcf-optrow .clcf-optprice{flex:0 0 84px}.clcf-optrow .clcf-optprice .components-base-control{flex:none}.clcf-opthelp{color:#646970;font-size:var(--clcf-fs-sm);margin:8px 0 0}.clcf-delivery-cfg .clcf-cfg-label{font-size:12px;font-weight:600;margin:12px 0 6px}.clcf-weekdays{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:4px}.clcf-weekday{align-items:center;display:inline-flex;font-size:12px;gap:4px}.clcf-cfg-row{align-items:center;display:flex;gap:6px;margin-bottom:4px}.clcf-cfg-row .components-base-control{flex:1;margin-bottom:0}.clcf-cfg-row input[type=date]{flex:1} -
corelabs-checkout-fields/trunk/build/index.js
r3630465 r3680119 1 (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,l=window.wp.domReady;var n=e.n(l);const a=window.wp.element,c=window.wp.apiFetch;var i=e.n(c);const r=window.wp.data,o={required:!1,options:[],location:"after_order_notes",width:"full",price:0,priceMode:"fixed"},s={text:{label:"Text field",...o},textarea:{label:"Text area",...o},number:{label:"Number",...o},checkbox:{label:"Checkbox",...o},radio:{label:"Choose one",...o,options:["Option 1"]},select:{label:"Select",...o,options:["Option 1"]},heading:{label:"Section heading",...o,description:""},email:{label:"Email address",...o},phone:{label:"Phone number",...o},url:{label:"Website / link",...o},date:{label:"Pick a date",...o,min:"",max:""},time:{label:"Pick a time",...o},file:{label:"Upload a file",...o}};let d=0;function u(){return d+=1,`fld_${d}_${Math.random().toString(36).slice(2,7)}`}const m={fields:[],selectedId:null,sim:{role:"guest",payment:"",shipping:"",country:"",cartPreset:"default"},past:[],activeRegion:"after_order_notes"};function f(e){const t=[...e.past,e.fields];return t.length>25&&t.shift(),t}function p(e){const t={},l=(e||[]).map(e=>{const l=JSON.parse(JSON.stringify(e));return t[l.id]=u(),l.id=t[l.id],l});return l.forEach(e=>{Array.isArray(e.conditions)&&(e.conditions=e.conditions.map(e=>e.field&&"@"!==e.field[0]&&t[e.field]?{...e,field:t[e.field]}:e))}),l}const h={addField:e=>({type:"ADD_FIELD",fieldType:e,id:u()}),updateField:(e,t)=>({type:"UPDATE_FIELD",id:e,patch:t}),removeField:e=>({type:"REMOVE_FIELD",id:e}),duplicateField:e=>({type:"DUPLICATE_FIELD",id:e,newId:u()}),reorder:(e,t)=>({type:"REORDER",from:e,to:t}),selectField:e=>({type:"SELECT",id:e}),hydrate:e=>({type:"HYDRATE",fields:e}),undo:()=>({type:"UNDO"}),setSim:e=>({type:"SET_SIM",patch:e}),setRegion:e=>({type:"SET_REGION",region:e}),insertFields:e=>({type:"INSERT_FIELDS",fields:p(e)})},_="clcf/builder",E=(0,r.createReduxStore)(_,{reducer:function(e=m,t={}){switch(t.type){case"UNDO":{if(!e.past.length)return e;const t=[...e.past],l=t.pop();return{...e,fields:l,past:t,selectedId:l.some(t=>t.id===e.selectedId)?e.selectedId:null}}case"SET_SIM":return{...e,sim:{...e.sim,...t.patch}};case"SET_REGION":return{...e,activeRegion:t.region};case"INSERT_FIELDS":{const l=[...e.fields,...t.fields];return{...e,past:f(e),fields:l,selectedId:t.fields.length?t.fields[0].id:e.selectedId}}case"ADD_FIELD":{const l=s[t.fieldType]||s.text,n={id:t.id,type:t.fieldType,...l,options:[...l.options]};return{...e,past:f(e),fields:[...e.fields,n],selectedId:n.id}}case"UPDATE_FIELD":return{...e,past:f(e),fields:e.fields.map(e=>e.id===t.id?{...e,...t.patch}:e)};case"REMOVE_FIELD":{const l=e.fields.filter(e=>e.id!==t.id).map(e=>Array.isArray(e.conditions)&&e.conditions.some(e=>e.field===t.id)?{...e,conditions:e.conditions.filter(e=>e.field!==t.id)}:e);return{...e,past:f(e),fields:l,selectedId:e.selectedId===t.id?null:e.selectedId}}case"DUPLICATE_FIELD":{const l=e.fields.findIndex(e=>e.id===t.id);if(-1===l)return e;const n={...JSON.parse(JSON.stringify(e.fields[l])),id:t.newId};n.label&&(n.label+=" (copy)");const a=[...e.fields];return a.splice(l+1,0,n),{...e,past:f(e),fields:a,selectedId:n.id}}case"REORDER":{const l=[...e.fields];if(t.to<0||t.to>=l.length)return e;const[n]=l.splice(t.from,1);return l.splice(t.to,0,n),{...e,past:f(e),fields:l}}case"SELECT":return{...e,selectedId:t.id};case"HYDRATE":return{...e,past:[],fields:Array.isArray(t.fields)?t.fields:[]};default:return e}},actions:h,selectors:{getFields:e=>e.fields,getSelected:e=>e.fields.find(t=>t.id===e.selectedId)||null,getSelectedId:e=>e.selectedId,getSim:e=>e.sim,canUndo:e=>e.past.length>0,getActiveRegion:e=>e.activeRegion}});(0,r.register)(E);const g=window.wp.i18n,v={fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"},b={text:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M5 6.5V5h14v1.5"}),(0,t.createElement)("path",{d:"M12 5v14"}),(0,t.createElement)("path",{d:"M9 19h6"})),textarea:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M4 6h16"}),(0,t.createElement)("path",{d:"M4 11h16"}),(0,t.createElement)("path",{d:"M4 16h10"})),number:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M10 3.5L8 20.5"}),(0,t.createElement)("path",{d:"M16.5 3.5l-2 17"}),(0,t.createElement)("path",{d:"M4 9h16"}),(0,t.createElement)("path",{d:"M3.5 15h16"})),checkbox:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"3"}),(0,t.createElement)("path",{d:"M8 12.2l2.7 2.8L16 9.5"})),radio:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("circle",{cx:"12",cy:"12",r:"8.5"}),(0,t.createElement)("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none"})),select:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2.5"}),(0,t.createElement)("path",{d:"M8.5 11l3.5 3 3.5-3"})),heading:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M6 4.5v15"}),(0,t.createElement)("path",{d:"M18 4.5v15"}),(0,t.createElement)("path",{d:"M6 12h12"})),date:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2.5"}),(0,t.createElement)("path",{d:"M8 3v4"}),(0,t.createElement)("path",{d:"M16 3v4"}),(0,t.createElement)("path",{d:"M3 10h18"})),email:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2.5"}),(0,t.createElement)("path",{d:"M3.5 7.5l8.5 5.8 8.5-5.8"})),phone:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M6 3.5h2.8l1.9 4.6-2.4 1.4a12.4 12.4 0 0 0 5.8 5.8l1.4-2.4 4.6 1.9V18a2.5 2.5 0 0 1-2.7 2.5A17.4 17.4 0 0 1 3.5 6.2 2.5 2.5 0 0 1 6 3.5z"})),url:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M10.5 13.5a4.5 4.5 0 0 0 6.4 0l2.4-2.4a4.5 4.5 0 0 0-6.4-6.4l-1.2 1.2"}),(0,t.createElement)("path",{d:"M13.5 10.5a4.5 4.5 0 0 0-6.4 0l-2.4 2.4a4.5 4.5 0 0 0 6.4 6.4l1.2-1.2"})),time:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("circle",{cx:"12",cy:"12",r:"8.7"}),(0,t.createElement)("path",{d:"M12 7v5.3l3.4 2"})),file:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M13.5 3.2v5.3h5.3"}),(0,t.createElement)("path",{d:"M18.8 8.5V19a1.8 1.8 0 0 1-1.8 1.8H7A1.8 1.8 0 0 1 5.2 19V5A1.8 1.8 0 0 1 7 3.2h6.5z"}))};function y({type:e,size:l=18,className:n="clcf-fic"}){const a=b[e];return a?(0,t.createElement)("svg",{className:n,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...v},a):(0,t.createElement)("svg",{className:n,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,t.createElement)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"}))}const C=[{key:"cod_confirmation",title:"COD confirmation",description:"A required confirmation checkbox that appears only for Cash on delivery.",fields:[{id:"cod_ack",type:"checkbox",label:"I will have exact cash ready",required:!0,location:"after_order_notes",width:"full",conditions:[{field:"@payment_method",operator:"is",value:"cod"}],conditionMatch:"all",conditionAction:"show"}]},{key:"gift_message",title:"Gift message",description:"A gift checkbox that reveals a message box when ticked.",fields:[{id:"is_gift",type:"checkbox",label:"This order is a gift",location:"after_order_notes",width:"full"},{id:"gift_note",type:"textarea",label:"Gift message",placeholder:"Write a short note to the recipient…",location:"after_order_notes",width:"full",conditions:[{field:"is_gift",operator:"is",value:"yes"}],conditionMatch:"all",conditionAction:"show"}]},{key:"vat_b2b",title:"VAT / EU B2B",description:"A VAT number field shown to wholesale customers only.",fields:[{id:"vat_number",type:"text",label:"VAT number",placeholder:"EU VAT ID (e.g. DE123456789)",location:"after_customer_details",width:"half",conditions:[{field:"@user_role",operator:"is",value:"wholesale"}],conditionMatch:"all",conditionAction:"show"}]},{key:"delivery_notes",title:"Delivery notes",description:"A free-text delivery instructions box, always visible.",fields:[{id:"delivery_note",type:"textarea",label:"Delivery instructions",placeholder:"Gate code, floor, safe place…",location:"after_order_notes",width:"full"}]}],w="corelabs-checkout-fields",N=["text","textarea","number","checkbox","radio","select","heading"],k={text:(0,g.__)("Text",w),textarea:(0,g.__)("Text area",w),number:(0,g.__)("Number",w),checkbox:(0,g.__)("Checkbox",w),radio:(0,g.__)("Radio",w),select:(0,g.__)("Dropdown",w),heading:(0,g.__)("Heading",w),email:(0,g.__)("Email",w),phone:(0,g.__)("Phone",w),url:(0,g.__)("URL",w),date:(0,g.__)("Date",w),time:(0,g.__)("Time",w),file:(0,g.__)("File",w)};function x(){const{addField:e,insertFields:l}=(0,r.useDispatch)(_),n=window.CLCF_BUILDER&&window.CLCF_BUILDER.fieldTypes||N;return(0,t.createElement)("div",{className:"clcf-palette"},(0,t.createElement)("div",{className:"clcf-sec-label"},(0,g.__)("Add a field",w)),(0,t.createElement)("div",{className:"clcf-ptypes"},n.map(l=>(0,t.createElement)("button",{key:l,className:"clcf-ptype",onClick:()=>e(l)},(0,t.createElement)("span",{className:"clcf-ic"},(0,t.createElement)(y,{type:l})),k[l]||l))),(0,t.createElement)("div",{className:"clcf-sec-label"},(0,g.__)("Start from a template",w)),(0,t.createElement)("div",{className:"clcf-tpl"},(0,t.createElement)("h4",null,(0,g.__)("One-click recipes",w)),(0,t.createElement)("p",null,(0,g.__)("Pre-built fields with conditional logic already wired.",w)),(0,t.createElement)("div",{className:"clcf-chips"},C.map(e=>(0,t.createElement)("button",{key:e.key,className:"clcf-chip",title:e.description,onClick:()=>l(e.fields)},e.title)))))}const F=[{key:"empty",label:"Empty cart",qty:0,subtotal:0},{key:"default",label:"2 items · $48",qty:2,subtotal:48},{key:"big",label:"5 items · $180",qty:5,subtotal:180}],D="corelabs-checkout-fields";function S(e){const t=((window.CLCF_BUILDER||{}).sources||[]).find(t=>t.token===e);return t&&t.values||[]}function L({label:e,value:l,options:n,isActive:a,onChange:c}){const i=n.find(e=>e.value===l);return(0,t.createElement)("span",{className:"clcf-sim"+(a?" is-active":"")},e,": ",i?i.label:(0,g.__)("Any",D)," ",(0,t.createElement)("span",{className:"clcf-car"}),(0,t.createElement)("select",{value:l,onChange:e=>c(e.target.value),"aria-label":e},(0,t.createElement)("option",{value:""},(0,g.__)("Any",D)),n.map(e=>(0,t.createElement)("option",{key:e.value,value:e.value},e.label))))}function I(){const e=(0,r.useSelect)(e=>e(_).getSim(),[]),{setSim:l}=(0,r.useDispatch)(_),n=S("@user_role"),a=S("@payment_method"),c=S("@shipping_method"),i=S("@billing_country"),o=F.map(e=>({value:e.key,label:e.label}));return(0,t.createElement)("div",{className:"clcf-simbar"},(0,t.createElement)("span",{className:"clcf-lbl"},(0,t.createElement)("span",{className:"clcf-eye"}),(0,g.__)("PREVIEW AS",D)),(0,t.createElement)(L,{label:(0,g.__)("Role",D),value:e.role,options:n,isActive:e.role&&"guest"!==e.role,onChange:e=>l({role:e||"guest"})}),(0,t.createElement)(L,{label:(0,g.__)("Payment",D),value:e.payment,options:a,isActive:!!e.payment,onChange:e=>l({payment:e})}),(0,t.createElement)(L,{label:(0,g.__)("Shipping",D),value:e.shipping,options:c,isActive:!!e.shipping,onChange:e=>l({shipping:e})}),(0,t.createElement)(L,{label:(0,g.__)("Cart",D),value:e.cartPreset,options:o,isActive:e.cartPreset&&"default"!==e.cartPreset,onChange:e=>l({cartPreset:e||"default"})}),(0,t.createElement)(L,{label:(0,g.__)("Country",D),value:e.country,options:i,isActive:!!e.country,onChange:e=>l({country:e})}),(0,t.createElement)("span",{className:"clcf-hint"},(0,g.__)("Conditions evaluate live — exactly like your real checkout",D)))}const A={is:"is",is_not:"is not",contains:"contains",gt:">",lt:"<"};function R(e,t,l){const n=Array.isArray(e.conditions)?e.conditions:[];if(!n.length)return"";const a=n[0];let c=`${function(e,t,l){if(!e)return"";if("@"!==e[0]){const t=(l||[]).find(t=>t.id===e);return t?t.label||t.type:e}const n=e.includes(":")?e.slice(0,e.indexOf(":")):e,a=(t||[]).find(e=>e.token===n);return a?a.label:n.slice(1).replace(/_/g," ")}(a.field,t,l)} ${A[a.operator]||a.operator} ${function(e,t){var l;const n=e.field||"";if("@"===n[0]){const l=n.includes(":")?n.slice(0,n.indexOf(":")):n,a=(t||[]).find(e=>e.token===l);if(a&&"suffix"===a.input){const e=n.slice(n.indexOf(":")+1),t=(a.values||[]).find(t=>t.value===e);return t?t.label:e}if(a&&a.values){const t=a.values.find(t=>t.value===e.value);if(t)return t.label}}return String(null!==(l=e.value)&&void 0!==l?l:"")}(a,t)}`.trim();return n.length>1&&(c+=` ${"any"===e.conditionMatch?"OR":"AND"} +${n.length-1}`),c}function M(e){return(e.conditionAction||"show").toUpperCase()}const T=["select","radio"];function U(e){return String(e&&"object"==typeof e?e.label||"":null!=e?e:"")}function O(e){if(!e||"object"!=typeof e)return 0;const t=e.price;if("number"!=typeof t&&("string"!=typeof t||""===t.trim()||isNaN(Number(t))))return 0;const l=Number(t);return isNaN(l)||l<=0?0:l}const $="corelabs-checkout-fields";function B(e,t){const l=U(t);if(!function(e){return(e&&e.options||[]).some(e=>O(e)>0)}(e))return l;const n=function(e,t){const l=function(e,t){if(null==t||""===t||"object"==typeof t)return 0;if(!T.includes(e&&e.type||""))return 0;const l=(e&&e.options||[]).find(e=>U(e)===String(t));return void 0===l?0:O(l)}(e,t);return l>0?l:parseFloat(e&&e.price)||0}(e,l);return n<=0?l:`${l} (${"percent"===e.priceMode?`+${n}%`:`+${n}`})`}function P({field:e}){const l=e.placeholder||"";switch(e.type){case"textarea":return(0,t.createElement)("div",{className:"clcf-input clcf-input--area"},l||"…");case"number":return(0,t.createElement)("div",{className:"clcf-input"},l||"0");case"checkbox":return(0,t.createElement)("div",{className:"clcf-input clcf-input--check"},"yes"===e.default?"✓":"");case"radio":return(0,t.createElement)("div",{className:"clcf-opts"},(e.options||[]).slice(0,4).map((l,n)=>(0,t.createElement)("span",{key:n},(0,t.createElement)("span",{className:"clcf-radio"}),B(e,l))));case"select":return(0,t.createElement)("div",{className:"clcf-input"},e.options&&e.options.length?B(e,e.options[0]):(0,g.__)("Choose…",$)," ▾");case"email":return(0,t.createElement)("div",{className:"clcf-input"},l||"name@example.com");case"phone":return(0,t.createElement)("div",{className:"clcf-input"},l||"+1 555 000 0000");case"url":return(0,t.createElement)("div",{className:"clcf-input"},l||"https://…");case"date":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,g.__)("Select date",$)," ",(0,t.createElement)(y,{type:"date",size:15}));case"time":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,g.__)("Select time",$)," ",(0,t.createElement)(y,{type:"time",size:15}));case"file":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,t.createElement)(y,{type:"file",size:15})," ",(0,g.__)("Choose file…",$));default:return(0,t.createElement)("div",{className:"clcf-input"},l||"…")}}function q({field:e,fields:l,selected:n,ghost:a,reason:c,onSelect:i,onDuplicate:r,onRemove:o,dragHandlers:s={}}){const d=["clcf-fld","clcf-w-"+("half"===e.width?"half":"full"),n?"is-selected":"",a?"is-ghost":"",s.isDragging?"is-dragging":"",s.isDropTarget?"is-drop-target":""].filter(Boolean).join(" "),u=R(e,window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],l);return"heading"===e.type?(0,t.createElement)("div",{className:d,role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},...s.props},n&&(0,t.createElement)(j,{onDuplicate:r,onRemove:o}),n&&(0,t.createElement)("span",{className:"clcf-grip",title:(0,g.__)("Drag to reorder",$)},"⠿"),(0,t.createElement)("div",{className:"clcf-heading-preview"},e.label||(0,g.__)("Heading",$)),e.description?(0,t.createElement)("div",{className:"clcf-fdesc"},e.description):null,u&&!a?(0,t.createElement)("span",{className:"clcf-logic-flag"},"IF · ",u," → ",M(e)):null):(0,t.createElement)("div",{className:d,role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},...s.props},n&&(0,t.createElement)(j,{onDuplicate:r,onRemove:o}),n&&(0,t.createElement)("span",{className:"clcf-grip",title:(0,g.__)("Drag to reorder",$)},"⠿"),(0,t.createElement)("div",{className:"clcf-flabel"},e.label||e.type,e.required?(0,t.createElement)("span",{className:"clcf-req"},"*"):null),e.description?(0,t.createElement)("div",{className:"clcf-fdesc"},e.description):null,(0,t.createElement)(P,{field:e}),a&&c?(0,t.createElement)("div",{className:"clcf-fdesc",style:{marginTop:7}},c):null,u&&!a?(0,t.createElement)("span",{className:"clcf-logic-flag"},"IF · ",u," → ",M(e)):null)}function j({onDuplicate:e,onRemove:l}){return(0,t.createElement)("span",{className:"clcf-ops"},(0,t.createElement)("button",{className:"clcf-op","aria-label":(0,g.__)("Duplicate",$),onClick:t=>{t.stopPropagation(),e()}},"⧉"),(0,t.createElement)("button",{className:"clcf-op","aria-label":(0,g.__)("Delete",$),onClick:e=>{e.stopPropagation(),l()}},"✕"))}function V(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function z(e,t){if(!e||"object"!=typeof e)return!1;const l=void 0!==t[e.field]&&null!==t[e.field]?String(t[e.field]):"",n=void 0!==e.value&&null!==e.value?String(e.value):"";switch(e.operator){case"is_not":return l!==n;case"contains":return""!==n&&-1!==l.indexOf(n);case"gt":return V(l)&&V(n)&&parseFloat(l)>parseFloat(n);case"lt":return V(l)&&V(n)&&parseFloat(l)<parseFloat(n);default:return l===n}}function H(e,t){const l={};e.forEach(e=>{l[e.id]=e});const n={},a={},c=e=>{if(e in n)return n[e];if(!l[e]||a[e])return!0;a[e]=!0;const i=l[e];let r=function(e,t){if(Array.isArray(e.conditions)&&e.conditions.length){const l=e.conditionAction||"show";if("require"===l)return!0;const n=e.conditions.map(e=>z(e,t)),a="any"===e.conditionMatch?-1!==n.indexOf(!0):-1===n.indexOf(!1);return"hide"===l?!a:a}return function(e,t){if(!e||"object"!=typeof e)return!0;const l=e.action||"show";if("require"===l)return!0;const n=z(e,t);return"hide"===l?!n:n}(e.condition,t)}(i,t);var o;return(o=i,Array.isArray(o.conditions)&&o.conditions.length?o.conditions.map(e=>e.field).filter(Boolean):o.condition&&o.condition.field?[o.condition.field]:[]).forEach(e=>{r=r&&c(e)}),delete a[e],n[e]=r,r},i={};return e.forEach(e=>{i[e.id]=c(e.id)}),i}const G="corelabs-checkout-fields",J=()=>window.CLCF_BUILDER&&window.CLCF_BUILDER.locations||[{value:"after_order_notes",label:"After order notes"}];function W(){const{fields:e,selectedId:l,sim:n,region:c}=(0,r.useSelect)(e=>({fields:e(_).getFields(),selectedId:e(_).getSelectedId(),sim:e(_).getSim(),region:e(_).getActiveRegion()}),[]),{selectField:i,removeField:o,duplicateField:s,reorder:d,setRegion:u}=(0,r.useDispatch)(_),[m,f]=(0,a.useState)({from:null,over:null}),p=function(e,t={}){const l={};Object.keys(e||{}).forEach(t=>{const n=e[t];l[String(t)]=null==n||"object"==typeof n?"":String(n)});const n=t.role?String(t.role):"";return l["@user_role"]=""!==n?n:"guest",(t.cartCategories||[]).forEach(e=>{l["@cart_has_category:"+parseInt(e,10)]="yes"}),(t.cartProducts||[]).forEach(e=>{l["@cart_has_product:"+parseInt(e,10)]="yes"}),l["@cart_qty"]=String(parseInt(t.cartQty||0,10)),l["@cart_subtotal"]=String(Number(t.cartSubtotal||0)),l["@shipping_method"]=String(t.shippingMethod||""),l["@payment_method"]=String(t.paymentMethod||""),l["@billing_country"]=String(t.billingCountry||""),l["@shipping_country"]=String(t.shippingCountry||""),l}(function(e){const t={};return(e||[]).forEach(e=>{"heading"!==e.type&&(t[e.id]=void 0!==e.default&&null!==e.default?String(e.default):"")}),t}(e),function(e){const t=F.find(t=>t.key===(e.cartPreset||"default"))||F[1];return{role:e.role||"guest",cartCategories:[],cartProducts:[],cartQty:t.qty,cartSubtotal:t.subtotal,shippingMethod:e.shipping||"",paymentMethod:e.payment||"",billingCountry:e.country||"",shippingCountry:e.country||""}}(n)),h=H(e,p),E=e.filter(e=>(e.location||"after_order_notes")===c),v=E.filter(e=>!1!==h[e.id]),b=E.filter(e=>!1===h[e.id]),y=t=>e.findIndex(e=>e.id===t),C=(J().find(e=>e.value===c)||{}).label||c;return(0,t.createElement)("div",{className:"clcf-canvas"},(0,t.createElement)("div",{className:"clcf-sheet"},(0,t.createElement)("div",{className:"clcf-shead"},(0,t.createElement)("h2",null,(0,g.__)("Checkout preview",G)),(0,t.createElement)("span",{className:"clcf-region-tag"},(0,g.__)("Region:",G)," ",C," ▾",(0,t.createElement)("select",{value:c,onChange:e=>u(e.target.value),"aria-label":(0,g.__)("Checkout region",G)},J().map(e=>(0,t.createElement)("option",{key:e.value,value:e.value},e.label))))),(0,t.createElement)("div",{className:"clcf-wcrow","aria-hidden":"true"},(0,t.createElement)("div",{className:"clcf-wcph"},(0,t.createElement)("div",{className:"clcf-cap"}),(0,t.createElement)("div",{className:"clcf-box"})),(0,t.createElement)("div",{className:"clcf-wcph"},(0,t.createElement)("div",{className:"clcf-cap",style:{width:"46%"}}),(0,t.createElement)("div",{className:"clcf-box"}))),0===E.length?(0,t.createElement)("div",{className:"clcf-empty"},(0,t.createElement)("div",{className:"clcf-empty-ic"},"+"),(0,t.createElement)("h3",null,(0,g.__)("No fields in this region yet",G)),(0,t.createElement)("p",null,(0,g.__)("Add a field from the left, or start from a one-click recipe — conditional logic comes pre-wired.",G))):(0,t.createElement)("div",{className:"clcf-fgrid"},v.map(n=>{return(0,t.createElement)(q,{key:n.id,field:n,fields:e,selected:n.id===l,onSelect:()=>i(n.id),onDuplicate:()=>s(n.id),onRemove:()=>o(n.id),dragHandlers:(a=n,{isDragging:m.from===a.id,isDropTarget:m.over===a.id&&m.from!==a.id,props:{draggable:!0,onDragStart:()=>f({from:a.id,over:null}),onDragOver:e=>{e.preventDefault(),f(e=>({...e,over:a.id}))},onDrop:()=>{m.from&&m.from!==a.id&&d(y(m.from),y(a.id)),f({from:null,over:null})},onDragEnd:()=>f({from:null,over:null})}})});var a})),b.length>0&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-hiddenbar"},(0,t.createElement)("span",null,1===b.length?(0,g.__)("1 field hidden by current preview",G):`${b.length} ${(0,g.__)("fields hidden by current preview",G)}`),(0,t.createElement)("span",{className:"clcf-line"})),(0,t.createElement)("div",{className:"clcf-fgrid",style:{marginTop:12}},b.map(n=>(0,t.createElement)(q,{key:n.id,field:n,fields:e,ghost:!0,reason:`${(0,g.__)("Shows when",G)} ${R(n,window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],e)}`,selected:n.id===l,onSelect:()=>i(n.id),onDuplicate:()=>s(n.id),onRemove:()=>o(n.id)}))))))}const K=window.wp.components,Q="corelabs-checkout-fields",Y=["radio","select"],X=["text","textarea","number","email","phone","url"],Z=["text","textarea"];function ee({field:e,set:l}){const n=e.type;if(X.includes(n))return(0,t.createElement)(K.TextControl,{label:(0,g.__)("Default value",Q),value:e.default||"",onChange:e=>l({default:e})});if("checkbox"===n)return(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Checked by default",Q),checked:"yes"===e.default,onChange:e=>l({default:e?"yes":""})});if(Y.includes(n)){const n=[{label:(0,g.__)("— none —",Q),value:""},...(e.options||[]).map(e=>({label:U(e),value:U(e)}))];return(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Default selection",Q),value:e.default||"",options:n,onChange:e=>l({default:e})})}return null}function te({field:e}){const{updateField:l}=(0,r.useDispatch)(_),n=t=>l(e.id,t);if("heading"===e.type)return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{label:(0,g.__)("Heading text",Q),value:e.label,onChange:e=>n({label:e})}),(0,t.createElement)(K.TextareaControl,{label:(0,g.__)("Description",Q),value:e.description||"",onChange:e=>n({description:e})}));const a=Y.includes(e.type)&&!(e.options||[]).length;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{label:(0,g.__)("Label",Q),value:e.label,onChange:e=>n({label:e})}),(0,t.createElement)(K.TextControl,{label:(0,g.__)("Description / help text",Q),value:e.description||"",onChange:e=>n({description:e})}),(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Required",Q),checked:!!e.required,onChange:e=>n({required:e})}),X.includes(e.type)&&(0,t.createElement)(K.TextControl,{label:(0,g.__)("Placeholder",Q),value:e.placeholder||"",onChange:e=>n({placeholder:e})}),(0,t.createElement)(ee,{field:e,set:n}),"number"===e.type&&(0,t.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8}},(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Min",Q),value:e.min||"",onChange:e=>n({min:e})}),(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Max",Q),value:e.max||"",onChange:e=>n({max:e})}),(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Step",Q),value:e.step||"",onChange:e=>n({step:e})})),"date"===e.type&&(0,t.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8}},(0,t.createElement)(K.TextControl,{type:"date",label:(0,g.__)("Earliest date",Q),value:e.min||"",onChange:e=>n({min:e})}),(0,t.createElement)(K.TextControl,{type:"date",label:(0,g.__)("Latest date",Q),value:e.max||"",onChange:e=>n({max:e})})),"file"===e.type&&(0,t.createElement)(K.TextControl,{type:"number",min:1,max:10,label:(0,g.__)("Max files",Q),help:(0,g.__)("Shoppers can attach up to this many files (1–10).",Q),value:e.maxFiles||1,onChange:e=>n({maxFiles:Math.min(10,Math.max(1,parseInt(e,10)||1))})}),Z.includes(e.type)&&(0,t.createElement)(K.TextControl,{type:"number",min:0,label:(0,g.__)("Max length (characters)",Q),value:e.maxLength||"",onChange:e=>n({maxLength:parseInt(e,10)||0})}),a&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.__)("Add at least one option.",Q)))}const le="corelabs-checkout-fields",ne={is:(0,g.__)("is",le),is_not:(0,g.__)("is not",le),contains:(0,g.__)("contains",le),gt:(0,g.__)("greater than",le),lt:(0,g.__)("less than",le)},ae=()=>window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],ce="__field__";function ie(e){if(!e||"@"!==e[0])return null;const t=e.indexOf(":");return-1===t?e:e.slice(0,t)}function re(e){const t=(e||"").indexOf(":");return-1===t?"":e.slice(t+1)}function oe(e){return ae().find(t=>t.token===ie(e))||null}function se(e,t){if(e===ce){const e=t[0];return{field:e?e.id:"",operator:"is",value:""}}const l=ae().find(t=>t.token===e);if(!l)return{field:e,operator:"is",value:""};if("suffix"===l.input){const t=l.values&&l.values[0]?l.values[0].value:"";return{field:`${e}:${t}`,operator:"is",value:"yes"}}if("number"===l.input)return{field:e,operator:"gt",value:""};const n=l.values&&l.values[0]?l.values[0].value:"";return{field:e,operator:"is",value:n}}function de({kind:e,value:l,valueLabel:n,options:a,onChange:c}){return(0,t.createElement)("span",{className:"clcf-tok"+(e?` clcf-tok--${e}`:"")},n," ",(0,t.createElement)("span",{className:"clcf-car"}),(0,t.createElement)("select",{value:l,onChange:e=>c(e.target.value)},a.map((e,l)=>(0,t.createElement)("option",{key:l,value:e.value},e.label))))}function ue({siblings:e,controllerId:l,value:n,onChange:a}){const c=e.find(e=>e.id===l),i=c?c.type:"text";if("checkbox"===i){const e=[{label:(0,g.__)("Checked",le),value:"yes"},{label:(0,g.__)("Unchecked",le),value:""}];return(0,t.createElement)(de,{kind:"val",value:n,valueLabel:"yes"===n?(0,g.__)("Checked",le):(0,g.__)("Unchecked",le),options:e,onChange:a})}if("select"===i||"radio"===i){const e=(c.options||[]).map(e=>({label:U(e),value:U(e)}));return(0,t.createElement)(de,{kind:"val",value:n,valueLabel:n||"—",options:e.length?e:[{label:"—",value:""}],onChange:a})}return(0,t.createElement)("span",{className:"clcf-tok clcf-tok--val"},(0,t.createElement)("input",{value:n,placeholder:(0,g.__)("value…",le),onChange:e=>a(e.target.value)}))}function me({rule:e,siblings:l,onChange:n,onRemove:a,canRemove:c}){const i=function(e){if(!e||"@"!==e[0])return"field";const t=oe(e);return t?t.input:"select"}(e.field),r=e.field&&"@"===e.field[0]?ie(e.field):ce,o=oe(e.field),s=[...l.length?[{label:(0,g.__)("Another field",le),value:ce}]:[],...ae().map(e=>({label:e.label,value:e.token}))],d=r===ce?(0,g.__)("Another field",le):o?o.label:r,u=function(e){return"number"===e?["is","gt","lt"]:"select"===e?["is","is_not"]:window.CLCF_BUILDER&&window.CLCF_BUILDER.operators||["is","is_not","contains","gt","lt"]}(i).map(e=>({label:ne[e]||e,value:e}));return(0,t.createElement)("div",{className:"clcf-sentence"},(0,t.createElement)(de,{kind:"src",value:r,valueLabel:d,options:s,onChange:e=>n(se(e,l))}),"field"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(de,{kind:"src",value:e.field,valueLabel:(l.find(t=>t.id===e.field)||{}).label||e.field||"—",options:l.map(e=>({label:e.label||e.type,value:e.id})),onChange:t=>n({...e,field:t,value:""})}),(0,t.createElement)(de,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>n({...e,operator:t})}),(0,t.createElement)(ue,{siblings:l,controllerId:e.field,value:e.value,onChange:t=>n({...e,value:t})})),"select"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(de,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>n({...e,operator:t})}),(0,t.createElement)(de,{kind:"val",value:e.value,valueLabel:(o&&o.values||[]).find(t=>t.value===e.value)?.label||e.value||"—",options:(o&&o.values||[]).map(e=>({label:e.label,value:e.value})),onChange:t=>n({...e,value:t})})),"number"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(de,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>n({...e,operator:t})}),(0,t.createElement)("span",{className:"clcf-tok clcf-tok--val"},(0,t.createElement)("input",{type:"number",value:e.value,onChange:t=>n({...e,value:t.target.value})}))),"suffix"===i&&(0,t.createElement)(de,{kind:"val",value:re(e.field),valueLabel:(o&&o.values||[]).find(t=>t.value===re(e.field))?.label||re(e.field)||"—",options:(o&&o.values||[]).map(e=>({label:e.label,value:e.value})),onChange:t=>n({field:`${ie(e.field)}:${t}`,operator:"is",value:"yes"})}),c&&(0,t.createElement)("button",{className:"clcf-rule-x","aria-label":(0,g.__)("Remove rule",le),onClick:a},"✕"))}function fe({field:e}){const l=(0,r.useSelect)(e=>e(_).getFields(),[]),{updateField:n}=(0,r.useDispatch)(_),a=l.filter(t=>t.id!==e.id),c=Array.isArray(e.conditions)?e.conditions:[],i=c.length>0,o=ae().length?ae()[0].token:a.length?ce:"",s=t=>n(e.id,{condition:null,conditions:t,conditionMatch:e.conditionMatch||"all",conditionAction:e.conditionAction||"show"});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Conditional logic",le),help:(0,g.__)("Show, hide, or require this field based on cart, role, shipping, payment, or another field.",le),checked:i,onChange:t=>t?s([se(o,a)]):n(e.id,{conditions:[],condition:null})}),i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-rule-card"},(0,t.createElement)("div",{className:"clcf-rule-when"},(0,g.__)("When",le)),c.map((l,i)=>(0,t.createElement)("div",{key:i},i>0&&(0,t.createElement)("div",{className:"clcf-andor"},(0,t.createElement)("button",{className:"all"===(e.conditionMatch||"all")?"is-on":"",onClick:()=>n(e.id,{conditionMatch:"all"})},(0,g.__)("AND",le)),(0,t.createElement)("button",{className:"any"===e.conditionMatch?"is-on":"",onClick:()=>n(e.id,{conditionMatch:"any"})},(0,g.__)("OR",le))),(0,t.createElement)(me,{rule:l,siblings:a,onChange:e=>s(c.map((t,l)=>l===i?e:t)),onRemove:()=>s(c.filter((e,t)=>t!==i)),canRemove:c.length>1}))),(0,t.createElement)("button",{className:"clcf-addrule",onClick:()=>s([...c,se(o,a)])},"+ ",(0,g.__)("Add condition",le))),(0,t.createElement)("div",{className:"clcf-then"},(0,t.createElement)("div",{className:"clcf-then-lbl"},(0,g.__)("Then",le)),(0,t.createElement)("div",{className:"clcf-seg"},[["show",(0,g.__)("Show",le)],["hide",(0,g.__)("Hide",le)],["require",(0,g.__)("Require",le)]].map(([l,a])=>(0,t.createElement)("button",{key:l,className:(e.conditionAction||"show")===l?"is-on":"",onClick:()=>n(e.id,{conditionAction:l})},a))))))}const pe="corelabs-checkout-fields",he=["select","radio"],_e=e=>e&&"object"==typeof e?{...e,label:U(e)}:{label:U(e)},Ee=e=>{const t=O(e);return t>0?String(t):""};function ge({field:e}){const{updateField:l}=(0,r.useDispatch)(_),n=e.options||[],a=t=>l(e.id,{options:t}),c=(e,t)=>{const l=n.map((l,n)=>{if(n!==e)return l;const a={..._e(l),...t},c=parseFloat(a.price);return isNaN(c)||c<=0?(delete a.price,a.label):(a.price=c,a)});a(l)},i=function(e){const t=new Set,l=new Set;return e.forEach(e=>{const n=U(e).trim();n&&(t.has(n)&&l.add(n),t.add(n))}),[...l]}(n);return(0,t.createElement)(t.Fragment,null,n.map((e,l)=>(0,t.createElement)("div",{key:l,className:"clcf-optrow"},(0,t.createElement)(K.TextControl,{label:0===l?(0,g.__)("Options",pe):void 0,value:_e(e).label,onChange:e=>c(l,{label:e})}),(0,t.createElement)("div",{className:"clcf-optprice"},(0,t.createElement)(K.TextControl,{type:"number",min:0,step:"any",label:0===l?(0,g.__)("Fee",pe):void 0,placeholder:"0",value:Ee(e),"aria-label":(0,g.__)("Fee for this option",pe),onChange:e=>c(l,{price:e})})),(0,t.createElement)(K.Button,{isDestructive:!0,variant:"tertiary","aria-label":(0,g.__)("Remove option",pe),onClick:()=>(e=>a(n.filter((t,l)=>l!==e)))(l)},"✕"))),(0,t.createElement)(K.Button,{variant:"secondary",onClick:()=>a([...n,`${(0,g.__)("Option",pe)} ${n.length+1}`])},"+ ",(0,g.__)("Add option",pe)),!n.length&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.__)("Add at least one option.",pe)),i.length>0&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.sprintf)(/* translators: %s: comma-separated option labels */ /* translators: %s: comma-separated option labels */2 (0,g.__)("Two options share the same label (%s). The checkout cannot tell them apart, so both charge the first one’s fee — rename one.", pe),i.join(", "))),!!n.length&&(0,t.createElement)("p",{className:"clcf-opthelp"},(0,g.__)("Give an option its own fee to charge a different amount per choice — e.g. Standard 0, Express 10. Leave it empty to fall back to the field fee on the Fee tab.",pe)))}const ve="corelabs-checkout-fields";function be({field:e}){const{updateField:l,setRegion:n}=(0,r.useDispatch)(_),a="half"===e.width?"half":"full";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-then-lbl"},(0,g.__)("Field width",ve)),(0,t.createElement)("div",{className:"clcf-widthpick"},(0,t.createElement)("button",{className:"full"===a?"is-on":"",onClick:()=>l(e.id,{width:"full"})},(0,t.createElement)("span",{className:"clcf-diagram"},(0,t.createElement)("span",{className:"is-hl"})),(0,g.__)("Full width",ve)),(0,t.createElement)("button",{className:"half"===a?"is-on":"",onClick:()=>l(e.id,{width:"half"})},(0,t.createElement)("span",{className:"clcf-diagram"},(0,t.createElement)("span",{className:"is-hl"}),(0,t.createElement)("span",null)),(0,g.__)("Half width",ve))),(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Checkout region",ve),value:e.location||"after_order_notes",options:(window.CLCF_BUILDER&&window.CLCF_BUILDER.locations||[{value:"after_order_notes",label:"After order notes"}]).map(e=>({label:e.label,value:e.value})),onChange:t=>{l(e.id,{location:t}),n(t)},help:(0,g.__)("Where this field appears on the checkout page.",ve)}))}const ye="corelabs-checkout-fields";function Ce({field:e}){const{updateField:l}=(0,r.useDispatch)(_),n=t=>l(e.id,t),a=e.priceMode||"fixed",c=e.price||0,i=[{label:(0,g.__)("Fixed amount",ye),value:"fixed"},..."number"===e.type?[{label:(0,g.__)("Per unit (× number entered)",ye),value:"per_unit"}]:[],{label:(0,g.__)("Percentage of subtotal",ye),value:"percent"}],o="percent"===a?(0,g.__)("Fee — percentage (%)",ye):"per_unit"===a?(0,g.__)("Fee — price per unit",ye):(0,g.__)("Fee amount",ye);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{type:"number",min:0,step:"0.01",label:o,help:(0,g.__)("Added to the order total when this field is filled in or selected. Leave 0 for no fee.",ye),value:c,onChange:e=>n({price:Math.max(0,parseFloat(e)||0)})}),(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Fee type",ye),value:a,options:i,onChange:e=>n({priceMode:e})}),c>0&&(0,t.createElement)("p",{style:{fontSize:12,color:"#57606a"}},"percent"===a?`${(0,g.__)("Charges",ye)} ${c}% ${(0,g.__)("of the cart subtotal.",ye)}`:"per_unit"===a?`${(0,g.__)("Charges",ye)} ${c} ${(0,g.__)("for each unit entered.",ye)}`:`${(0,g.__)("Charges a flat",ye)} ${c}.`))}const we="corelabs-checkout-fields";function Ne(){const e=(0,r.useSelect)(e=>e(_).getSelected(),[]),[l,n]=(0,a.useState)("general");if((0,a.useEffect)(()=>{n("general")},[e&&e.id]),!e)return(0,t.createElement)("div",{className:"clcf-settings"},(0,t.createElement)("div",{className:"clcf-sp-empty"},(0,g.__)("Select a field on the canvas to edit its settings — or add one from the left.",we)));const c=[e.type,e.required?(0,g.__)("required",we):null].filter(Boolean).join(" · ");return(0,t.createElement)("div",{className:"clcf-settings"},(0,t.createElement)("div",{className:"clcf-sp-head"},(0,t.createElement)("div",{className:"clcf-sp-title"},(0,t.createElement)("span",{className:"clcf-ic"},(0,t.createElement)(y,{type:e.type})),(0,t.createElement)("div",null,(0,t.createElement)("h3",null,e.label||e.type),(0,t.createElement)("small",null,c))),(0,t.createElement)("div",{className:"clcf-tabs"},(0,t.createElement)("button",{className:"clcf-tab"+("general"===l?" is-on":""),onClick:()=>n("general")},(0,g.__)("General",we)),he.includes(e.type)&&(0,t.createElement)("button",{className:"clcf-tab"+("options"===l?" is-on":""),onClick:()=>n("options")},(0,g.__)("Options",we)),(0,t.createElement)("button",{className:"clcf-tab"+("logic"===l?" is-on":""),onClick:()=>n("logic")},(0,g.__)("Logic",we)),(0,t.createElement)("button",{className:"clcf-tab"+("layout"===l?" is-on":""),onClick:()=>n("layout")},(0,g.__)("Layout",we)),"heading"!==e.type&&(0,t.createElement)("button",{className:"clcf-tab"+("fee"===l?" is-on":""),onClick:()=>n("fee")},(0,g.__)("Fee",we)))),(0,t.createElement)("div",{className:"clcf-sp-body"},"general"===l&&(0,t.createElement)(te,{field:e}),"options"===l&&he.includes(e.type)&&(0,t.createElement)(ge,{field:e}),"logic"===l&&(0,t.createElement)(fe,{field:e}),"layout"===l&&(0,t.createElement)(be,{field:e}),"fee"===l&&"heading"!==e.type&&(0,t.createElement)(Ce,{field:e})),(0,t.createElement)("div",{className:"clcf-sp-foot"},(0,g.__)("Changes preview instantly",we)," · ",(0,t.createElement)("span",{className:"clcf-kbd"},"⌘S")," ",(0,g.__)("saves",we)))}function ke({size:e=17,className:l="clcf-flame"}){return(0,t.createElement)("svg",{className:l,width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,t.createElement)("path",{fill:"currentColor",d:"M12 2c.5 4-2.5 5.5-4 8-1.4 2.4-1.3 5.4.6 7.6A7 7 0 0 0 19 13c0-3-2-4.5-3-7-.6 1.5-.4 2.8-1.5 3.5C14 7.5 13.5 4.5 12 2z"}))}const xe={fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round"},Fe={undo:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M4 8.5h9.5a5.5 5.5 0 010 11H8"}),(0,t.createElement)("path",{d:"M7.5 4.5l-4 4 4 4"})),heart:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M12 20s-7-4.4-7-9.2A4.1 4.1 0 0112 8.4a4.1 4.1 0 017 2.4C19 15.6 12 20 12 20z"}))};function De({name:e,size:l=15,className:n="clcf-uic"}){const a=Fe[e];return a?(0,t.createElement)("svg",{className:n,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...xe},a):null}const Se="corelabs-checkout-fields";function Le(){const[e,l]=(0,a.useState)(!1);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("button",{className:"clcf-btn-ghost clcf-support",onClick:()=>l(!0),"aria-label":(0,g.__)("Support this plugin",Se)},(0,t.createElement)(De,{name:"heart"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},(0,g.__)("Donate",Se))),e&&(0,t.createElement)(K.Modal,{title:(0,g.__)("This plugin is free. It stays free.",Se),onRequestClose:()=>l(!1),className:"clcf-support-modal"},(0,t.createElement)("p",null,(0,g.__)("Everything Checkout Fields does is in this download — conditional logic included, which most plugins in this category charge for. There is no paid tier and nothing in your dashboard nagging you to upgrade.",Se)),(0,t.createElement)("p",null,(0,g.__)("It is built and supported by one person, in the evenings. If it saved you an afternoon of work, you are welcome to put something toward the next one — and if that is not on the table, a review helps just as much and costs nothing.",Se)),(0,t.createElement)("div",{className:"clcf-support-actions"},(0,t.createElement)("a",{className:"clcf-btn-primary",href:"https://alovio.org/donate",target:"_blank",rel:"noopener noreferrer",onClick:()=>l(!1)},(0,g.__)("Buy me a coffee ↗",Se)),(0,t.createElement)("a",{className:"clcf-btn-ghost is-light",href:"https://wordpress.org/support/plugin/corelabs-checkout-fields/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",onClick:()=>l(!1)},(0,g.__)("Leave a review ↗",Se)),(0,t.createElement)("button",{className:"clcf-linkbtn",onClick:()=>l(!1)},(0,g.__)("Maybe later",Se)))))}const Ie="corelabs-checkout-fields";function Ae(){const{fields:e,canUndo:l}=(0,r.useSelect)(e=>({fields:e(_).getFields(),canUndo:e(_).canUndo()}),[]),{hydrate:n,undo:c}=(0,r.useDispatch)(_),[o,s]=(0,a.useState)(!1),[d,u]=(0,a.useState)(null),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{i()({path:"clcf/v1/fields"}).then(e=>{const t=e&&e.fields||[];n(t),m.current=JSON.stringify(t)}).catch(()=>{m.current="[]"})},[]);const f=null!==m.current&&JSON.stringify(e)!==m.current;(0,a.useEffect)(()=>{const e=e=>{f&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[f]);const p=(0,a.useCallback)(async()=>{s(!0);try{const t=await i()({path:"clcf/v1/fields",method:"POST",data:{fields:e}}),l=t&&t.fields||[];n(l),m.current=JSON.stringify(l),u("saved"),setTimeout(()=>u(null),2500)}catch(e){u("error")}s(!1)},[e,n]);(0,a.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),p())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p]);let h="clcf-status",E=(0,g.__)("All changes saved",Ie);return"error"===d?(h+=" is-error",E=(0,g.__)("Save failed — try again",Ie)):f?(h+=" is-dirty",E=(0,g.__)("Unsaved changes",Ie)):"saved"===d&&(h+=" is-saved",E=(0,g.__)("Saved",Ie)),(0,t.createElement)("div",{className:"clcf-app"},(0,t.createElement)("div",{className:"clcf-hdr"},(0,t.createElement)("div",{className:"clcf-logo"},(0,t.createElement)("span",{className:"clcf-mark"},(0,t.createElement)(ke,null)),"Alovio ",(0,t.createElement)("span",{className:"clcf-sub"},(0,g.__)("Checkout Fields",Ie))),(0,t.createElement)("div",{className:"clcf-grow"}),(0,t.createElement)("span",{className:h,title:E},(0,t.createElement)("span",{className:"clcf-dot"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},E)),(0,t.createElement)("button",{className:"clcf-btn-ghost",disabled:!l,onClick:c,"aria-label":(0,g.__)("Undo",Ie)},(0,t.createElement)(De,{name:"undo"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},(0,g.__)("Undo",Ie))),(0,t.createElement)("button",{className:"clcf-btn-primary",disabled:o,onClick:p},o?(0,g.__)("Saving…",Ie):(0,g.__)("Save & publish",Ie)),(0,t.createElement)(Le,null)),(0,t.createElement)("div",{className:"clcf-work"},(0,t.createElement)(x,null),(0,t.createElement)("div",{className:"clcf-canvas-col"},(0,t.createElement)(I,null),(0,t.createElement)(W,null)),(0,t.createElement)(Ne,null)))}n()(()=>{const e=document.getElementById("clcf-builder-root");e&&(window.CLCF_BUILDER&&(i().use(i().createRootURLMiddleware(window.CLCF_BUILDER.root)),i().use(i().createNonceMiddleware(window.CLCF_BUILDER.nonce))),(0,a.createRoot)(e).render((0,t.createElement)(Ae,null)))})})();1 (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var a in l)e.o(l,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:l[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,l=window.wp.domReady;var a=e.n(l);const n=window.wp.element,c=window.wp.apiFetch;var i=e.n(c);const r=window.wp.data,o={required:!1,options:[],location:"after_order_notes",width:"full",price:0,priceMode:"fixed"},s={text:{label:"Text field",...o},textarea:{label:"Text area",...o},number:{label:"Number",...o},checkbox:{label:"Checkbox",...o},radio:{label:"Choose one",...o,options:["Option 1"]},select:{label:"Select",...o,options:["Option 1"]},heading:{label:"Section heading",...o,description:""},email:{label:"Email address",...o},phone:{label:"Phone number",...o},url:{label:"Website / link",...o},date:{label:"Pick a date",...o,min:"",max:""},time:{label:"Pick a time",...o},delivery:{label:"Delivery date",...o,disabledWeekdays:[0],disabledDates:[],minLeadDays:1,daysAhead:21,cutoffTime:"",timeSlots:[]},file:{label:"Upload a file",...o}};let d=0;function u(){return d+=1,`fld_${d}_${Math.random().toString(36).slice(2,7)}`}const m={fields:[],selectedId:null,sim:{role:"guest",payment:"",shipping:"",country:"",cartPreset:"default"},past:[],activeRegion:"after_order_notes"};function f(e){const t=[...e.past,e.fields];return t.length>25&&t.shift(),t}function p(e){const t={},l=(e||[]).map(e=>{const l=JSON.parse(JSON.stringify(e));return t[l.id]=u(),l.id=t[l.id],l});return l.forEach(e=>{Array.isArray(e.conditions)&&(e.conditions=e.conditions.map(e=>e.field&&"@"!==e.field[0]&&t[e.field]?{...e,field:t[e.field]}:e))}),l}const h={addField:e=>({type:"ADD_FIELD",fieldType:e,id:u()}),updateField:(e,t)=>({type:"UPDATE_FIELD",id:e,patch:t}),removeField:e=>({type:"REMOVE_FIELD",id:e}),duplicateField:e=>({type:"DUPLICATE_FIELD",id:e,newId:u()}),reorder:(e,t)=>({type:"REORDER",from:e,to:t}),selectField:e=>({type:"SELECT",id:e}),hydrate:e=>({type:"HYDRATE",fields:e}),undo:()=>({type:"UNDO"}),setSim:e=>({type:"SET_SIM",patch:e}),setRegion:e=>({type:"SET_REGION",region:e}),insertFields:e=>({type:"INSERT_FIELDS",fields:p(e)})},_="clcf/builder",E=(0,r.createReduxStore)(_,{reducer:function(e=m,t={}){switch(t.type){case"UNDO":{if(!e.past.length)return e;const t=[...e.past],l=t.pop();return{...e,fields:l,past:t,selectedId:l.some(t=>t.id===e.selectedId)?e.selectedId:null}}case"SET_SIM":return{...e,sim:{...e.sim,...t.patch}};case"SET_REGION":return{...e,activeRegion:t.region};case"INSERT_FIELDS":{const l=[...e.fields,...t.fields];return{...e,past:f(e),fields:l,selectedId:t.fields.length?t.fields[0].id:e.selectedId}}case"ADD_FIELD":{const l=s[t.fieldType]||s.text,a={id:t.id,type:t.fieldType,...l,options:[...l.options]};return{...e,past:f(e),fields:[...e.fields,a],selectedId:a.id}}case"UPDATE_FIELD":return{...e,past:f(e),fields:e.fields.map(e=>e.id===t.id?{...e,...t.patch}:e)};case"REMOVE_FIELD":{const l=e.fields.filter(e=>e.id!==t.id).map(e=>Array.isArray(e.conditions)&&e.conditions.some(e=>e.field===t.id)?{...e,conditions:e.conditions.filter(e=>e.field!==t.id)}:e);return{...e,past:f(e),fields:l,selectedId:e.selectedId===t.id?null:e.selectedId}}case"DUPLICATE_FIELD":{const l=e.fields.findIndex(e=>e.id===t.id);if(-1===l)return e;const a={...JSON.parse(JSON.stringify(e.fields[l])),id:t.newId};a.label&&(a.label+=" (copy)");const n=[...e.fields];return n.splice(l+1,0,a),{...e,past:f(e),fields:n,selectedId:a.id}}case"REORDER":{const l=[...e.fields];if(t.to<0||t.to>=l.length)return e;const[a]=l.splice(t.from,1);return l.splice(t.to,0,a),{...e,past:f(e),fields:l}}case"SELECT":return{...e,selectedId:t.id};case"HYDRATE":return{...e,past:[],fields:Array.isArray(t.fields)?t.fields:[]};default:return e}},actions:h,selectors:{getFields:e=>e.fields,getSelected:e=>e.fields.find(t=>t.id===e.selectedId)||null,getSelectedId:e=>e.selectedId,getSim:e=>e.sim,canUndo:e=>e.past.length>0,getActiveRegion:e=>e.activeRegion}});(0,r.register)(E);const g=window.wp.i18n,v={fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"},b={text:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M5 6.5V5h14v1.5"}),(0,t.createElement)("path",{d:"M12 5v14"}),(0,t.createElement)("path",{d:"M9 19h6"})),textarea:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M4 6h16"}),(0,t.createElement)("path",{d:"M4 11h16"}),(0,t.createElement)("path",{d:"M4 16h10"})),number:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M10 3.5L8 20.5"}),(0,t.createElement)("path",{d:"M16.5 3.5l-2 17"}),(0,t.createElement)("path",{d:"M4 9h16"}),(0,t.createElement)("path",{d:"M3.5 15h16"})),checkbox:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"3"}),(0,t.createElement)("path",{d:"M8 12.2l2.7 2.8L16 9.5"})),radio:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("circle",{cx:"12",cy:"12",r:"8.5"}),(0,t.createElement)("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none"})),select:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2.5"}),(0,t.createElement)("path",{d:"M8.5 11l3.5 3 3.5-3"})),heading:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M6 4.5v15"}),(0,t.createElement)("path",{d:"M18 4.5v15"}),(0,t.createElement)("path",{d:"M6 12h12"})),date:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2.5"}),(0,t.createElement)("path",{d:"M8 3v4"}),(0,t.createElement)("path",{d:"M16 3v4"}),(0,t.createElement)("path",{d:"M3 10h18"})),email:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2.5"}),(0,t.createElement)("path",{d:"M3.5 7.5l8.5 5.8 8.5-5.8"})),phone:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M6 3.5h2.8l1.9 4.6-2.4 1.4a12.4 12.4 0 0 0 5.8 5.8l1.4-2.4 4.6 1.9V18a2.5 2.5 0 0 1-2.7 2.5A17.4 17.4 0 0 1 3.5 6.2 2.5 2.5 0 0 1 6 3.5z"})),url:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M10.5 13.5a4.5 4.5 0 0 0 6.4 0l2.4-2.4a4.5 4.5 0 0 0-6.4-6.4l-1.2 1.2"}),(0,t.createElement)("path",{d:"M13.5 10.5a4.5 4.5 0 0 0-6.4 0l-2.4 2.4a4.5 4.5 0 0 0 6.4 6.4l1.2-1.2"})),time:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("circle",{cx:"12",cy:"12",r:"8.7"}),(0,t.createElement)("path",{d:"M12 7v5.3l3.4 2"})),delivery:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2.5"}),(0,t.createElement)("path",{d:"M8 3v4"}),(0,t.createElement)("path",{d:"M16 3v4"}),(0,t.createElement)("path",{d:"M3 10h18"}),(0,t.createElement)("path",{d:"M12 13.3v2.4l1.7 1"})),file:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M13.5 3.2v5.3h5.3"}),(0,t.createElement)("path",{d:"M18.8 8.5V19a1.8 1.8 0 0 1-1.8 1.8H7A1.8 1.8 0 0 1 5.2 19V5A1.8 1.8 0 0 1 7 3.2h6.5z"}))};function y({type:e,size:l=18,className:a="clcf-fic"}){const n=b[e];return n?(0,t.createElement)("svg",{className:a,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...v},n):(0,t.createElement)("svg",{className:a,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,t.createElement)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"}))}const C=[{key:"cod_confirmation",title:"COD confirmation",description:"A required confirmation checkbox that appears only for Cash on delivery.",fields:[{id:"cod_ack",type:"checkbox",label:"I will have exact cash ready",required:!0,location:"after_order_notes",width:"full",conditions:[{field:"@payment_method",operator:"is",value:"cod"}],conditionMatch:"all",conditionAction:"show"}]},{key:"gift_message",title:"Gift message",description:"A gift checkbox that reveals a message box when ticked.",fields:[{id:"is_gift",type:"checkbox",label:"This order is a gift",location:"after_order_notes",width:"full"},{id:"gift_note",type:"textarea",label:"Gift message",placeholder:"Write a short note to the recipient…",location:"after_order_notes",width:"full",conditions:[{field:"is_gift",operator:"is",value:"yes"}],conditionMatch:"all",conditionAction:"show"}]},{key:"vat_b2b",title:"VAT / EU B2B",description:"A VAT number field shown to wholesale customers only.",fields:[{id:"vat_number",type:"text",label:"VAT number",placeholder:"EU VAT ID (e.g. DE123456789)",location:"after_customer_details",width:"half",conditions:[{field:"@user_role",operator:"is",value:"wholesale"}],conditionMatch:"all",conditionAction:"show"}]},{key:"delivery_notes",title:"Delivery notes",description:"A free-text delivery instructions box, always visible.",fields:[{id:"delivery_note",type:"textarea",label:"Delivery instructions",placeholder:"Gate code, floor, safe place…",location:"after_order_notes",width:"full"}]}],N="corelabs-checkout-fields",w=["text","textarea","number","checkbox","radio","select","heading"],k={text:(0,g.__)("Text",N),textarea:(0,g.__)("Text area",N),number:(0,g.__)("Number",N),checkbox:(0,g.__)("Checkbox",N),radio:(0,g.__)("Radio",N),select:(0,g.__)("Dropdown",N),heading:(0,g.__)("Heading",N),email:(0,g.__)("Email",N),phone:(0,g.__)("Phone",N),url:(0,g.__)("URL",N),date:(0,g.__)("Date",N),time:(0,g.__)("Time",N),delivery:(0,g.__)("Delivery",N),file:(0,g.__)("File",N)};function x(){const{addField:e,insertFields:l}=(0,r.useDispatch)(_),a=window.CLCF_BUILDER&&window.CLCF_BUILDER.fieldTypes||w;return(0,t.createElement)("div",{className:"clcf-palette"},(0,t.createElement)("div",{className:"clcf-sec-label"},(0,g.__)("Add a field",N)),(0,t.createElement)("div",{className:"clcf-ptypes"},a.map(l=>(0,t.createElement)("button",{key:l,className:"clcf-ptype",onClick:()=>e(l)},(0,t.createElement)("span",{className:"clcf-ic"},(0,t.createElement)(y,{type:l})),k[l]||l))),(0,t.createElement)("div",{className:"clcf-sec-label"},(0,g.__)("Start from a template",N)),(0,t.createElement)("div",{className:"clcf-tpl"},(0,t.createElement)("h4",null,(0,g.__)("One-click recipes",N)),(0,t.createElement)("p",null,(0,g.__)("Pre-built fields with conditional logic already wired.",N)),(0,t.createElement)("div",{className:"clcf-chips"},C.map(e=>(0,t.createElement)("button",{key:e.key,className:"clcf-chip",title:e.description,onClick:()=>l(e.fields)},e.title)))))}const F=[{key:"empty",label:"Empty cart",qty:0,subtotal:0},{key:"default",label:"2 items · $48",qty:2,subtotal:48},{key:"big",label:"5 items · $180",qty:5,subtotal:180}],D="corelabs-checkout-fields";function S(e){const t=((window.CLCF_BUILDER||{}).sources||[]).find(t=>t.token===e);return t&&t.values||[]}function L({label:e,value:l,options:a,isActive:n,onChange:c}){const i=a.find(e=>e.value===l);return(0,t.createElement)("span",{className:"clcf-sim"+(n?" is-active":"")},e,": ",i?i.label:(0,g.__)("Any",D)," ",(0,t.createElement)("span",{className:"clcf-car"}),(0,t.createElement)("select",{value:l,onChange:e=>c(e.target.value),"aria-label":e},(0,t.createElement)("option",{value:""},(0,g.__)("Any",D)),a.map(e=>(0,t.createElement)("option",{key:e.value,value:e.value},e.label))))}function I(){const e=(0,r.useSelect)(e=>e(_).getSim(),[]),{setSim:l}=(0,r.useDispatch)(_),a=S("@user_role"),n=S("@payment_method"),c=S("@shipping_method"),i=S("@billing_country"),o=F.map(e=>({value:e.key,label:e.label}));return(0,t.createElement)("div",{className:"clcf-simbar"},(0,t.createElement)("span",{className:"clcf-lbl"},(0,t.createElement)("span",{className:"clcf-eye"}),(0,g.__)("PREVIEW AS",D)),(0,t.createElement)(L,{label:(0,g.__)("Role",D),value:e.role,options:a,isActive:e.role&&"guest"!==e.role,onChange:e=>l({role:e||"guest"})}),(0,t.createElement)(L,{label:(0,g.__)("Payment",D),value:e.payment,options:n,isActive:!!e.payment,onChange:e=>l({payment:e})}),(0,t.createElement)(L,{label:(0,g.__)("Shipping",D),value:e.shipping,options:c,isActive:!!e.shipping,onChange:e=>l({shipping:e})}),(0,t.createElement)(L,{label:(0,g.__)("Cart",D),value:e.cartPreset,options:o,isActive:e.cartPreset&&"default"!==e.cartPreset,onChange:e=>l({cartPreset:e||"default"})}),(0,t.createElement)(L,{label:(0,g.__)("Country",D),value:e.country,options:i,isActive:!!e.country,onChange:e=>l({country:e})}),(0,t.createElement)("span",{className:"clcf-hint"},(0,g.__)("Conditions evaluate live — exactly like your real checkout",D)))}const A={is:"is",is_not:"is not",contains:"contains",gt:">",lt:"<"};function M(e,t,l){const a=Array.isArray(e.conditions)?e.conditions:[];if(!a.length)return"";const n=a[0];let c=`${function(e,t,l){if(!e)return"";if("@"!==e[0]){const t=(l||[]).find(t=>t.id===e);return t?t.label||t.type:e}const a=e.includes(":")?e.slice(0,e.indexOf(":")):e,n=(t||[]).find(e=>e.token===a);return n?n.label:a.slice(1).replace(/_/g," ")}(n.field,t,l)} ${A[n.operator]||n.operator} ${function(e,t){var l;const a=e.field||"";if("@"===a[0]){const l=a.includes(":")?a.slice(0,a.indexOf(":")):a,n=(t||[]).find(e=>e.token===l);if(n&&"suffix"===n.input){const e=a.slice(a.indexOf(":")+1),t=(n.values||[]).find(t=>t.value===e);return t?t.label:e}if(n&&n.values){const t=n.values.find(t=>t.value===e.value);if(t)return t.label}}return String(null!==(l=e.value)&&void 0!==l?l:"")}(n,t)}`.trim();return a.length>1&&(c+=` ${"any"===e.conditionMatch?"OR":"AND"} +${a.length-1}`),c}function T(e){return(e.conditionAction||"show").toUpperCase()}const R=["select","radio"];function U(e){return String(e&&"object"==typeof e?e.label||"":null!=e?e:"")}function O(e){if(!e||"object"!=typeof e)return 0;const t=e.price;if("number"!=typeof t&&("string"!=typeof t||""===t.trim()||isNaN(Number(t))))return 0;const l=Number(t);return isNaN(l)||l<=0?0:l}const B="corelabs-checkout-fields";function $(e,t){const l=U(t);if(!function(e){return(e&&e.options||[]).some(e=>O(e)>0)}(e))return l;const a=function(e,t){const l=function(e,t){if(null==t||""===t||"object"==typeof t)return 0;if(!R.includes(e&&e.type||""))return 0;const l=(e&&e.options||[]).find(e=>U(e)===String(t));return void 0===l?0:O(l)}(e,t);return l>0?l:parseFloat(e&&e.price)||0}(e,l);return a<=0?l:`${l} (${"percent"===e.priceMode?`+${a}%`:`+${a}`})`}function P({field:e}){const l=e.placeholder||"";switch(e.type){case"textarea":return(0,t.createElement)("div",{className:"clcf-input clcf-input--area"},l||"…");case"number":return(0,t.createElement)("div",{className:"clcf-input"},l||"0");case"checkbox":return(0,t.createElement)("div",{className:"clcf-input clcf-input--check"},"yes"===e.default?"✓":"");case"radio":return(0,t.createElement)("div",{className:"clcf-opts"},(e.options||[]).slice(0,4).map((l,a)=>(0,t.createElement)("span",{key:a},(0,t.createElement)("span",{className:"clcf-radio"}),$(e,l))));case"select":return(0,t.createElement)("div",{className:"clcf-input"},e.options&&e.options.length?$(e,e.options[0]):(0,g.__)("Choose…",B)," ▾");case"email":return(0,t.createElement)("div",{className:"clcf-input"},l||"name@example.com");case"phone":return(0,t.createElement)("div",{className:"clcf-input"},l||"+1 555 000 0000");case"url":return(0,t.createElement)("div",{className:"clcf-input"},l||"https://…");case"date":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,g.__)("Select date",B)," ",(0,t.createElement)(y,{type:"date",size:15}));case"time":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,g.__)("Select time",B)," ",(0,t.createElement)(y,{type:"time",size:15}));case"delivery":return(0,t.createElement)("div",{style:{display:"flex",gap:6}},(0,t.createElement)("div",{className:"clcf-input clcf-input--icon",style:{flex:1}},(0,g.__)("Select date",B)," ",(0,t.createElement)(y,{type:"delivery",size:15})),(e.timeSlots||[]).length>0&&(0,t.createElement)("div",{className:"clcf-input",style:{flex:1}},e.timeSlots[0]||(0,g.__)("Time",B)," ▾"));case"file":return(0,t.createElement)("div",{className:"clcf-input clcf-input--icon"},(0,t.createElement)(y,{type:"file",size:15})," ",(0,g.__)("Choose file…",B));default:return(0,t.createElement)("div",{className:"clcf-input"},l||"…")}}function q({field:e,fields:l,selected:a,ghost:n,reason:c,onSelect:i,onDuplicate:r,onRemove:o,dragHandlers:s={}}){const d=["clcf-fld","clcf-w-"+("half"===e.width?"half":"full"),a?"is-selected":"",n?"is-ghost":"",s.isDragging?"is-dragging":"",s.isDropTarget?"is-drop-target":""].filter(Boolean).join(" "),u=M(e,window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],l);return"heading"===e.type?(0,t.createElement)("div",{className:d,role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},...s.props},a&&(0,t.createElement)(j,{onDuplicate:r,onRemove:o}),a&&(0,t.createElement)("span",{className:"clcf-grip",title:(0,g.__)("Drag to reorder",B)},"⠿"),(0,t.createElement)("div",{className:"clcf-heading-preview"},e.label||(0,g.__)("Heading",B)),e.description?(0,t.createElement)("div",{className:"clcf-fdesc"},e.description):null,u&&!n?(0,t.createElement)("span",{className:"clcf-logic-flag"},"IF · ",u," → ",T(e)):null):(0,t.createElement)("div",{className:d,role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},...s.props},a&&(0,t.createElement)(j,{onDuplicate:r,onRemove:o}),a&&(0,t.createElement)("span",{className:"clcf-grip",title:(0,g.__)("Drag to reorder",B)},"⠿"),(0,t.createElement)("div",{className:"clcf-flabel"},e.label||e.type,e.required?(0,t.createElement)("span",{className:"clcf-req"},"*"):null),e.description?(0,t.createElement)("div",{className:"clcf-fdesc"},e.description):null,(0,t.createElement)(P,{field:e}),n&&c?(0,t.createElement)("div",{className:"clcf-fdesc",style:{marginTop:7}},c):null,u&&!n?(0,t.createElement)("span",{className:"clcf-logic-flag"},"IF · ",u," → ",T(e)):null)}function j({onDuplicate:e,onRemove:l}){return(0,t.createElement)("span",{className:"clcf-ops"},(0,t.createElement)("button",{className:"clcf-op","aria-label":(0,g.__)("Duplicate",B),onClick:t=>{t.stopPropagation(),e()}},"⧉"),(0,t.createElement)("button",{className:"clcf-op","aria-label":(0,g.__)("Delete",B),onClick:e=>{e.stopPropagation(),l()}},"✕"))}function V(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function z(e,t){if(!e||"object"!=typeof e)return!1;const l=void 0!==t[e.field]&&null!==t[e.field]?String(t[e.field]):"",a=void 0!==e.value&&null!==e.value?String(e.value):"";switch(e.operator){case"is_not":return l!==a;case"contains":return""!==a&&-1!==l.indexOf(a);case"gt":return V(l)&&V(a)&&parseFloat(l)>parseFloat(a);case"lt":return V(l)&&V(a)&&parseFloat(l)<parseFloat(a);default:return l===a}}function H(e,t){const l={};e.forEach(e=>{l[e.id]=e});const a={},n={},c=e=>{if(e in a)return a[e];if(!l[e]||n[e])return!0;n[e]=!0;const i=l[e];let r=function(e,t){if(Array.isArray(e.conditions)&&e.conditions.length){const l=e.conditionAction||"show";if("require"===l)return!0;const a=e.conditions.map(e=>z(e,t)),n="any"===e.conditionMatch?-1!==a.indexOf(!0):-1===a.indexOf(!1);return"hide"===l?!n:n}return function(e,t){if(!e||"object"!=typeof e)return!0;const l=e.action||"show";if("require"===l)return!0;const a=z(e,t);return"hide"===l?!a:a}(e.condition,t)}(i,t);var o;return(o=i,Array.isArray(o.conditions)&&o.conditions.length?o.conditions.map(e=>e.field).filter(Boolean):o.condition&&o.condition.field?[o.condition.field]:[]).forEach(e=>{r=r&&c(e)}),delete n[e],a[e]=r,r},i={};return e.forEach(e=>{i[e.id]=c(e.id)}),i}const W="corelabs-checkout-fields",G=()=>window.CLCF_BUILDER&&window.CLCF_BUILDER.locations||[{value:"after_order_notes",label:"After order notes"}];function J(){const{fields:e,selectedId:l,sim:a,region:c}=(0,r.useSelect)(e=>({fields:e(_).getFields(),selectedId:e(_).getSelectedId(),sim:e(_).getSim(),region:e(_).getActiveRegion()}),[]),{selectField:i,removeField:o,duplicateField:s,reorder:d,setRegion:u}=(0,r.useDispatch)(_),[m,f]=(0,n.useState)({from:null,over:null}),p=function(e,t={}){const l={};Object.keys(e||{}).forEach(t=>{const a=e[t];l[String(t)]=null==a||"object"==typeof a?"":String(a)});const a=t.role?String(t.role):"";return l["@user_role"]=""!==a?a:"guest",(t.cartCategories||[]).forEach(e=>{l["@cart_has_category:"+parseInt(e,10)]="yes"}),(t.cartProducts||[]).forEach(e=>{l["@cart_has_product:"+parseInt(e,10)]="yes"}),l["@cart_qty"]=String(parseInt(t.cartQty||0,10)),l["@cart_subtotal"]=String(Number(t.cartSubtotal||0)),l["@shipping_method"]=String(t.shippingMethod||""),l["@payment_method"]=String(t.paymentMethod||""),l["@billing_country"]=String(t.billingCountry||""),l["@shipping_country"]=String(t.shippingCountry||""),l}(function(e){const t={};return(e||[]).forEach(e=>{"heading"!==e.type&&(t[e.id]=void 0!==e.default&&null!==e.default?String(e.default):"")}),t}(e),function(e){const t=F.find(t=>t.key===(e.cartPreset||"default"))||F[1];return{role:e.role||"guest",cartCategories:[],cartProducts:[],cartQty:t.qty,cartSubtotal:t.subtotal,shippingMethod:e.shipping||"",paymentMethod:e.payment||"",billingCountry:e.country||"",shippingCountry:e.country||""}}(a)),h=H(e,p),E=e.filter(e=>(e.location||"after_order_notes")===c),v=E.filter(e=>!1!==h[e.id]),b=E.filter(e=>!1===h[e.id]),y=t=>e.findIndex(e=>e.id===t),C=(G().find(e=>e.value===c)||{}).label||c;return(0,t.createElement)("div",{className:"clcf-canvas"},(0,t.createElement)("div",{className:"clcf-sheet"},(0,t.createElement)("div",{className:"clcf-shead"},(0,t.createElement)("h2",null,(0,g.__)("Checkout preview",W)),(0,t.createElement)("span",{className:"clcf-region-tag"},(0,g.__)("Region:",W)," ",C," ▾",(0,t.createElement)("select",{value:c,onChange:e=>u(e.target.value),"aria-label":(0,g.__)("Checkout region",W)},G().map(e=>(0,t.createElement)("option",{key:e.value,value:e.value},e.label))))),(0,t.createElement)("div",{className:"clcf-wcrow","aria-hidden":"true"},(0,t.createElement)("div",{className:"clcf-wcph"},(0,t.createElement)("div",{className:"clcf-cap"}),(0,t.createElement)("div",{className:"clcf-box"})),(0,t.createElement)("div",{className:"clcf-wcph"},(0,t.createElement)("div",{className:"clcf-cap",style:{width:"46%"}}),(0,t.createElement)("div",{className:"clcf-box"}))),0===E.length?(0,t.createElement)("div",{className:"clcf-empty"},(0,t.createElement)("div",{className:"clcf-empty-ic"},"+"),(0,t.createElement)("h3",null,(0,g.__)("No fields in this region yet",W)),(0,t.createElement)("p",null,(0,g.__)("Add a field from the left, or start from a one-click recipe — conditional logic comes pre-wired.",W))):(0,t.createElement)("div",{className:"clcf-fgrid"},v.map(a=>{return(0,t.createElement)(q,{key:a.id,field:a,fields:e,selected:a.id===l,onSelect:()=>i(a.id),onDuplicate:()=>s(a.id),onRemove:()=>o(a.id),dragHandlers:(n=a,{isDragging:m.from===n.id,isDropTarget:m.over===n.id&&m.from!==n.id,props:{draggable:!0,onDragStart:()=>f({from:n.id,over:null}),onDragOver:e=>{e.preventDefault(),f(e=>({...e,over:n.id}))},onDrop:()=>{m.from&&m.from!==n.id&&d(y(m.from),y(n.id)),f({from:null,over:null})},onDragEnd:()=>f({from:null,over:null})}})});var n})),b.length>0&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-hiddenbar"},(0,t.createElement)("span",null,1===b.length?(0,g.__)("1 field hidden by current preview",W):`${b.length} ${(0,g.__)("fields hidden by current preview",W)}`),(0,t.createElement)("span",{className:"clcf-line"})),(0,t.createElement)("div",{className:"clcf-fgrid",style:{marginTop:12}},b.map(a=>(0,t.createElement)(q,{key:a.id,field:a,fields:e,ghost:!0,reason:`${(0,g.__)("Shows when",W)} ${M(a,window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],e)}`,selected:a.id===l,onSelect:()=>i(a.id),onDuplicate:()=>s(a.id),onRemove:()=>o(a.id)}))))))}const K=window.wp.components,Q="corelabs-checkout-fields";function Y({field:e,set:l}){var a,n;const c=e.disabledWeekdays||[],i=e.disabledDates||[],r=e.timeSlots||[],o=(e,t)=>l({[e]:t});return(0,t.createElement)("div",{className:"clcf-delivery-cfg"},(0,t.createElement)("p",{className:"clcf-cfg-label"},(0,g.__)("Unavailable weekdays",Q)),(0,t.createElement)("div",{className:"clcf-weekdays"},[(0,g.__)("Sun",Q),(0,g.__)("Mon",Q),(0,g.__)("Tue",Q),(0,g.__)("Wed",Q),(0,g.__)("Thu",Q),(0,g.__)("Fri",Q),(0,g.__)("Sat",Q)].map((e,a)=>(0,t.createElement)("label",{key:a,className:"clcf-weekday"},(0,t.createElement)("input",{type:"checkbox",checked:c.includes(a),onChange:e=>((e,t)=>{const a=new Set(c);t?a.add(e):a.delete(e),l({disabledWeekdays:[...a].sort((e,t)=>e-t)})})(a,e.target.checked)})," ",e))),(0,t.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8}},(0,t.createElement)(K.TextControl,{type:"number",min:0,label:(0,g.__)("Earliest in (days)",Q),help:(0,g.__)("Lead time before the first date.",Q),value:null!==(a=e.minLeadDays)&&void 0!==a?a:1,onChange:e=>l({minLeadDays:Math.max(0,parseInt(e,10)||0)})}),(0,t.createElement)(K.TextControl,{type:"number",min:1,max:365,label:(0,g.__)("Offer up to (days)",Q),help:(0,g.__)("How far ahead to list.",Q),value:null!==(n=e.daysAhead)&&void 0!==n?n:21,onChange:e=>l({daysAhead:Math.min(365,Math.max(1,parseInt(e,10)||1))})})),(0,t.createElement)(K.TextControl,{type:"time",label:(0,g.__)("Daily cutoff",Q),help:(0,g.__)("After this time, the lead time counts from the next day.",Q),value:e.cutoffTime||"",onChange:e=>l({cutoffTime:e})}),(0,t.createElement)("p",{className:"clcf-cfg-label"},(0,g.__)("Blocked dates (holidays)",Q)),i.map((e,l)=>(0,t.createElement)("div",{key:l,className:"clcf-cfg-row"},(0,t.createElement)("input",{type:"date",value:e,onChange:e=>o("disabledDates",i.map((t,a)=>a===l?e.target.value:t))}),(0,t.createElement)(K.Button,{isDestructive:!0,variant:"tertiary","aria-label":(0,g.__)("Remove date",Q),onClick:()=>o("disabledDates",i.filter((e,t)=>t!==l))},"✕"))),(0,t.createElement)(K.Button,{variant:"secondary",onClick:()=>o("disabledDates",[...i,""])},"+ ",(0,g.__)("Add blocked date",Q)),(0,t.createElement)("p",{className:"clcf-cfg-label"},(0,g.__)("Time slots (optional)",Q)),r.map((e,l)=>(0,t.createElement)("div",{key:l,className:"clcf-cfg-row"},(0,t.createElement)(K.TextControl,{hideLabelFromVision:!0,label:(0,g.__)("Time slot",Q),placeholder:(0,g.__)("e.g. 9:00–12:00",Q),value:e,onChange:e=>o("timeSlots",r.map((t,a)=>a===l?e:t))}),(0,t.createElement)(K.Button,{isDestructive:!0,variant:"tertiary","aria-label":(0,g.__)("Remove slot",Q),onClick:()=>o("timeSlots",r.filter((e,t)=>t!==l))},"✕"))),(0,t.createElement)(K.Button,{variant:"secondary",onClick:()=>o("timeSlots",[...r,""])},"+ ",(0,g.__)("Add time slot",Q)))}const X=["radio","select"],Z=["text","textarea","number","email","phone","url"],ee=["text","textarea"];function te({field:e,set:l}){const a=e.type;if(Z.includes(a))return(0,t.createElement)(K.TextControl,{label:(0,g.__)("Default value",Q),value:e.default||"",onChange:e=>l({default:e})});if("checkbox"===a)return(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Checked by default",Q),checked:"yes"===e.default,onChange:e=>l({default:e?"yes":""})});if(X.includes(a)){const a=[{label:(0,g.__)("— none —",Q),value:""},...(e.options||[]).map(e=>({label:U(e),value:U(e)}))];return(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Default selection",Q),value:e.default||"",options:a,onChange:e=>l({default:e})})}return null}function le({field:e}){const{updateField:l}=(0,r.useDispatch)(_),a=t=>l(e.id,t);if("heading"===e.type)return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{label:(0,g.__)("Heading text",Q),value:e.label,onChange:e=>a({label:e})}),(0,t.createElement)(K.TextareaControl,{label:(0,g.__)("Description",Q),value:e.description||"",onChange:e=>a({description:e})}));const n=X.includes(e.type)&&!(e.options||[]).length;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{label:(0,g.__)("Label",Q),value:e.label,onChange:e=>a({label:e})}),(0,t.createElement)(K.TextControl,{label:(0,g.__)("Description / help text",Q),value:e.description||"",onChange:e=>a({description:e})}),(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Required",Q),checked:!!e.required,onChange:e=>a({required:e})}),Z.includes(e.type)&&(0,t.createElement)(K.TextControl,{label:(0,g.__)("Placeholder",Q),value:e.placeholder||"",onChange:e=>a({placeholder:e})}),(0,t.createElement)(te,{field:e,set:a}),"number"===e.type&&(0,t.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8}},(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Min",Q),value:e.min||"",onChange:e=>a({min:e})}),(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Max",Q),value:e.max||"",onChange:e=>a({max:e})}),(0,t.createElement)(K.TextControl,{type:"number",label:(0,g.__)("Step",Q),value:e.step||"",onChange:e=>a({step:e})})),"date"===e.type&&(0,t.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8}},(0,t.createElement)(K.TextControl,{type:"date",label:(0,g.__)("Earliest date",Q),value:e.min||"",onChange:e=>a({min:e})}),(0,t.createElement)(K.TextControl,{type:"date",label:(0,g.__)("Latest date",Q),value:e.max||"",onChange:e=>a({max:e})})),"delivery"===e.type&&(0,t.createElement)(Y,{field:e,set:a}),"file"===e.type&&(0,t.createElement)(K.TextControl,{type:"number",min:1,max:10,label:(0,g.__)("Max files",Q),help:(0,g.__)("Shoppers can attach up to this many files (1–10).",Q),value:e.maxFiles||1,onChange:e=>a({maxFiles:Math.min(10,Math.max(1,parseInt(e,10)||1))})}),ee.includes(e.type)&&(0,t.createElement)(K.TextControl,{type:"number",min:0,label:(0,g.__)("Max length (characters)",Q),value:e.maxLength||"",onChange:e=>a({maxLength:parseInt(e,10)||0})}),n&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.__)("Add at least one option.",Q)))}const ae="corelabs-checkout-fields",ne={is:(0,g.__)("is",ae),is_not:(0,g.__)("is not",ae),contains:(0,g.__)("contains",ae),gt:(0,g.__)("greater than",ae),lt:(0,g.__)("less than",ae)},ce=()=>window.CLCF_BUILDER&&window.CLCF_BUILDER.sources||[],ie="__field__";function re(e){if(!e||"@"!==e[0])return null;const t=e.indexOf(":");return-1===t?e:e.slice(0,t)}function oe(e){const t=(e||"").indexOf(":");return-1===t?"":e.slice(t+1)}function se(e){return ce().find(t=>t.token===re(e))||null}function de(e,t){if(e===ie){const e=t[0];return{field:e?e.id:"",operator:"is",value:""}}const l=ce().find(t=>t.token===e);if(!l)return{field:e,operator:"is",value:""};if("suffix"===l.input){const t=l.values&&l.values[0]?l.values[0].value:"";return{field:`${e}:${t}`,operator:"is",value:"yes"}}if("number"===l.input)return{field:e,operator:"gt",value:""};const a=l.values&&l.values[0]?l.values[0].value:"";return{field:e,operator:"is",value:a}}function ue({kind:e,value:l,valueLabel:a,options:n,onChange:c}){return(0,t.createElement)("span",{className:"clcf-tok"+(e?` clcf-tok--${e}`:"")},a," ",(0,t.createElement)("span",{className:"clcf-car"}),(0,t.createElement)("select",{value:l,onChange:e=>c(e.target.value)},n.map((e,l)=>(0,t.createElement)("option",{key:l,value:e.value},e.label))))}function me({siblings:e,controllerId:l,value:a,onChange:n}){const c=e.find(e=>e.id===l),i=c?c.type:"text";if("checkbox"===i){const e=[{label:(0,g.__)("Checked",ae),value:"yes"},{label:(0,g.__)("Unchecked",ae),value:""}];return(0,t.createElement)(ue,{kind:"val",value:a,valueLabel:"yes"===a?(0,g.__)("Checked",ae):(0,g.__)("Unchecked",ae),options:e,onChange:n})}if("select"===i||"radio"===i){const e=(c.options||[]).map(e=>({label:U(e),value:U(e)}));return(0,t.createElement)(ue,{kind:"val",value:a,valueLabel:a||"—",options:e.length?e:[{label:"—",value:""}],onChange:n})}return(0,t.createElement)("span",{className:"clcf-tok clcf-tok--val"},(0,t.createElement)("input",{value:a,placeholder:(0,g.__)("value…",ae),onChange:e=>n(e.target.value)}))}function fe({rule:e,siblings:l,onChange:a,onRemove:n,canRemove:c}){const i=function(e){if(!e||"@"!==e[0])return"field";const t=se(e);return t?t.input:"select"}(e.field),r=e.field&&"@"===e.field[0]?re(e.field):ie,o=se(e.field),s=[...l.length?[{label:(0,g.__)("Another field",ae),value:ie}]:[],...ce().map(e=>({label:e.label,value:e.token}))],d=r===ie?(0,g.__)("Another field",ae):o?o.label:r,u=function(e){return"number"===e?["is","gt","lt"]:"select"===e?["is","is_not"]:window.CLCF_BUILDER&&window.CLCF_BUILDER.operators||["is","is_not","contains","gt","lt"]}(i).map(e=>({label:ne[e]||e,value:e}));return(0,t.createElement)("div",{className:"clcf-sentence"},(0,t.createElement)(ue,{kind:"src",value:r,valueLabel:d,options:s,onChange:e=>a(de(e,l))}),"field"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(ue,{kind:"src",value:e.field,valueLabel:(l.find(t=>t.id===e.field)||{}).label||e.field||"—",options:l.map(e=>({label:e.label||e.type,value:e.id})),onChange:t=>a({...e,field:t,value:""})}),(0,t.createElement)(ue,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>a({...e,operator:t})}),(0,t.createElement)(me,{siblings:l,controllerId:e.field,value:e.value,onChange:t=>a({...e,value:t})})),"select"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(ue,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>a({...e,operator:t})}),(0,t.createElement)(ue,{kind:"val",value:e.value,valueLabel:(o&&o.values||[]).find(t=>t.value===e.value)?.label||e.value||"—",options:(o&&o.values||[]).map(e=>({label:e.label,value:e.value})),onChange:t=>a({...e,value:t})})),"number"===i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(ue,{value:e.operator,valueLabel:ne[e.operator]||e.operator,options:u,onChange:t=>a({...e,operator:t})}),(0,t.createElement)("span",{className:"clcf-tok clcf-tok--val"},(0,t.createElement)("input",{type:"number",value:e.value,onChange:t=>a({...e,value:t.target.value})}))),"suffix"===i&&(0,t.createElement)(ue,{kind:"val",value:oe(e.field),valueLabel:(o&&o.values||[]).find(t=>t.value===oe(e.field))?.label||oe(e.field)||"—",options:(o&&o.values||[]).map(e=>({label:e.label,value:e.value})),onChange:t=>a({field:`${re(e.field)}:${t}`,operator:"is",value:"yes"})}),c&&(0,t.createElement)("button",{className:"clcf-rule-x","aria-label":(0,g.__)("Remove rule",ae),onClick:n},"✕"))}function pe({field:e}){const l=(0,r.useSelect)(e=>e(_).getFields(),[]),{updateField:a}=(0,r.useDispatch)(_),n=l.filter(t=>t.id!==e.id),c=Array.isArray(e.conditions)?e.conditions:[],i=c.length>0,o=ce().length?ce()[0].token:n.length?ie:"",s=t=>a(e.id,{condition:null,conditions:t,conditionMatch:e.conditionMatch||"all",conditionAction:e.conditionAction||"show"});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.ToggleControl,{label:(0,g.__)("Conditional logic",ae),help:(0,g.__)("Show, hide, or require this field based on cart, role, shipping, payment, or another field.",ae),checked:i,onChange:t=>t?s([de(o,n)]):a(e.id,{conditions:[],condition:null})}),i&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-rule-card"},(0,t.createElement)("div",{className:"clcf-rule-when"},(0,g.__)("When",ae)),c.map((l,i)=>(0,t.createElement)("div",{key:i},i>0&&(0,t.createElement)("div",{className:"clcf-andor"},(0,t.createElement)("button",{className:"all"===(e.conditionMatch||"all")?"is-on":"",onClick:()=>a(e.id,{conditionMatch:"all"})},(0,g.__)("AND",ae)),(0,t.createElement)("button",{className:"any"===e.conditionMatch?"is-on":"",onClick:()=>a(e.id,{conditionMatch:"any"})},(0,g.__)("OR",ae))),(0,t.createElement)(fe,{rule:l,siblings:n,onChange:e=>s(c.map((t,l)=>l===i?e:t)),onRemove:()=>s(c.filter((e,t)=>t!==i)),canRemove:c.length>1}))),(0,t.createElement)("button",{className:"clcf-addrule",onClick:()=>s([...c,de(o,n)])},"+ ",(0,g.__)("Add condition",ae))),(0,t.createElement)("div",{className:"clcf-then"},(0,t.createElement)("div",{className:"clcf-then-lbl"},(0,g.__)("Then",ae)),(0,t.createElement)("div",{className:"clcf-seg"},[["show",(0,g.__)("Show",ae)],["hide",(0,g.__)("Hide",ae)],["require",(0,g.__)("Require",ae)]].map(([l,n])=>(0,t.createElement)("button",{key:l,className:(e.conditionAction||"show")===l?"is-on":"",onClick:()=>a(e.id,{conditionAction:l})},n))))))}const he="corelabs-checkout-fields",_e=["select","radio"],Ee=e=>e&&"object"==typeof e?{...e,label:U(e)}:{label:U(e)},ge=e=>{const t=O(e);return t>0?String(t):""};function ve({field:e}){const{updateField:l}=(0,r.useDispatch)(_),a=e.options||[],n=t=>l(e.id,{options:t}),c=(e,t)=>{const l=a.map((l,a)=>{if(a!==e)return l;const n={...Ee(l),...t},c=parseFloat(n.price);return isNaN(c)||c<=0?(delete n.price,n.label):(n.price=c,n)});n(l)},i=function(e){const t=new Set,l=new Set;return e.forEach(e=>{const a=U(e).trim();a&&(t.has(a)&&l.add(a),t.add(a))}),[...l]}(a);return(0,t.createElement)(t.Fragment,null,a.map((e,l)=>(0,t.createElement)("div",{key:l,className:"clcf-optrow"},(0,t.createElement)(K.TextControl,{label:0===l?(0,g.__)("Options",he):void 0,value:Ee(e).label,onChange:e=>c(l,{label:e})}),(0,t.createElement)("div",{className:"clcf-optprice"},(0,t.createElement)(K.TextControl,{type:"number",min:0,step:"any",label:0===l?(0,g.__)("Fee",he):void 0,placeholder:"0",value:ge(e),"aria-label":(0,g.__)("Fee for this option",he),onChange:e=>c(l,{price:e})})),(0,t.createElement)(K.Button,{isDestructive:!0,variant:"tertiary","aria-label":(0,g.__)("Remove option",he),onClick:()=>(e=>n(a.filter((t,l)=>l!==e)))(l)},"✕"))),(0,t.createElement)(K.Button,{variant:"secondary",onClick:()=>n([...a,`${(0,g.__)("Option",he)} ${a.length+1}`])},"+ ",(0,g.__)("Add option",he)),!a.length&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.__)("Add at least one option.",he)),i.length>0&&(0,t.createElement)(K.Notice,{status:"warning",isDismissible:!1},(0,g.sprintf)(/* translators: %s: comma-separated option labels */ /* translators: %s: comma-separated option labels */ 2 (0,g.__)("Two options share the same label (%s). The checkout cannot tell them apart, so both charge the first one’s fee — rename one.",he),i.join(", "))),!!a.length&&(0,t.createElement)("p",{className:"clcf-opthelp"},(0,g.__)("Give an option its own fee to charge a different amount per choice — e.g. Standard 0, Express 10. Leave it empty to fall back to the field fee on the Fee tab.",he)))}const be="corelabs-checkout-fields";function ye({field:e}){const{updateField:l,setRegion:a}=(0,r.useDispatch)(_),n="half"===e.width?"half":"full";return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"clcf-then-lbl"},(0,g.__)("Field width",be)),(0,t.createElement)("div",{className:"clcf-widthpick"},(0,t.createElement)("button",{className:"full"===n?"is-on":"",onClick:()=>l(e.id,{width:"full"})},(0,t.createElement)("span",{className:"clcf-diagram"},(0,t.createElement)("span",{className:"is-hl"})),(0,g.__)("Full width",be)),(0,t.createElement)("button",{className:"half"===n?"is-on":"",onClick:()=>l(e.id,{width:"half"})},(0,t.createElement)("span",{className:"clcf-diagram"},(0,t.createElement)("span",{className:"is-hl"}),(0,t.createElement)("span",null)),(0,g.__)("Half width",be))),(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Checkout region",be),value:e.location||"after_order_notes",options:(window.CLCF_BUILDER&&window.CLCF_BUILDER.locations||[{value:"after_order_notes",label:"After order notes"}]).map(e=>({label:e.label,value:e.value})),onChange:t=>{l(e.id,{location:t}),a(t)},help:(0,g.__)("Where this field appears on the checkout page.",be)}))}const Ce="corelabs-checkout-fields";function Ne({field:e}){const{updateField:l}=(0,r.useDispatch)(_),a=t=>l(e.id,t),n=e.priceMode||"fixed",c=e.price||0,i=[{label:(0,g.__)("Fixed amount",Ce),value:"fixed"},..."number"===e.type?[{label:(0,g.__)("Per unit (× number entered)",Ce),value:"per_unit"}]:[],{label:(0,g.__)("Percentage of subtotal",Ce),value:"percent"}],o="percent"===n?(0,g.__)("Fee — percentage (%)",Ce):"per_unit"===n?(0,g.__)("Fee — price per unit",Ce):(0,g.__)("Fee amount",Ce);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(K.TextControl,{type:"number",min:0,step:"0.01",label:o,help:(0,g.__)("Added to the order total when this field is filled in or selected. Leave 0 for no fee.",Ce),value:c,onChange:e=>a({price:Math.max(0,parseFloat(e)||0)})}),(0,t.createElement)(K.SelectControl,{label:(0,g.__)("Fee type",Ce),value:n,options:i,onChange:e=>a({priceMode:e})}),c>0&&(0,t.createElement)("p",{style:{fontSize:12,color:"#57606a"}},"percent"===n?`${(0,g.__)("Charges",Ce)} ${c}% ${(0,g.__)("of the cart subtotal.",Ce)}`:"per_unit"===n?`${(0,g.__)("Charges",Ce)} ${c} ${(0,g.__)("for each unit entered.",Ce)}`:`${(0,g.__)("Charges a flat",Ce)} ${c}.`))}const we="corelabs-checkout-fields";function ke(){const e=(0,r.useSelect)(e=>e(_).getSelected(),[]),[l,a]=(0,n.useState)("general");if((0,n.useEffect)(()=>{a("general")},[e&&e.id]),!e)return(0,t.createElement)("div",{className:"clcf-settings"},(0,t.createElement)("div",{className:"clcf-sp-empty"},(0,g.__)("Select a field on the canvas to edit its settings — or add one from the left.",we)));const c=[e.type,e.required?(0,g.__)("required",we):null].filter(Boolean).join(" · ");return(0,t.createElement)("div",{className:"clcf-settings"},(0,t.createElement)("div",{className:"clcf-sp-head"},(0,t.createElement)("div",{className:"clcf-sp-title"},(0,t.createElement)("span",{className:"clcf-ic"},(0,t.createElement)(y,{type:e.type})),(0,t.createElement)("div",null,(0,t.createElement)("h3",null,e.label||e.type),(0,t.createElement)("small",null,c))),(0,t.createElement)("div",{className:"clcf-tabs"},(0,t.createElement)("button",{className:"clcf-tab"+("general"===l?" is-on":""),onClick:()=>a("general")},(0,g.__)("General",we)),_e.includes(e.type)&&(0,t.createElement)("button",{className:"clcf-tab"+("options"===l?" is-on":""),onClick:()=>a("options")},(0,g.__)("Options",we)),(0,t.createElement)("button",{className:"clcf-tab"+("logic"===l?" is-on":""),onClick:()=>a("logic")},(0,g.__)("Logic",we)),(0,t.createElement)("button",{className:"clcf-tab"+("layout"===l?" is-on":""),onClick:()=>a("layout")},(0,g.__)("Layout",we)),"heading"!==e.type&&(0,t.createElement)("button",{className:"clcf-tab"+("fee"===l?" is-on":""),onClick:()=>a("fee")},(0,g.__)("Fee",we)))),(0,t.createElement)("div",{className:"clcf-sp-body"},"general"===l&&(0,t.createElement)(le,{field:e}),"options"===l&&_e.includes(e.type)&&(0,t.createElement)(ve,{field:e}),"logic"===l&&(0,t.createElement)(pe,{field:e}),"layout"===l&&(0,t.createElement)(ye,{field:e}),"fee"===l&&"heading"!==e.type&&(0,t.createElement)(Ne,{field:e})),(0,t.createElement)("div",{className:"clcf-sp-foot"},(0,g.__)("Changes preview instantly",we)," · ",(0,t.createElement)("span",{className:"clcf-kbd"},"⌘S")," ",(0,g.__)("saves",we)))}function xe({size:e=17,className:l="clcf-flame"}){return(0,t.createElement)("svg",{className:l,width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,t.createElement)("path",{fill:"currentColor",d:"M12 2c.5 4-2.5 5.5-4 8-1.4 2.4-1.3 5.4.6 7.6A7 7 0 0 0 19 13c0-3-2-4.5-3-7-.6 1.5-.4 2.8-1.5 3.5C14 7.5 13.5 4.5 12 2z"}))}const Fe={fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round"},De={undo:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M4 8.5h9.5a5.5 5.5 0 010 11H8"}),(0,t.createElement)("path",{d:"M7.5 4.5l-4 4 4 4"})),heart:(0,t.createElement)(t.Fragment,null,(0,t.createElement)("path",{d:"M12 20s-7-4.4-7-9.2A4.1 4.1 0 0112 8.4a4.1 4.1 0 017 2.4C19 15.6 12 20 12 20z"}))};function Se({name:e,size:l=15,className:a="clcf-uic"}){const n=De[e];return n?(0,t.createElement)("svg",{className:a,width:l,height:l,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...Fe},n):null}const Le="corelabs-checkout-fields";function Ie(){const[e,l]=(0,n.useState)(!1);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("button",{className:"clcf-btn-ghost clcf-support",onClick:()=>l(!0),"aria-label":(0,g.__)("Support this plugin",Le)},(0,t.createElement)(Se,{name:"heart"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},(0,g.__)("Donate",Le))),e&&(0,t.createElement)(K.Modal,{title:(0,g.__)("This plugin is free. It stays free.",Le),onRequestClose:()=>l(!1),className:"clcf-support-modal"},(0,t.createElement)("p",null,(0,g.__)("Everything Checkout Fields does is in this download — conditional logic included, which most plugins in this category charge for. There is no paid tier and nothing in your dashboard nagging you to upgrade.",Le)),(0,t.createElement)("p",null,(0,g.__)("It is built and supported by one person, in the evenings. If it saved you an afternoon of work, you are welcome to put something toward the next one — and if that is not on the table, a review helps just as much and costs nothing.",Le)),(0,t.createElement)("div",{className:"clcf-support-actions"},(0,t.createElement)("a",{className:"clcf-btn-primary",href:"https://alovio.org/donate",target:"_blank",rel:"noopener noreferrer",onClick:()=>l(!1)},(0,g.__)("Buy me a coffee ↗",Le)),(0,t.createElement)("a",{className:"clcf-btn-ghost is-light",href:"https://wordpress.org/support/plugin/corelabs-checkout-fields/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",onClick:()=>l(!1)},(0,g.__)("Leave a review ↗",Le)),(0,t.createElement)("button",{className:"clcf-linkbtn",onClick:()=>l(!1)},(0,g.__)("Maybe later",Le)))))}const Ae="corelabs-checkout-fields";function Me(){const{fields:e,canUndo:l}=(0,r.useSelect)(e=>({fields:e(_).getFields(),canUndo:e(_).canUndo()}),[]),{hydrate:a,undo:c}=(0,r.useDispatch)(_),[o,s]=(0,n.useState)(!1),[d,u]=(0,n.useState)(null),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{i()({path:"clcf/v1/fields"}).then(e=>{const t=e&&e.fields||[];a(t),m.current=JSON.stringify(t)}).catch(()=>{m.current="[]"})},[]);const f=null!==m.current&&JSON.stringify(e)!==m.current;(0,n.useEffect)(()=>{const e=e=>{f&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[f]);const p=(0,n.useCallback)(async()=>{s(!0);try{const t=await i()({path:"clcf/v1/fields",method:"POST",data:{fields:e}}),l=t&&t.fields||[];a(l),m.current=JSON.stringify(l),u("saved"),setTimeout(()=>u(null),2500)}catch(e){u("error")}s(!1)},[e,a]);(0,n.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),p())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p]);let h="clcf-status",E=(0,g.__)("All changes saved",Ae);return"error"===d?(h+=" is-error",E=(0,g.__)("Save failed — try again",Ae)):f?(h+=" is-dirty",E=(0,g.__)("Unsaved changes",Ae)):"saved"===d&&(h+=" is-saved",E=(0,g.__)("Saved",Ae)),(0,t.createElement)("div",{className:"clcf-app"},(0,t.createElement)("div",{className:"clcf-hdr"},(0,t.createElement)("div",{className:"clcf-logo"},(0,t.createElement)("span",{className:"clcf-mark"},(0,t.createElement)(xe,null)),"Alovio ",(0,t.createElement)("span",{className:"clcf-sub"},(0,g.__)("Checkout Fields",Ae))),(0,t.createElement)("div",{className:"clcf-grow"}),(0,t.createElement)("span",{className:h,title:E},(0,t.createElement)("span",{className:"clcf-dot"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},E)),(0,t.createElement)("button",{className:"clcf-btn-ghost",disabled:!l,onClick:c,"aria-label":(0,g.__)("Undo",Ae)},(0,t.createElement)(Se,{name:"undo"}),(0,t.createElement)("span",{className:"clcf-lbl-wide"},(0,g.__)("Undo",Ae))),(0,t.createElement)("button",{className:"clcf-btn-primary",disabled:o,onClick:p},o?(0,g.__)("Saving…",Ae):(0,g.__)("Save & publish",Ae)),(0,t.createElement)(Ie,null)),(0,t.createElement)("div",{className:"clcf-work"},(0,t.createElement)(x,null),(0,t.createElement)("div",{className:"clcf-canvas-col"},(0,t.createElement)(I,null),(0,t.createElement)(J,null)),(0,t.createElement)(ke,null)))}a()(()=>{const e=document.getElementById("clcf-builder-root");e&&(window.CLCF_BUILDER&&(i().use(i().createRootURLMiddleware(window.CLCF_BUILDER.root)),i().use(i().createNonceMiddleware(window.CLCF_BUILDER.nonce))),(0,n.createRoot)(e).render((0,t.createElement)(Me,null)))})})(); -
corelabs-checkout-fields/trunk/build/style-block-checkout-rtl.css
r3630388 r3680119 1 .clcf-block-fields.clcf-grid,.wc-block-components-totals-wrapper.slot-wrapper>*>.clcf-block-fields.clcf-grid{box-sizing:border-box;display:grid;gap:18px 16px;grid-template-columns:1fr 1fr;margin:0;padding:8px 16px 16px}.clcf-block-fields .clcf-w-full{grid-column:1/-1}@media (max-width:600px){.clcf-block-fields.clcf-grid{grid-template-columns:1fr}.clcf-block-fields .clcf-w-half{grid-column:1/-1}}.clcf-block-field__label{display:block;font-size:var(--clcf-fs-md,1em);font-weight:var(--clcf-fw-strong,600);line-height:1.35;margin-bottom:7px}.clcf-block-field__label abbr{border:none;color:#dc2626;margin-right:2px;text-decoration:none}.clcf-block-field__desc{color:#6b7280;display:block;font-size:var(--clcf-fs-sm,.85em);line-height:1.45;margin:-3px 0 7px}.clcf-block-field input[type=date],.clcf-block-field input[type=email],.clcf-block-field input[type=number],.clcf-block-field input[type=tel],.clcf-block-field input[type=text],.clcf-block-field input[type=time],.clcf-block-field input[type=url],.clcf-block-field select,.clcf-block-field textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;box-sizing:border-box;color:inherit;display:block;font:inherit;line-height:1.4;min-height:46px;padding:11px 14px;transition:border-color .15s ease,box-shadow .15s ease;width:100%}.clcf-block-field select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27%3E%3Cpath fill=%27none%27 stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-width=%272%27 d=%27m1 1 5 5 5-5%27/%3E%3C/svg%3E");background-position:left 14px center;background-repeat:no-repeat;padding-left:38px}.clcf-block-field input[type=date],.clcf-block-field input[type=time]{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.clcf-block-field textarea{min-height:92px;resize:vertical}.clcf-block-field input:hover,.clcf-block-field select:hover,.clcf-block-field textarea:hover{border-color:#b9bdc4}.clcf-block-field input:focus,.clcf-block-field input:focus-visible,.clcf-block-field select:focus,.clcf-block-field select:focus-visible,.clcf-block-field textarea:focus,.clcf-block-field textarea:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field ::-moz-placeholder{color:#9ca3af}.clcf-block-field ::placeholder{color:#9ca3af}.clcf-block-checkbox,.clcf-block-radios label{align-items:center;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;cursor:pointer;display:flex;font-weight:var(--clcf-fw-med,500);gap:11px;margin:0;padding:12px 14px;transition:border-color .15s ease,background-color .15s ease}.clcf-block-radios label+label{margin-top:8px}.clcf-block-checkbox:hover,.clcf-block-radios label:hover{border-color:#fdba74}.clcf-block-checkbox:has(input:checked),.clcf-block-radios label:has(input:checked){background:#fff7ed;border-color:#f97316}.clcf-block-checkbox input[type=checkbox],.clcf-block-radios input[type=radio]{accent-color:#f97316;cursor:pointer;flex:none;height:19px;margin:0;width:19px}.clcf-block-field input[type=file]{background:#fafafa;border:1.5px dashed #c9ccd2;border-radius:10px;box-sizing:border-box;color:#6b7280;cursor:pointer;display:block;font:inherit;padding:12px;transition:border-color .15s ease,background-color .15s ease;width:100%}.clcf-block-field input[type=file]:hover{background:#fff7ed;border-color:#f97316}.clcf-block-field input[type=file]:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field input[type=file]::file-selector-button{background:#fff;border:1.5px solid #d7d9de;border-radius:8px;color:#1f2328;cursor:pointer;font:inherit;font-weight:var(--clcf-fw-strong,600);margin-left:12px;padding:8px 14px;transition:border-color .15s ease}.clcf-block-field input[type=file]:hover::file-selector-button{border-color:#f97316;color:#ea580c}.clcf-block-field--heading strong{font-size:var(--clcf-fs-lg,1.15em)} 1 .clcf-block-fields.clcf-grid,.wc-block-components-totals-wrapper.slot-wrapper>*>.clcf-block-fields.clcf-grid{box-sizing:border-box;display:grid;gap:18px 16px;grid-template-columns:1fr 1fr;margin:0;padding:8px 16px 16px}.clcf-block-fields .clcf-w-full{grid-column:1/-1}@media (max-width:600px){.clcf-block-fields.clcf-grid{grid-template-columns:1fr}.clcf-block-fields .clcf-w-half{grid-column:1/-1}}.clcf-block-field__label{display:block;font-size:var(--clcf-fs-md,1em);font-weight:var(--clcf-fw-strong,600);line-height:1.35;margin-bottom:7px}.clcf-block-field__label abbr{border:none;color:#dc2626;margin-right:2px;text-decoration:none}.clcf-block-field__desc{color:#6b7280;display:block;font-size:var(--clcf-fs-sm,.85em);line-height:1.45;margin:-3px 0 7px}.clcf-block-field input[type=date],.clcf-block-field input[type=email],.clcf-block-field input[type=number],.clcf-block-field input[type=tel],.clcf-block-field input[type=text],.clcf-block-field input[type=time],.clcf-block-field input[type=url],.clcf-block-field select,.clcf-block-field textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;box-sizing:border-box;color:inherit;display:block;font:inherit;line-height:1.4;min-height:46px;padding:11px 14px;transition:border-color .15s ease,box-shadow .15s ease;width:100%}.clcf-block-field select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27%3E%3Cpath fill=%27none%27 stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-width=%272%27 d=%27m1 1 5 5 5-5%27/%3E%3C/svg%3E");background-position:left 14px center;background-repeat:no-repeat;padding-left:38px}.clcf-block-field input[type=date],.clcf-block-field input[type=time]{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.clcf-block-field textarea{min-height:92px;resize:vertical}.clcf-block-field input:hover,.clcf-block-field select:hover,.clcf-block-field textarea:hover{border-color:#b9bdc4}.clcf-block-field input:focus,.clcf-block-field input:focus-visible,.clcf-block-field select:focus,.clcf-block-field select:focus-visible,.clcf-block-field textarea:focus,.clcf-block-field textarea:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field ::-moz-placeholder{color:#9ca3af}.clcf-block-field ::placeholder{color:#9ca3af}.clcf-block-checkbox,.clcf-block-radios label{align-items:center;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;cursor:pointer;display:flex;font-weight:var(--clcf-fw-med,500);gap:11px;margin:0;padding:12px 14px;transition:border-color .15s ease,background-color .15s ease}.clcf-block-radios label+label{margin-top:8px}.clcf-block-checkbox:hover,.clcf-block-radios label:hover{border-color:#fdba74}.clcf-block-checkbox:has(input:checked),.clcf-block-radios label:has(input:checked){background:#fff7ed;border-color:#f97316}.clcf-block-checkbox input[type=checkbox],.clcf-block-radios input[type=radio]{accent-color:#f97316;cursor:pointer;flex:none;height:19px;margin:0;width:19px}.clcf-block-field input[type=file]{background:#fafafa;border:1.5px dashed #c9ccd2;border-radius:10px;box-sizing:border-box;color:#6b7280;cursor:pointer;display:block;font:inherit;padding:12px;transition:border-color .15s ease,background-color .15s ease;width:100%}.clcf-block-field input[type=file]:hover{background:#fff7ed;border-color:#f97316}.clcf-block-field input[type=file]:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field input[type=file]::file-selector-button{background:#fff;border:1.5px solid #d7d9de;border-radius:8px;color:#1f2328;cursor:pointer;font:inherit;font-weight:var(--clcf-fw-strong,600);margin-left:12px;padding:8px 14px;transition:border-color .15s ease}.clcf-block-field input[type=file]:hover::file-selector-button{border-color:#f97316;color:#ea580c}.clcf-block-field--heading strong{font-size:var(--clcf-fs-lg,1.15em)}.clcf-block-delivery{display:flex;flex-wrap:wrap;gap:8px}.clcf-block-delivery select{flex:1;min-width:130px} -
corelabs-checkout-fields/trunk/build/style-block-checkout.css
r3630388 r3680119 1 .clcf-block-fields.clcf-grid,.wc-block-components-totals-wrapper.slot-wrapper>*>.clcf-block-fields.clcf-grid{box-sizing:border-box;display:grid;gap:18px 16px;grid-template-columns:1fr 1fr;margin:0;padding:8px 16px 16px}.clcf-block-fields .clcf-w-full{grid-column:1/-1}@media (max-width:600px){.clcf-block-fields.clcf-grid{grid-template-columns:1fr}.clcf-block-fields .clcf-w-half{grid-column:1/-1}}.clcf-block-field__label{display:block;font-size:var(--clcf-fs-md,1em);font-weight:var(--clcf-fw-strong,600);line-height:1.35;margin-bottom:7px}.clcf-block-field__label abbr{border:none;color:#dc2626;margin-left:2px;text-decoration:none}.clcf-block-field__desc{color:#6b7280;display:block;font-size:var(--clcf-fs-sm,.85em);line-height:1.45;margin:-3px 0 7px}.clcf-block-field input[type=date],.clcf-block-field input[type=email],.clcf-block-field input[type=number],.clcf-block-field input[type=tel],.clcf-block-field input[type=text],.clcf-block-field input[type=time],.clcf-block-field input[type=url],.clcf-block-field select,.clcf-block-field textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;box-sizing:border-box;color:inherit;display:block;font:inherit;line-height:1.4;min-height:46px;padding:11px 14px;transition:border-color .15s ease,box-shadow .15s ease;width:100%}.clcf-block-field select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27%3E%3Cpath fill=%27none%27 stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-width=%272%27 d=%27m1 1 5 5 5-5%27/%3E%3C/svg%3E");background-position:right 14px center;background-repeat:no-repeat;padding-right:38px}.clcf-block-field input[type=date],.clcf-block-field input[type=time]{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.clcf-block-field textarea{min-height:92px;resize:vertical}.clcf-block-field input:hover,.clcf-block-field select:hover,.clcf-block-field textarea:hover{border-color:#b9bdc4}.clcf-block-field input:focus,.clcf-block-field input:focus-visible,.clcf-block-field select:focus,.clcf-block-field select:focus-visible,.clcf-block-field textarea:focus,.clcf-block-field textarea:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field ::-moz-placeholder{color:#9ca3af}.clcf-block-field ::placeholder{color:#9ca3af}.clcf-block-checkbox,.clcf-block-radios label{align-items:center;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;cursor:pointer;display:flex;font-weight:var(--clcf-fw-med,500);gap:11px;margin:0;padding:12px 14px;transition:border-color .15s ease,background-color .15s ease}.clcf-block-radios label+label{margin-top:8px}.clcf-block-checkbox:hover,.clcf-block-radios label:hover{border-color:#fdba74}.clcf-block-checkbox:has(input:checked),.clcf-block-radios label:has(input:checked){background:#fff7ed;border-color:#f97316}.clcf-block-checkbox input[type=checkbox],.clcf-block-radios input[type=radio]{accent-color:#f97316;cursor:pointer;flex:none;height:19px;margin:0;width:19px}.clcf-block-field input[type=file]{background:#fafafa;border:1.5px dashed #c9ccd2;border-radius:10px;box-sizing:border-box;color:#6b7280;cursor:pointer;display:block;font:inherit;padding:12px;transition:border-color .15s ease,background-color .15s ease;width:100%}.clcf-block-field input[type=file]:hover{background:#fff7ed;border-color:#f97316}.clcf-block-field input[type=file]:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field input[type=file]::file-selector-button{background:#fff;border:1.5px solid #d7d9de;border-radius:8px;color:#1f2328;cursor:pointer;font:inherit;font-weight:var(--clcf-fw-strong,600);margin-right:12px;padding:8px 14px;transition:border-color .15s ease}.clcf-block-field input[type=file]:hover::file-selector-button{border-color:#f97316;color:#ea580c}.clcf-block-field--heading strong{font-size:var(--clcf-fs-lg,1.15em)} 1 .clcf-block-fields.clcf-grid,.wc-block-components-totals-wrapper.slot-wrapper>*>.clcf-block-fields.clcf-grid{box-sizing:border-box;display:grid;gap:18px 16px;grid-template-columns:1fr 1fr;margin:0;padding:8px 16px 16px}.clcf-block-fields .clcf-w-full{grid-column:1/-1}@media (max-width:600px){.clcf-block-fields.clcf-grid{grid-template-columns:1fr}.clcf-block-fields .clcf-w-half{grid-column:1/-1}}.clcf-block-field__label{display:block;font-size:var(--clcf-fs-md,1em);font-weight:var(--clcf-fw-strong,600);line-height:1.35;margin-bottom:7px}.clcf-block-field__label abbr{border:none;color:#dc2626;margin-left:2px;text-decoration:none}.clcf-block-field__desc{color:#6b7280;display:block;font-size:var(--clcf-fs-sm,.85em);line-height:1.45;margin:-3px 0 7px}.clcf-block-field input[type=date],.clcf-block-field input[type=email],.clcf-block-field input[type=number],.clcf-block-field input[type=tel],.clcf-block-field input[type=text],.clcf-block-field input[type=time],.clcf-block-field input[type=url],.clcf-block-field select,.clcf-block-field textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;box-sizing:border-box;color:inherit;display:block;font:inherit;line-height:1.4;min-height:46px;padding:11px 14px;transition:border-color .15s ease,box-shadow .15s ease;width:100%}.clcf-block-field select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%278%27%3E%3Cpath fill=%27none%27 stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-width=%272%27 d=%27m1 1 5 5 5-5%27/%3E%3C/svg%3E");background-position:right 14px center;background-repeat:no-repeat;padding-right:38px}.clcf-block-field input[type=date],.clcf-block-field input[type=time]{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.clcf-block-field textarea{min-height:92px;resize:vertical}.clcf-block-field input:hover,.clcf-block-field select:hover,.clcf-block-field textarea:hover{border-color:#b9bdc4}.clcf-block-field input:focus,.clcf-block-field input:focus-visible,.clcf-block-field select:focus,.clcf-block-field select:focus-visible,.clcf-block-field textarea:focus,.clcf-block-field textarea:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field ::-moz-placeholder{color:#9ca3af}.clcf-block-field ::placeholder{color:#9ca3af}.clcf-block-checkbox,.clcf-block-radios label{align-items:center;background:#fff;border:1.5px solid #d7d9de;border-radius:10px;cursor:pointer;display:flex;font-weight:var(--clcf-fw-med,500);gap:11px;margin:0;padding:12px 14px;transition:border-color .15s ease,background-color .15s ease}.clcf-block-radios label+label{margin-top:8px}.clcf-block-checkbox:hover,.clcf-block-radios label:hover{border-color:#fdba74}.clcf-block-checkbox:has(input:checked),.clcf-block-radios label:has(input:checked){background:#fff7ed;border-color:#f97316}.clcf-block-checkbox input[type=checkbox],.clcf-block-radios input[type=radio]{accent-color:#f97316;cursor:pointer;flex:none;height:19px;margin:0;width:19px}.clcf-block-field input[type=file]{background:#fafafa;border:1.5px dashed #c9ccd2;border-radius:10px;box-sizing:border-box;color:#6b7280;cursor:pointer;display:block;font:inherit;padding:12px;transition:border-color .15s ease,background-color .15s ease;width:100%}.clcf-block-field input[type=file]:hover{background:#fff7ed;border-color:#f97316}.clcf-block-field input[type=file]:focus-visible{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.15);outline:none}.clcf-block-field input[type=file]::file-selector-button{background:#fff;border:1.5px solid #d7d9de;border-radius:8px;color:#1f2328;cursor:pointer;font:inherit;font-weight:var(--clcf-fw-strong,600);margin-right:12px;padding:8px 14px;transition:border-color .15s ease}.clcf-block-field input[type=file]:hover::file-selector-button{border-color:#f97316;color:#ea580c}.clcf-block-field--heading strong{font-size:var(--clcf-fs-lg,1.15em)}.clcf-block-delivery{display:flex;flex-wrap:wrap;gap:8px}.clcf-block-delivery select{flex:1;min-width:130px} -
corelabs-checkout-fields/trunk/corelabs-checkout-fields.php
r3630465 r3680119 4 4 * Plugin URI: https://alovio.org/checkout-fields 5 5 * Description: Add custom WooCommerce checkout fields with a drag-and-drop builder and full conditional logic — on classic and Block checkout. 6 * Version: 1. 4.06 * Version: 1.5.0 7 7 * Author: Alovio 8 8 * Author URI: https://alovio.org … … 17 17 defined( 'ABSPATH' ) || exit; 18 18 19 define( 'CLCF_VERSION', '1. 4.0' );19 define( 'CLCF_VERSION', '1.5.0' ); 20 20 define( 'CLCF_FILE', __FILE__ ); 21 21 define( 'CLCF_PATH', plugin_dir_path( __FILE__ ) ); -
corelabs-checkout-fields/trunk/includes/Checkout/BlockIntegration.php
r3630388 r3680119 158 158 // Static config only — the dynamic context comes from the cart Store API 159 159 // endpoint data (computed per-request, safely after wp_loaded). 160 $group = ( new FieldRepository() )->get(); 161 $data = array( 162 'fields' => array_values( (array) ( $group['fields'] ?? array() ) ), 160 $group = ( new FieldRepository() )->get(); 161 $fields = array_values( (array) ( $group['fields'] ?? array() ) ); 162 foreach ( $fields as &$fld ) { 163 // Give the Block checkout the same server-computed date list the classic 164 // renderer uses, so both offer identical valid days. 165 if ( 'delivery' === (string) ( $fld['type'] ?? '' ) ) { 166 $fld['validDates'] = DeliveryDates::valid_dates( $fld ); 167 } 168 } 169 unset( $fld ); 170 $data = array( 171 'fields' => $fields, 163 172 'upload' => array( 164 173 'url' => esc_url_raw( rest_url( 'clcf/v1/upload' ) ), -
corelabs-checkout-fields/trunk/includes/Checkout/ClassicRenderer.php
r3630388 r3680119 195 195 $val = ( '' !== $default ) ? sprintf( ' value="%s"', esc_attr( $default ) ) : ''; 196 196 printf( '<input type="date" id="%s" name="%s"%s%s%s%s />', esc_attr( $fid ), esc_attr( $name ), $req, $min, $max, $val ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 197 break; 198 } 199 case 'delivery': { 200 // Two selects posted as an array clcf[id][date] / clcf[id][slot]. The 201 // date options are the server-computed selectable dates, so only valid 202 // days are pickable and the classic checkout needs no date JS at all. 203 echo '<span class="clcf-delivery">'; 204 printf( 205 '<select class="clcf-delivery__date" id="%s" name="%s[date]"%s><option value="">%s</option>', 206 esc_attr( $fid ), 207 esc_attr( $name ), 208 $req, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 209 esc_html__( 'Choose a date', 'corelabs-checkout-fields' ) 210 ); 211 foreach ( DeliveryDates::valid_dates( $f ) as $d ) { 212 $sel = ( $d['value'] === $default ) ? ' selected' : ''; 213 printf( '<option value="%s"%s>%s</option>', esc_attr( $d['value'] ), $sel, esc_html( $d['label'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 214 } 215 echo '</select>'; 216 $slots = (array) ( $f['timeSlots'] ?? array() ); 217 if ( ! empty( $slots ) ) { 218 printf( 219 '<select class="clcf-delivery__slot" name="%s[slot]"%s><option value="">%s</option>', 220 esc_attr( $name ), 221 $req, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 222 esc_html__( 'Choose a time', 'corelabs-checkout-fields' ) 223 ); 224 foreach ( $slots as $s ) { 225 printf( '<option value="%s">%s</option>', esc_attr( (string) $s ), esc_html( (string) $s ) ); 226 } 227 echo '</select>'; 228 } 229 echo '</span>'; 197 230 break; 198 231 } -
corelabs-checkout-fields/trunk/includes/Checkout/OrderPersistence.php
r3630388 r3680119 197 197 return (string) ( (float) $val ); 198 198 } 199 if ( 'delivery' === $type ) { 200 $parts = explode( '|', (string) $val, 2 ); 201 $ts = strtotime( (string) ( $parts[0] ?? '' ) ); 202 $date = $ts ? wp_date( (string) get_option( 'date_format' ), $ts ) : (string) ( $parts[0] ?? '' ); 203 $slot = (string) ( $parts[1] ?? '' ); 204 return '' !== $slot ? $date . ' · ' . $slot : $date; 205 } 199 206 return (string) $val; 200 207 } -
corelabs-checkout-fields/trunk/includes/Checkout/Sanitizer.php
r3630388 r3680119 63 63 } 64 64 break; 65 case 'delivery': 66 // Classic posts an array clcf[id][date]/[slot]; Block sends the 67 // composite string directly. Store one scalar "date|slot". 68 if ( is_array( $val ) ) { 69 $d = sanitize_text_field( (string) ( $val['date'] ?? '' ) ); 70 $s = sanitize_text_field( (string) ( $val['slot'] ?? '' ) ); 71 } else { 72 $parts = explode( '|', (string) $val, 2 ); 73 $d = sanitize_text_field( (string) ( $parts[0] ?? '' ) ); 74 $s = sanitize_text_field( (string) ( $parts[1] ?? '' ) ); 75 } 76 $s = str_replace( '|', '', $s ); 77 if ( '' !== $d || '' !== $s ) { 78 $out[ $id ] = $d . '|' . $s; 79 } 80 break; 65 81 case 'number': 66 82 if ( null !== $val && '' !== $val ) { -
corelabs-checkout-fields/trunk/includes/Checkout/Validator.php
r3630388 r3680119 93 93 } 94 94 95 if ( 'delivery' === $type ) { 96 $parts = explode( '|', (string) $value, 2 ); 97 $date = (string) ( $parts[0] ?? '' ); 98 $slot = (string) ( $parts[1] ?? '' ); 99 100 if ( ! DeliveryDates::is_valid( $f, $date ) ) { 101 /* translators: %s: field label */ 102 $errors[] = sprintf( __( '“%s”: that delivery date is not available. Please choose another.', 'corelabs-checkout-fields' ), $label ); 103 } 104 $slots = (array) ( $f['timeSlots'] ?? array() ); 105 if ( ! empty( $slots ) && ! in_array( $slot, $slots, true ) ) { 106 /* translators: %s: field label */ 107 $errors[] = sprintf( __( '“%s”: please choose a delivery time.', 'corelabs-checkout-fields' ), $label ); 108 } 109 } 110 95 111 if ( in_array( $type, array( 'select', 'radio' ), true ) && ! empty( $f['options'] ) ) { 96 112 // Options may be bare strings or {label, price}. -
corelabs-checkout-fields/trunk/includes/Fields/FieldSchema.php
r3630388 r3680119 259 259 } 260 260 261 if ( 'delivery' === $type ) { 262 $weekdays = array(); 263 foreach ( (array) ( $f['disabledWeekdays'] ?? array() ) as $d ) { 264 $d = (int) $d; 265 if ( $d >= 0 && $d <= 6 ) { 266 $weekdays[ $d ] = $d; // dedupe 267 } 268 } 269 $dates = array(); 270 foreach ( (array) ( $f['disabledDates'] ?? array() ) as $d ) { 271 $d = trim( sanitize_text_field( (string) $d ) ); 272 if ( preg_match( '/^\d{4}-\d{2}-\d{2}$/', $d ) ) { 273 $dates[ $d ] = $d; 274 } 275 } 276 $slots = array(); 277 foreach ( (array) ( $f['timeSlots'] ?? array() ) as $s ) { 278 // '|' is our date/slot separator in the stored value, so it can't live in a slot label. 279 $s = trim( str_replace( '|', '', sanitize_text_field( (string) $s ) ) ); 280 if ( '' !== $s ) { 281 $slots[] = $s; 282 } 283 } 284 $cutoff = trim( (string) ( $f['cutoffTime'] ?? '' ) ); 285 if ( ! preg_match( '/^([01]\d|2[0-3]):[0-5]\d$/', $cutoff ) ) { 286 $cutoff = ''; 287 } 288 return array( 289 'disabledWeekdays' => array_values( $weekdays ), 290 'disabledDates' => array_values( $dates ), 291 'minLeadDays' => max( 0, (int) ( $f['minLeadDays'] ?? 0 ) ), 292 'daysAhead' => min( 365, max( 1, (int) ( $f['daysAhead'] ?? 21 ) ) ), 293 'cutoffTime' => $cutoff, 294 'timeSlots' => $slots, 295 ); 296 } 297 261 298 return array(); 262 299 } -
corelabs-checkout-fields/trunk/includes/Fields/FieldTypes.php
r3596082 r3680119 13 13 14 14 /** @var string[] Built-in field types (everything is free). */ 15 public const FREE = array( 'text', 'textarea', 'number', 'checkbox', 'radio', 'select', 'heading', 'email', 'phone', 'url', 'date', 'time', ' file' );15 public const FREE = array( 'text', 'textarea', 'number', 'checkbox', 'radio', 'select', 'heading', 'email', 'phone', 'url', 'date', 'time', 'delivery', 'file' ); 16 16 17 17 /** @return string[] */ -
corelabs-checkout-fields/trunk/languages/corelabs-checkout-fields.pot
r3630465 r3680119 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Alovio Checkout Fields for WooCommerce 1. 4.0\n"5 "Project-Id-Version: Alovio Checkout Fields for WooCommerce 1.5.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/corelabs-checkout-fields\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2026-0 7-31T20:22:51+00:00\n"12 "POT-Creation-Date: 2026-09-03T16:54:18+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 110 110 msgstr "" 111 111 112 #: includes/Checkout/ClassicRenderer.php:209 113 #: src/block-checkout/index.js:147 114 msgid "Choose a date" 115 msgstr "" 116 117 #: includes/Checkout/ClassicRenderer.php:222 118 #: src/block-checkout/index.js:154 119 msgid "Choose a time" 120 msgstr "" 121 112 122 #. translators: %s: percentage number 113 #: includes/Checkout/ClassicRenderer.php:2 51123 #: includes/Checkout/ClassicRenderer.php:284 114 124 #, php-format 115 125 msgid "+%s%%" … … 117 127 118 128 #. translators: 1: option label, 2: price suffix, e.g. "+$10.00" 119 #: includes/Checkout/ClassicRenderer.php: 269129 #: includes/Checkout/ClassicRenderer.php:302 120 130 #, php-format 121 131 msgid "%1$s (%2$s)" … … 220 230 221 231 #. translators: %s: field label 222 #: includes/Checkout/Validator.php:100 232 #: includes/Checkout/Validator.php:102 233 #, php-format 234 msgid "“%s”: that delivery date is not available. Please choose another." 235 msgstr "" 236 237 #. translators: %s: field label 238 #: includes/Checkout/Validator.php:107 239 #, php-format 240 msgid "“%s”: please choose a delivery time." 241 msgstr "" 242 243 #. translators: %s: field label 244 #: includes/Checkout/Validator.php:116 223 245 #, php-format 224 246 msgid "“%s” has an invalid selection." 225 247 msgstr "" 226 248 227 #: src/block-checkout/index.js:2 07249 #: src/block-checkout/index.js:231 228 250 msgid "Attached file" 229 251 msgstr "" 230 252 231 #: src/block-checkout/index.js:2 11253 #: src/block-checkout/index.js:235 232 254 msgid "Remove file" 233 255 msgstr "" -
corelabs-checkout-fields/trunk/readme.txt
r3630465 r3680119 4 4 Tags: woocommerce, checkout, checkout fields, conditional logic, custom fields 5 5 Requires at least: 6.4 6 Tested up to: 7. 06 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1. 4.08 Stable tag: 1.5.0 9 9 License: GPL-2.0-or-later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 = 1.5.0 = 86 * NEW: **Delivery date & time** field. Shoppers pick a delivery date and a time slot right on the checkout — and you decide what's offered: block weekends or any weekdays, block specific holiday dates, set a minimum lead time and a daily cutoff (orders after it start counting from the next day), and define the time slots (e.g. 9:00–12:00). Only valid dates are ever selectable, it works identically on the classic checkout and the Block (Store API) checkout, and the same rules are enforced again on the server. 87 * Tested up to WordPress 7.1. 88 85 89 = 1.4.0 = 86 90 * NEW: A "Donate" button in the builder header. It opens a short note explaining that the plugin is free and stays free — conditional logic included, which most plugins in this category charge for — and offers a coffee or a review for anyone who wants to support it. It replaces the cross-promo link that used to sit in the header. -
corelabs-checkout-fields/trunk/src/block-checkout/index.js
r3630388 r3680119 136 136 } else if ( field.type === 'date' ) { 137 137 control = <input type="date" { ...common } min={ field.min || undefined } max={ field.max || undefined } />; 138 } else if ( field.type === 'delivery' ) { 139 // Value is the composite "date|slot"; the date options are the same 140 // server-computed valid days the classic checkout uses (field.validDates). 141 const [ curDate = '', curSlot = '' ] = String( value || '' ).split( '|' ); 142 const slots = field.timeSlots || []; 143 const emit = ( d, s ) => onChange( `${ d }|${ s }` ); 144 control = ( 145 <span className="clcf-block-delivery"> 146 <select id={ id } required={ !! field.required } value={ curDate } onChange={ ( e ) => emit( e.target.value, curSlot ) }> 147 <option value="">{ __( 'Choose a date', 'corelabs-checkout-fields' ) }</option> 148 { ( field.validDates || [] ).map( ( d ) => ( 149 <option key={ d.value } value={ d.value }>{ d.label }</option> 150 ) ) } 151 </select> 152 { slots.length > 0 && ( 153 <select className="clcf-block-delivery__slot" required={ !! field.required } value={ curSlot } onChange={ ( e ) => emit( curDate, e.target.value ) }> 154 <option value="">{ __( 'Choose a time', 'corelabs-checkout-fields' ) }</option> 155 { slots.map( ( s, i ) => ( 156 <option key={ i } value={ s }>{ s }</option> 157 ) ) } 158 </select> 159 ) } 160 </span> 161 ); 138 162 } else if ( field.type === 'file' ) { 139 163 const cfg = CONFIG.upload || {}; -
corelabs-checkout-fields/trunk/src/block-checkout/style.css
r3630388 r3680119 167 167 /* Heading */ 168 168 .clcf-block-field--heading strong { font-size: var(--clcf-fs-lg, 1.15em); } 169 170 /* Delivery date + time slot selects */ 171 .clcf-block-delivery { display: flex; gap: 8px; flex-wrap: wrap; } 172 .clcf-block-delivery select { flex: 1; min-width: 130px; } -
corelabs-checkout-fields/trunk/src/builder/FieldPreview.jsx
r3630388 r3680119 53 53 case 'time': 54 54 return <div className="clcf-input clcf-input--icon">{ __( 'Select time', T ) } <FieldIcon type="time" size={ 15 } /></div>; 55 case 'delivery': 56 return ( 57 <div style={ { display: 'flex', gap: 6 } }> 58 <div className="clcf-input clcf-input--icon" style={ { flex: 1 } }>{ __( 'Select date', T ) } <FieldIcon type="delivery" size={ 15 } /></div> 59 { ( field.timeSlots || [] ).length > 0 && ( 60 <div className="clcf-input" style={ { flex: 1 } }>{ field.timeSlots[ 0 ] || __( 'Time', T ) } ▾</div> 61 ) } 62 </div> 63 ); 55 64 case 'file': 56 65 return <div className="clcf-input clcf-input--icon"><FieldIcon type="file" size={ 15 } /> { __( 'Choose file…', T ) }</div>; -
corelabs-checkout-fields/trunk/src/builder/Palette.jsx
r3630388 r3680119 22 22 date: __( 'Date', T ), 23 23 time: __( 'Time', T ), 24 delivery: __( 'Delivery', T ), 24 25 file: __( 'File', T ), 25 26 }; -
corelabs-checkout-fields/trunk/src/builder/panels/General.jsx
r3630388 r3680119 1 1 import { useDispatch } from '@wordpress/data'; 2 import { TextControl, ToggleControl, TextareaControl, SelectControl, Notice } from '@wordpress/components';2 import { TextControl, ToggleControl, TextareaControl, SelectControl, Notice, Button } from '@wordpress/components'; 3 3 import { __ } from '@wordpress/i18n'; 4 4 import { STORE } from '../store'; … … 6 6 7 7 const T = 'corelabs-checkout-fields'; 8 const WEEKDAYS = () => [ 9 __( 'Sun', T ), __( 'Mon', T ), __( 'Tue', T ), __( 'Wed', T ), __( 'Thu', T ), __( 'Fri', T ), __( 'Sat', T ), 10 ]; 11 12 /** Constraints editor for the Delivery date field. */ 13 function DeliveryControls( { field, set } ) { 14 const disabled = field.disabledWeekdays || []; 15 const dates = field.disabledDates || []; 16 const slots = field.timeSlots || []; 17 18 const toggleWeekday = ( i, on ) => { 19 const s = new Set( disabled ); 20 if ( on ) { s.add( i ); } else { s.delete( i ); } 21 set( { disabledWeekdays: [ ...s ].sort( ( a, b ) => a - b ) } ); 22 }; 23 const patchList = ( key, list ) => set( { [ key ]: list } ); 24 25 return ( 26 <div className="clcf-delivery-cfg"> 27 <p className="clcf-cfg-label">{ __( 'Unavailable weekdays', T ) }</p> 28 <div className="clcf-weekdays"> 29 { WEEKDAYS().map( ( name, i ) => ( 30 <label key={ i } className="clcf-weekday"> 31 <input type="checkbox" checked={ disabled.includes( i ) } onChange={ ( e ) => toggleWeekday( i, e.target.checked ) } /> { name } 32 </label> 33 ) ) } 34 </div> 35 36 <div style={ { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 } }> 37 <TextControl type="number" min={ 0 } label={ __( 'Earliest in (days)', T ) } help={ __( 'Lead time before the first date.', T ) } value={ field.minLeadDays ?? 1 } onChange={ ( v ) => set( { minLeadDays: Math.max( 0, parseInt( v, 10 ) || 0 ) } ) } /> 38 <TextControl type="number" min={ 1 } max={ 365 } label={ __( 'Offer up to (days)', T ) } help={ __( 'How far ahead to list.', T ) } value={ field.daysAhead ?? 21 } onChange={ ( v ) => set( { daysAhead: Math.min( 365, Math.max( 1, parseInt( v, 10 ) || 1 ) ) } ) } /> 39 </div> 40 41 <TextControl type="time" label={ __( 'Daily cutoff', T ) } help={ __( 'After this time, the lead time counts from the next day.', T ) } value={ field.cutoffTime || '' } onChange={ ( v ) => set( { cutoffTime: v } ) } /> 42 43 <p className="clcf-cfg-label">{ __( 'Blocked dates (holidays)', T ) }</p> 44 { dates.map( ( d, i ) => ( 45 <div key={ i } className="clcf-cfg-row"> 46 <input type="date" value={ d } onChange={ ( e ) => patchList( 'disabledDates', dates.map( ( x, j ) => ( j === i ? e.target.value : x ) ) ) } /> 47 <Button isDestructive variant="tertiary" aria-label={ __( 'Remove date', T ) } onClick={ () => patchList( 'disabledDates', dates.filter( ( _, j ) => j !== i ) ) }>✕</Button> 48 </div> 49 ) ) } 50 <Button variant="secondary" onClick={ () => patchList( 'disabledDates', [ ...dates, '' ] ) }>+ { __( 'Add blocked date', T ) }</Button> 51 52 <p className="clcf-cfg-label">{ __( 'Time slots (optional)', T ) }</p> 53 { slots.map( ( s, i ) => ( 54 <div key={ i } className="clcf-cfg-row"> 55 <TextControl hideLabelFromVision label={ __( 'Time slot', T ) } placeholder={ __( 'e.g. 9:00–12:00', T ) } value={ s } onChange={ ( v ) => patchList( 'timeSlots', slots.map( ( x, j ) => ( j === i ? v : x ) ) ) } /> 56 <Button isDestructive variant="tertiary" aria-label={ __( 'Remove slot', T ) } onClick={ () => patchList( 'timeSlots', slots.filter( ( _, j ) => j !== i ) ) }>✕</Button> 57 </div> 58 ) ) } 59 <Button variant="secondary" onClick={ () => patchList( 'timeSlots', [ ...slots, '' ] ) }>+ { __( 'Add time slot', T ) }</Button> 60 </div> 61 ); 62 } 8 63 const HAS_OPTIONS = [ 'radio', 'select' ]; 9 64 const HAS_PLACEHOLDER = [ 'text', 'textarea', 'number', 'email', 'phone', 'url' ]; … … 70 125 ) } 71 126 127 { field.type === 'delivery' && <DeliveryControls field={ field } set={ set } /> } 128 72 129 { field.type === 'file' && ( 73 130 <TextControl -
corelabs-checkout-fields/trunk/src/builder/reducer.js
r3596082 r3680119 23 23 date: { label: 'Pick a date', ...BASE, min: '', max: '' }, 24 24 time: { label: 'Pick a time', ...BASE }, 25 delivery: { label: 'Delivery date', ...BASE, disabledWeekdays: [ 0 ], disabledDates: [], minLeadDays: 1, daysAhead: 21, cutoffTime: '', timeSlots: [] }, 25 26 file: { label: 'Upload a file', ...BASE }, 26 27 }; -
corelabs-checkout-fields/trunk/src/shared/FieldIcon.jsx
r3630388 r3680119 45 45 // Clock. 46 46 time: <><circle cx="12" cy="12" r="8.7" /><path d="M12 7v5.3l3.4 2" /></>, 47 // Calendar with a clock hand — a scheduled delivery date + time. 48 delivery: <><rect x="3" y="5" width="18" height="16" rx="2.5" /><path d="M8 3v4" /><path d="M16 3v4" /><path d="M3 10h18" /><path d="M12 13.3v2.4l1.7 1" /></>, 47 49 // Stepper arrows. 48 50 // Two buttons side by side, the left one picked. -
corelabs-checkout-fields/trunk/vendor/composer/autoload_classmap.php
r3630388 r3680119 15 15 'CoreLabs\\CheckoutFields\\Checkout\\CheckoutConditionData' => $baseDir . '/includes/Checkout/CheckoutConditionData.php', 16 16 'CoreLabs\\CheckoutFields\\Checkout\\ClassicRenderer' => $baseDir . '/includes/Checkout/ClassicRenderer.php', 17 'CoreLabs\\CheckoutFields\\Checkout\\DeliveryDates' => $baseDir . '/includes/Checkout/DeliveryDates.php', 17 18 'CoreLabs\\CheckoutFields\\Checkout\\FeeCalculator' => $baseDir . '/includes/Checkout/FeeCalculator.php', 18 19 'CoreLabs\\CheckoutFields\\Checkout\\FeesIntegration' => $baseDir . '/includes/Checkout/FeesIntegration.php', -
corelabs-checkout-fields/trunk/vendor/composer/autoload_static.php
r3630388 r3680119 30 30 'CoreLabs\\CheckoutFields\\Checkout\\CheckoutConditionData' => __DIR__ . '/../..' . '/includes/Checkout/CheckoutConditionData.php', 31 31 'CoreLabs\\CheckoutFields\\Checkout\\ClassicRenderer' => __DIR__ . '/../..' . '/includes/Checkout/ClassicRenderer.php', 32 'CoreLabs\\CheckoutFields\\Checkout\\DeliveryDates' => __DIR__ . '/../..' . '/includes/Checkout/DeliveryDates.php', 32 33 'CoreLabs\\CheckoutFields\\Checkout\\FeeCalculator' => __DIR__ . '/../..' . '/includes/Checkout/FeeCalculator.php', 33 34 'CoreLabs\\CheckoutFields\\Checkout\\FeesIntegration' => __DIR__ . '/../..' . '/includes/Checkout/FeesIntegration.php',
Note:
See TracChangeset
for help on using the changeset viewer.