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2.1 11.2.2 11.3 11.3.1 11.3.2 11.3.3 11.3.4 11.4 11.4.1 11.4.2 11.5 11.5.1 11.5.2 11.5.3 11.6 11.6.1 11.6.2 11.7 11.7.1 11.7.2 11.7.3 11.8 11.8.3 11.8.4 11.8.5 11.8.6 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / jetpack_vendor / automattic / jetpack-forms / dist / blocks / 913.js
jetpack / jetpack_vendor / automattic / jetpack-forms / dist / blocks Last commit date
field-image-select 3 months ago field-rating 6 months ago form-progress-indicator 3 months ago form-step-navigation 1 month ago images 9 months ago input-range 3 months ago 187.js 5 days ago 712.js 5 days ago 712.js.LICENSE.txt 5 days ago 913.css 5 days ago 913.js 5 days ago 913.rtl.css 5 days ago 93.css 2 weeks ago 93.js 5 days ago 93.rtl.css 2 weeks ago ai-form-plugin.asset.php 5 days ago ai-form-plugin.js 5 days ago block.json 5 days ago editor.asset.php 5 days ago editor.css 5 days ago editor.js 5 days ago editor.rtl.css 5 days ago view.asset.php 5 days ago view.js 5 days ago
913.js
7 lines
1 "use strict";(globalThis.webpackChunk_automattic_jetpack_forms_blocks=globalThis.webpackChunk_automattic_jetpack_forms_blocks||[]).push([[913],{21276(){},21913(e,t,o){o.r(t),o.d(t,{default:()=>k});var a=o(94715),n=o(56427),i=o(47143),s=o(86087),l=o(27723),r=o(15210),c=o(28755),d=o(39968),u=o(21220),p=o(13022),m=o(6888),f=o(73340),_=o(97806),h=o(1578),j=(o(21276),o(10790));const __=l.__,g=({rule:e,subject:t})=>{const{toggleBlockHighlight:o}=(0,i.useDispatch)(a.store),n=t?.clientId,l=(0,s.useCallback)(e=>n&&o(n,e),[n,o]);return(0,s.useEffect)(()=>()=>l(!1),[l]),(0,j.jsx)("li",{className:"jetpack-contact-form__conditional-logic-summary-item",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),children:(0,j.jsx)(d.E,{variant:"body-sm",children:(0,_.IO)(e,t)})})},k=({clientId:e,attributes:t,setAttributes:o})=>{const[i,l]=(0,s.useState)(!1),k=(0,s.useMemo)(()=>(0,m.m3)(t.conditionalLogic),[t.conditionalLogic]),b=(0,f.A)(e),T=(0,m.Mg)(k),S=(0,s.useCallback)(e=>o({conditionalLogic:e}),[o]),E=(0,s.useCallback)(e=>S({...k,action:e}),[k,S]),C=(0,s.useCallback)(e=>S((0,m.fs)(k,T.rules,e)),[T.rules,k,S]),N=(0,s.useCallback)(e=>S((0,m.fs)(k,e,T.logicalOperator)),[T.logicalOperator,k,S]),x=(0,s.useCallback)(()=>l(!0),[]),A=(0,s.useCallback)(()=>l(!1),[]),I=(0,m.Vd)(k)>0,O=(0,_.l5)(T,b);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a.BlockControls,{__experimentalShareWithChildBlocks:!0,children:(0,j.jsx)(n.ToolbarGroup,{children:(0,j.jsx)(n.ToolbarButton,{icon:(0,m.qu)(k)?c.A:r.A,title:O.length?(0,_.Of)(k,T,b):__("Add conditional logic","jetpack-forms"),onClick:x,className:(0,p.A)("jetpack-contact-form__conditional-logic-toolbar",{"is-pressed":I})})})}),(0,j.jsxs)(a.InspectorControls,{children:[(0,j.jsx)(n.PanelBody,{title:__("Conditional logic","jetpack-forms"),initialOpen:!1,className:"jetpack-contact-form__panel jetpack-contact-form__conditional-logic",children:(0,j.jsxs)(u.B,{direction:"column",gap:"md",children:[O.length?(0,j.jsxs)(u.B,{direction:"column",gap:"xs",children:[(0,j.jsx)(d.E,{variant:"body-sm",className:"jetpack-contact-form__conditional-logic-summary-text",children:(0,_.Bi)(k,T)}),(0,j.jsx)("ul",{className:"jetpack-contact-form__conditional-logic-summary-list",children:O.map(({rule:e,subject:t},o)=>(0,j.jsx)(g,{rule:e,subject:t},o))})]}):(0,j.jsx)(d.E,{variant:"body-sm",className:"jetpack-contact-form__conditional-logic-summary-text",children:__("Show or hide this field based on the answer to another field.","jetpack-forms")}),(0,j.jsx)(n.Button,{variant:"secondary",onClick:x,__next40pxDefaultSize:!0,className:"jetpack-contact-form__conditional-logic-edit",children:I?__("Edit conditions","jetpack-forms"):__("Add conditions","jetpack-forms",0)})]})}),(0,j.jsx)(h.A,{isOpen:i,onClose:A,logic:k,group:T,fields:b,ownFieldId:t.id,onActionChange:E,onMatchChange:C,onRulesChange:N})]})]})}},1578(e,t,o){o.d(t,{A:()=>u});var a=o(56427),n=o(27723),i=o(21220),s=o(39968),l=o(37050),r=o(10790);const __=n.__,c=[{value:"show",label:__("Show this field","jetpack-forms")},{value:"hide",label:__("Hide this field","jetpack-forms")}],d=[{value:"any",label:__("if any","jetpack-forms")},{value:"all",label:__("if all","jetpack-forms")}],u=({isOpen:e,onClose:t,logic:o,group:n,fields:u,ownFieldId:p,onActionChange:m,onMatchChange:f,onRulesChange:_})=>e?(0,r.jsx)(a.Modal,{title:__("Conditional logic","jetpack-forms"),onRequestClose:t,size:"large",className:"jetpack-contact-form__conditional-logic-modal",children:(0,r.jsxs)(i.B,{direction:"column",gap:"md",children:[(0,r.jsxs)(i.B,{direction:"row",align:"center",gap:"sm",className:"jetpack-contact-form__conditional-logic-sentence",children:[(0,r.jsx)(a.SelectControl,{label:__("Action","jetpack-forms"),hideLabelFromVision:!0,value:o.action,options:c,onChange:m,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,r.jsx)(a.SelectControl,{label:__("When","jetpack-forms"),hideLabelFromVision:!0,value:n.logicalOperator,options:d,onChange:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})]}),(0,r.jsx)(s.E,{variant:"body-sm",className:"jetpack-contact-form__conditional-logic-hint",children:"hide"===o.action?__("This field is visible by default, until the following conditions are met:","jetpack-forms"):__("This field is hidden by default, until the following conditions are met:","jetpack-forms",0)}),(0,r.jsx)(l.A,{rules:n.rules,fields:u,ownFieldId:p,onChange:_})]})}):null},37050(e,t,o){o.d(t,{A:()=>x});var a=o(56427),n=o(86087),i=o(27723),s=o(53758),l=o(88901),r=o(60167),c=o(57839),d=o(21220),u=o(33180),p=o(72326),m=o(13022),f=o(6888),_=o(73340),h=o(13537),j=o(26103),g=o(35723),k=o(90445),b=o(10790);const __=i.__,T={number:"number",date:"date",time:"time"},S=e=>e.id||`clientId:${e.clientId}`,E=({rule:e,subject:t,onChange:o})=>{if(!(0,j.vA)(e.operator))return null;const n=(0,j.mv)(t?.typeKey||"string");if("none"===n)return null;const i=e.value??"",s=__("Value","jetpack-forms");if("options"===n){const e=t?.options||[];return e.length?(0,b.jsx)(a.SelectControl,{label:s,hideLabelFromVision:!0,value:i,options:[{value:"",label:__("Select an option…","jetpack-forms")},...e],onChange:o,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}):(0,b.jsx)(a.Notice,{status:"warning",isDismissible:!1,children:__("This field has no options yet. Add one to compare against it.","jetpack-forms")})}const l=T[n]||"text";return(0,b.jsx)(a.TextControl,{label:s,hideLabelFromVision:!0,placeholder:__("Value","jetpack-forms"),type:l,value:i,onChange:o,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},C=({rule:e,index:t,fields:o,ownFieldId:r,shouldFocus:p,onChange:f,onRemove:T})=>{const C=(0,n.useRef)(null);(0,n.useEffect)(()=>{p&&C.current?.focus()},[p]);const N=(0,_.V)(),x=o.find(t=>t.id&&t.id===e.field),A=e.field&&!x,I=(0,n.useCallback)(a=>{const n=o.find(e=>S(e)===a);if(!n)return void f(t,{field:"",operator:j.we.IS,value:""});const i=[...o.map(e=>e.id),r].filter(Boolean),s=N(n,i),l=(0,j.qP)(n.typeKey).includes(e.operator)?e.operator:(e=>{const t=(0,j.qP)(e);return t.length?t[0]:j.we.IS})(n.typeKey);f(t,{field:s,operator:l,value:""})},[N,o,r,t,f,e.operator]),O=(0,n.useCallback)(e=>f(t,{operator:e}),[t,f]),y=(0,n.useCallback)(e=>f(t,{value:e}),[t,f]),v=(0,n.useCallback)(()=>T(t),[t,T]),w=(0,j.qP)(x?.typeKey||"string"),B=(0,k._A)(e,x),M=__("This condition is active.","jetpack-forms");let L=__("Choose a field to compare against.","jetpack-forms");A?L=__("The field this condition refers to no longer exists.","jetpack-forms"):(0,k.Cc)(e)&&(L=__("Give this condition a value.","jetpack-forms"));const F=o.reduce((e,t)=>{const o=t.step?(0,i.sprintf)(/* translators: %d: step number in a multi-step form */
2 __("Step %d","jetpack-forms"),t.step):__("Fields","jetpack-forms");return e[o]=e[o]||[],e[o].push(t),e},{});return(0,b.jsxs)(d.B,{direction:"column",gap:"xs",className:"jetpack-contact-form__conditional-logic-rule",children:[A&&(0,b.jsx)(a.Notice,{status:"warning",isDismissible:!1,children:__("The referenced field no longer exists. Pick another field or remove this condition.","jetpack-forms")}),(0,b.jsxs)(d.B,{direction:"row",align:"center",gap:"sm",className:"jetpack-contact-form__conditional-logic-rule-row",children:[(0,b.jsx)(a.Tooltip,{text:B?M:L,children:(0,b.jsx)("span",{className:(0,m.A)("jetpack-contact-form__conditional-logic-rule-status",{"is-active":B}),role:"img","aria-label":B?M:L,children:(0,b.jsx)(a.Icon,{icon:B?l.A:s.A,size:20})})}),(0,b.jsxs)(a.SelectControl,{ref:C,label:__("Field","jetpack-forms"),hideLabelFromVision:!0,value:e.field||"",onChange:I,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,children:[(0,b.jsx)("option",{value:"",children:__("Select a field…","jetpack-forms")}),Object.keys(F).map(e=>(0,b.jsx)("optgroup",{label:e,children:F[e].map(e=>(0,b.jsx)("option",{value:S(e),children:(0,h.C)(e)},e.clientId))},e))]}),(0,b.jsx)(a.SelectControl,{label:__("Operator","jetpack-forms"),hideLabelFromVision:!0,value:e.operator,options:w.map(e=>({value:e,label:(0,g.B)(e)})),onChange:O,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,b.jsx)(E,{rule:e,subject:x,onChange:y}),(0,b.jsx)(u.K,{size:"small",variant:"minimal",tone:"neutral",icon:c.A,onClick:v,label:(0,i.sprintf)(/* translators: %d: condition number, starting at 1 */
3 __("Remove condition %d","jetpack-forms"),t+1)})]})]})},N={type:f.Th,field:"",operator:j.we.IS,value:""},x=({rules:e,onChange:t,fields:o,ownFieldId:i})=>{const s=(0,n.useMemo)(()=>Array.isArray(e)?e:[],[e]),l=(0,n.useMemo)(()=>s.length?s:[N],[s]),[c,u]=(0,n.useState)(null),m=(0,n.useCallback)((e,o)=>{s.length?t(s.map((t,a)=>a===e?{...t,...o}:t)):t([{...N,...o}])},[t,s]),f=(0,n.useCallback)(e=>{t(s.filter((t,o)=>o!==e))},[t,s]),_=(0,n.useCallback)(()=>{u(s.length),t([...s,{...N}])},[t,s]);return o.length?(0,b.jsxs)(d.B,{direction:"column",gap:"md",className:"jetpack-contact-form__conditional-logic-control",children:[l.map((e,t)=>(0,b.jsx)(C,{rule:e,index:t,fields:o,ownFieldId:i,shouldFocus:t===c,onChange:m,onRemove:f},t)),(0,b.jsx)(p.$,{variant:"outline",tone:"neutral",icon:r.A,onClick:_,className:"jetpack-contact-form__conditional-logic-add",children:__("Add condition","jetpack-forms")})]}):(0,b.jsx)(a.Notice,{status:"warning",isDismissible:!1,children:__("Add another field to this form to use as a condition.","jetpack-forms")})}},47088(e,t,o){o.d(t,{r:()=>s});const a=["jetpack/option","jetpack/input-image-option"],n=e=>{const t=new Set,o=[];return e.forEach(e=>{if("string"!=typeof e)return;const a=e.trim();""===a||t.has(a)||(t.add(a),o.push({value:a,label:a}))}),o},i=(e,t)=>{Array.isArray(e)&&e.forEach(e=>{e&&(e.name&&a.includes(e.name)?t.push(e.attributes?.label):i(e.innerBlocks,t))})},s=e=>{if(!e)return[];if("jetpack/field-rating"===e.name){const t=Number(e.attributes?.max),o=Number.isFinite(t)&&t>0?Math.floor(t):5;return Array.from({length:o},(e,t)=>({value:String(t+1),label:String(t+1)}))}if("jetpack/field-select"===e.name){const t=e.attributes?.options;return Array.isArray(t)?n(t):[]}const t=[];return i(e.innerBlocks,t),n(t)}},26103(e,t,o){o.d(t,{mv:()=>r,qP:()=>l,vA:()=>c,we:()=>a});const a={IS:"is",IS_NOT:"is_not",CONTAINS:"contains",DOES_NOT_CONTAIN:"does_not_contain",IS_EMPTY:"is_empty",IS_NOT_EMPTY:"is_not_empty",EQUALS:"equals",NOT_EQUALS:"not_equals",GREATER_THAN:"greater_than",LESS_THAN:"less_than",GTE:"gte",LTE:"lte",BEFORE:"before",AFTER:"after",IS_CHECKED:"is_checked",IS_NOT_CHECKED:"is_not_checked"},n=new Set([a.IS_EMPTY,a.IS_NOT_EMPTY,a.IS_CHECKED,a.IS_NOT_CHECKED]),i={string:[a.IS,a.IS_NOT,a.CONTAINS,a.DOES_NOT_CONTAIN,a.IS_EMPTY,a.IS_NOT_EMPTY],choice:[a.IS,a.IS_NOT,a.IS_EMPTY,a.IS_NOT_EMPTY],multichoice:[a.CONTAINS,a.DOES_NOT_CONTAIN,a.IS_EMPTY,a.IS_NOT_EMPTY],rating:[a.EQUALS,a.NOT_EQUALS,a.GREATER_THAN,a.LESS_THAN,a.GTE,a.LTE,a.IS_EMPTY,a.IS_NOT_EMPTY],number:[a.EQUALS,a.NOT_EQUALS,a.GREATER_THAN,a.LESS_THAN,a.GTE,a.LTE,a.IS_EMPTY,a.IS_NOT_EMPTY],date:[a.IS,a.IS_NOT,a.BEFORE,a.AFTER],time:[a.IS,a.IS_NOT,a.BEFORE,a.AFTER],boolean:[a.IS_CHECKED,a.IS_NOT_CHECKED],hidden:[a.IS,a.IS_NOT,a.CONTAINS],file:[a.IS_EMPTY,a.IS_NOT_EMPTY]},s={string:"text",choice:"options",multichoice:"options",number:"number",rating:"options",date:"date",time:"time",boolean:"none",hidden:"text",file:"none"},l=e=>i[e]??[],r=e=>s[e]??"text",c=e=>!n.has(e)},35723(e,t,o){o.d(t,{B:()=>s});var a=o(27723),n=o(26103);const __=a.__,i={[n.we.IS]:__("is","jetpack-forms"),[n.we.IS_NOT]:__("is not","jetpack-forms"),[n.we.CONTAINS]:__("contains","jetpack-forms"),[n.we.DOES_NOT_CONTAIN]:__("does not contain","jetpack-forms"),[n.we.IS_EMPTY]:__("is empty","jetpack-forms"),[n.we.IS_NOT_EMPTY]:__("is not empty","jetpack-forms"),[n.we.EQUALS]:__("equals","jetpack-forms"),[n.we.NOT_EQUALS]:__("does not equal","jetpack-forms"),[n.we.GREATER_THAN]:__("is greater than","jetpack-forms"),[n.we.LESS_THAN]:__("is less than","jetpack-forms"),[n.we.GTE]:__("is at least","jetpack-forms"),[n.we.LTE]:__("is at most","jetpack-forms"),[n.we.BEFORE]:__("is before","jetpack-forms"),[n.we.AFTER]:__("is after","jetpack-forms"),[n.we.IS_CHECKED]:__("is checked","jetpack-forms"),[n.we.IS_NOT_CHECKED]:__("is not checked","jetpack-forms")},s=e=>i[e]??e},6888(e,t,o){o.d(t,{Mg:()=>s,Th:()=>n,Vd:()=>r,fs:()=>l,m3:()=>i,qu:()=>c});const a={enabled:!1,action:"show",logicalOperator:"any",groups:[]},n="fieldValue",i=e=>{const t={...a,...e||{}},o=Array.isArray(t.groups)?t.groups:[];return{...t,groups:o.map(e=>({logicalOperator:"all"===e?.logicalOperator?"all":"any",rules:Array.isArray(e?.rules)?e.rules:[]}))}},s=e=>e.groups[0]||((e="any")=>({logicalOperator:e,rules:[]}))(),l=(e,t,o)=>{const[,...a]=e.groups,n=t.length?[{logicalOperator:o,rules:t},...a]:a;return{...e,groups:n,enabled:n.some(e=>e.rules.length>0)}},r=e=>e.groups.reduce((e,t)=>e+t.rules.length,0),c=e=>r(e)>0&&"show"===e.action},73340(e,t,o){o.d(t,{A:()=>f,V:()=>m});var a=o(94715),n=o(74997),i=o(47143),s=o(86087),l=o(27723),r=o(13549),c=o(1799),d=o(47088);const __=l.__,u=e=>{const t=(e.innerBlocks||[]).find(e=>"jetpack/label"===e.name),o=t?.attributes?.label;return o&&o.trim()?o.trim():e.attributes?.id||__("Untitled field","jetpack-forms")},p=(e,t,o,a)=>{if(!Array.isArray(e))return;let i=o;e.forEach(e=>{if(!e)return;"jetpack/form-step"===e.name&&(i=(i||0)+1);const o=(0,c.x)(e.name);o&&e.clientId!==t?a.push({clientId:e.clientId,id:e.attributes?.id||"",label:u(e),typeLabel:(0,n.getBlockType)(e.name)?.title||"",typeKey:o,options:(0,d.r)(e),step:i}):p(e.innerBlocks,t,i,a)})},m=()=>{const{updateBlockAttributes:e}=(0,i.useDispatch)(a.store);return(0,s.useCallback)((t,o=[])=>{if(!t)return"";if(t.id)return t.id;const a=(0,r.C)((t.label||"").trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"")||"field",o);return e(t.clientId,{id:a}),a},[e])},f=e=>(0,i.useSelect)(t=>{const{getBlock:o,getBlockParentsByBlockName:a,getBlockRootClientId:n}=t("core/block-editor"),i=a(e,"jetpack/contact-form"),s=i?.[i.length-1]||n(e);if(!s)return[];const l=o(s),r=[];return p(l?.innerBlocks||[],e,null,r),r},[e])},13537(e,t,o){o.d(t,{C:()=>n});var a=o(27723);const __=a.__,n=e=>{const t=e?.label||"";return e?.typeLabel?(0,a.sprintf)(/* translators: 1: form field label, 2: the field's type, e.g. "Dropdown field" */
4 __("%1$s (%2$s)","jetpack-forms"),t,e.typeLabel):t}},90445(e,t,o){o.d(t,{Cc:()=>n,_A:()=>i});var a=o(26103);const n=e=>Boolean(e?.field),i=(e,t)=>!!(n(e)&&t&&e.operator)&&(!(0,a.vA)(e.operator)||""!==String(e.value??"").trim())},97806(e,t,o){o.d(t,{Bi:()=>r,IO:()=>c,Of:()=>u,l5:()=>d});var a=o(27723),n=o(13537),i=o(26103),s=o(35723),l=o(90445);const __=a.__,r=(e,t)=>{const o="all"===t.logicalOperator;return"hide"===e.action?o?__("This field is hidden only if:","jetpack-forms"):__("This field is hidden if any of these are true:","jetpack-forms",0):o?__("This field is shown only if:","jetpack-forms"):__("This field is shown if any of these are true:","jetpack-forms",0)},c=(e,t)=>{const o=(0,n.C)(t),l=(0,s.B)(e.operator);return(0,i.vA)(e.operator)?(0,a.sprintf)(/* translators: 1: form field label, 2: comparison, e.g. "is", 3: the value compared against */
5 __("%1$s %2$s “%3$s”","jetpack-forms"),o,l,String(e.value??"")):(0,a.sprintf)(/* translators: 1: form field label, 2: comparison, e.g. "is not empty" */
6 __("%1$s %2$s","jetpack-forms"),o,l)},d=(e,t)=>e.rules.map(e=>({rule:e,subject:t.find(t=>t.id&&t.id===e.field)})).filter(({rule:e,subject:t})=>(0,l._A)(e,t)),u=(e,t,o)=>{const n=d(t,o);return n.length?(0,a.sprintf)(/* translators: 1: heading ending in a colon, 2: the conditions, separated by semicolons */
7 __("%1$s %2$s","jetpack-forms"),r(e,t),n.map(({rule:e,subject:t})=>c(e,t)).join("; ")):""}}}]);