diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fbf1c58 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_style = space +indent_size = 2 + +[*.{js,jsx,ts,tsx,json,css,scss}] +indent_style = space +indent_size = 2 + +[*.xml] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..e700ea3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Lint + +on: + push: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: none + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-progress + + - name: Run composer lint + run: composer lint \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a0891c5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "[php]": { + "editor.defaultFormatter": "ValeryanM.vscode-phpsab", + "editor.formatOnSave": true + }, + "phpsab.executablePathCBF": "./vendor/bin/phpcbf", + "phpsab.executablePathCS": "./vendor/bin/phpcs", + "phpsab.standard": "PSR12", + "phpsab.autoRulesetSearch": true +} \ No newline at end of file diff --git a/build/166.js b/build/166.js index f0a3333..2f04819 100644 --- a/build/166.js +++ b/build/166.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[166],{166(t,s,e){e.r(s),e.d(s,{default:()=>i}),e(594);var n=e(848);const i=function(t){var s=t.currentStep,e=t.isLastFormStep,i=t.handlePrevious,u=t.handleNext,r=t.submitting,m=t.settings,a=void 0===m?{}:m;return(0,n.jsxs)("div",{className:"msf-form-navigation",children:[s>0&&(0,n.jsx)("button",{type:"button",onClick:i,className:"msf-btn msf-btn-secondary",children:a.previousButtonText||"Previous"}),e?(0,n.jsx)("button",{type:"submit",disabled:r,className:"msf-btn msf-btn-primary",children:r?"Submitting...":a.submitButtonText||"Submit"}):(0,n.jsx)("button",{type:"button",onClick:u,className:"msf-btn msf-btn-primary",children:a.nextButtonText||"Next"})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[166],{166(t,s,e){e.r(s),e.d(s,{default:()=>i}),e(594);var n=e(848);const i=function(t){var s=t.currentStep,e=t.isLastFormStep,i=t.handlePrevious,u=t.handleNext,r=t.submitting,a=t.settings,m=void 0===a?{}:a;return(0,n.jsxs)("div",{className:"msf-form-navigation",children:[s>0&&(0,n.jsx)("button",{type:"button",onClick:i,className:"msf-btn msf-btn-secondary",children:m.previousButtonText||"Previous"}),e?(0,n.jsx)("button",{type:"submit",disabled:r,className:"msf-btn msf-btn-primary",children:r?"Submitting...":m.submitButtonText||"Submit"}):(0,n.jsx)("button",{type:"button",onClick:u,className:"msf-btn msf-btn-primary",children:m.nextButtonText||"Next"})]})}}}]); \ No newline at end of file diff --git a/build/174.js b/build/174.js index 483e18e..b7a2b47 100644 --- a/build/174.js +++ b/build/174.js @@ -1,2 +1,2 @@ /*! For license information please see 174.js.LICENSE.txt */ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[174],{174(e,r,t){t.d(r,{default:()=>v});var n=t(594),i=t(470),o=t(842),s=t.n(o),u=t(214),a=t(848);function l(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return d(l,"_invoke",function(t,n,i){var o,u,a,l=0,c=i||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(r,t){return o=r,u=0,a=e,f.n=t,s}};function m(t,n){for(u=t,a=n,r=0;!d&&l&&!i&&r3?(i=p===n)&&(a=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=m&&((i=t<2&&mn||n>p)&&(o[4]=t,o[5]=n,f.n=p,u=0))}if(i||t>1)return s;throw d=!0,n}return function(i,c,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&m(c,p),u=c,a=p;(r=u<2?e:a)||!d;){o||(u?u<3?(u>1&&(f.n=-1),m(u,a)):f.n=a:f.v=a);try{if(l=2,o){if(u||(i="next"),r=o[i]){if(!(r=r.call(o,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=o.return)&&r.call(o),u<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((r=(d=f.n<0)?a:t.call(n,f))!==s)break}catch(r){o=e,u=1,a=r}finally{l=1}}return{value:r,done:d}}}(t,i,o),!0),l}var s={};function u(){}function a(){}function l(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(d(r={},n,function(){return this}),r),m=l.prototype=u.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,d(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return a.prototype=l,d(m,"constructor",l),d(l,"constructor",a),a.displayName="GeneratorFunction",d(l,i,"GeneratorFunction"),d(m),d(m,i,"Generator"),d(m,n,function(){return this}),d(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function d(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}d=function(e,r,t,n){function o(r,t){d(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},d(e,r,t,n)}function f(e,r,t,n,i,o,s){try{var u=e[o](s),a=u.value}catch(e){return void t(e)}u.done?r(a):Promise.resolve(a).then(n,i)}function m(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function s(e){f(o,n,i,s,u,"next",e)}function u(e){f(o,n,i,s,u,"throw",e)}s(void 0)})}}function p(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,s,u=[],a=!0,l=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);a=!0);}catch(e){l=!0,i=e}finally{try{if(!a&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw i}}return u}}(e,r)||b(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,r){if(e){if("string"==typeof e)return h(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,r):void 0}}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t0&&!f&&b(r[0].id),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Error loading forms:",t);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),D=function(){var e=m(c().m(function e(){var r,t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,x(!0),e.n=1,s()({path:"/msf/v1/forms/".concat(f,"/submissions")});case 1:r=e.v,_(r.submissions||[]),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Error loading submissions:",t),k({type:"error",message:(0,i.__)("Failed to load submissions","multi-step-form-builder")});case 3:return e.p=3,x(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}(),I=function(){var e=m(c().m(function e(r){var t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm((0,i.__)("Are you sure you want to delete this submission?","multi-step-form-builder"))){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,s()({path:"/msf/v1/submissions/".concat(r),method:"DELETE"});case 2:k({type:"success",message:(0,i.__)("Submission deleted","multi-step-form-builder")}),D(),e.n=4;break;case 3:e.p=3,t=e.v,console.error("Error deleting submission:",t),k({type:"error",message:(0,i.__)("Failed to delete submission","multi-step-form-builder")});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(r){return e.apply(this,arguments)}}(),C=t.map(function(e){return{label:e.title.rendered,value:e.id}});return(0,a.jsxs)("div",{className:"msf-submissions-list",children:[E&&(0,a.jsx)(u.Notice,{status:E.type,onRemove:function(){return k(null)},isDismissible:!0,children:E.message}),(0,a.jsxs)("div",{className:"msf-submissions-header",children:[(0,a.jsx)(u.SelectControl,{label:(0,i.__)("Select Form","multi-step-form-builder"),value:f,options:[{label:(0,i.__)("Select a form...","multi-step-form-builder"),value:0}].concat(l(C)),onChange:function(e){return b(parseInt(e))}}),(0,a.jsx)(u.Button,{variant:"secondary",onClick:function(){if(0!==v.length){var e=new Set;v.forEach(function(r){Object.keys(r.submission_data).forEach(function(r){return e.add(r)})});var r=["ID","Date","User ID","IP Address"].concat(l(Array.from(e))).join(",")+"\n";v.forEach(function(t){var n=[t.id,t.created_at,t.user_id||"",t.ip_address||""].concat(l(Array.from(e).map(function(e){var r=t.submission_data[e]||"";return'"'.concat(String(r).replace(/"/g,'""'),'"')})));r+=n.join(",")+"\n"});var t=new Blob([r],{type:"text/csv"}),n=window.URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download="form-".concat(f,"-submissions.csv"),o.click(),window.URL.revokeObjectURL(n)}else alert((0,i.__)("No submissions to export","multi-step-form-builder"))},disabled:0===v.length,children:(0,i.__)("Export to CSV","multi-step-form-builder")})]}),j?(0,a.jsx)("div",{className:"msf-loading",children:(0,a.jsx)(u.Spinner,{})}):v.length>0?(0,a.jsxs)("table",{className:"wp-list-table widefat fixed striped",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:(0,i.__)("ID","multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("Date","multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("User","multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("IP Address","multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("Actions","multi-step-form-builder")})]})}),(0,a.jsx)("tbody",{children:v.map(function(e){return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:e.id}),(0,a.jsx)("td",{children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{children:e.user_id||(0,i.__)("Guest","multi-step-form-builder")}),(0,a.jsx)("td",{children:e.ip_address}),(0,a.jsxs)("td",{children:[(0,a.jsx)(u.Button,{variant:"secondary",isSmall:!0,onClick:function(){return S(e)},children:(0,i.__)("View","multi-step-form-builder")})," ",(0,a.jsx)(u.Button,{variant:"secondary",isSmall:!0,isDestructive:!0,onClick:function(){return I(e.id)},children:(0,i.__)("Delete","multi-step-form-builder")})]})]},e.id)})})]}):(0,a.jsx)("p",{children:(0,i.__)("No submissions yet.","multi-step-form-builder")}),g&&(0,a.jsx)(u.Modal,{title:(0,i.__)("Submission Details","multi-step-form-builder"),onRequestClose:function(){return S(null)},children:(0,a.jsxs)("div",{className:"msf-submission-details",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("Date:","multi-step-form-builder")})," ",new Date(g.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("User ID:","multi-step-form-builder")})," ",g.user_id||(0,i.__)("Guest","multi-step-form-builder")]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("IP Address:","multi-step-form-builder")})," ",g.ip_address]}),(0,a.jsx)("hr",{}),(0,a.jsx)("h3",{children:(0,i.__)("Form Data","multi-step-form-builder")}),(0,a.jsx)("table",{className:"widefat",children:(0,a.jsx)("tbody",{children:Object.entries(g.submission_data).map(function(e){var r=p(e,2),t=r[0],n=r[1];return(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:t}),(0,a.jsx)("td",{children:Array.isArray(n)?n.join(", "):n})]},t)})})})]})})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[174],{174(e,r,t){t.d(r,{default:()=>h});var n=t(594),i=t(470),o=t(842),s=t.n(o),u=t(214),a=t(848);function l(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(t,n,i,o){var a=n&&n.prototype instanceof u?n:u,l=Object.create(a.prototype);return d(l,"_invoke",function(t,n,i){var o,u,a,l=0,c=i||[],d=!1,f={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(r,t){return o=r,u=0,a=e,f.n=t,s}};function m(t,n){for(u=t,a=n,r=0;!d&&l&&!i&&r3?(i=p===n)&&(a=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=m&&((i=t<2&&mn||n>p)&&(o[4]=t,o[5]=n,f.n=p,u=0))}if(i||t>1)return s;throw d=!0,n}return function(i,c,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&m(c,p),u=c,a=p;(r=u<2?e:a)||!d;){o||(u?u<3?(u>1&&(f.n=-1),m(u,a)):f.n=a:f.v=a);try{if(l=2,o){if(u||(i="next"),r=o[i]){if(!(r=r.call(o,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=o.return)&&r.call(o),u<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((r=(d=f.n<0)?a:t.call(n,f))!==s)break}catch(r){o=e,u=1,a=r}finally{l=1}}return{value:r,done:d}}}(t,i,o),!0),l}var s={};function u(){}function a(){}function l(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(d(r={},n,function(){return this}),r),m=l.prototype=u.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,d(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e}return a.prototype=l,d(m,"constructor",l),d(l,"constructor",a),a.displayName="GeneratorFunction",d(l,i,"GeneratorFunction"),d(m),d(m,i,"Generator"),d(m,n,function(){return this}),d(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:p}})()}function d(e,r,t,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}d=function(e,r,t,n){function o(r,t){d(e,r,function(e){return this._invoke(r,t,e)})}r?i?i(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(o("next",0),o("throw",1),o("return",2))},d(e,r,t,n)}function f(e,r,t,n,i,o,s){try{var u=e[o](s),a=u.value}catch(e){return void t(e)}u.done?r(a):Promise.resolve(a).then(n,i)}function m(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function s(e){f(o,n,i,s,u,"next",e)}function u(e){f(o,n,i,s,u,"throw",e)}s(void 0)})}}function p(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,s,u=[],a=!0,l=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);a=!0);}catch(e){l=!0,i=e}finally{try{if(!a&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw i}}return u}}(e,r)||j(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,r){if(e){if("string"==typeof e)return b(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?b(e,r):void 0}}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t0&&!f&&j(r[0].id),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Error loading forms:",t);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),D=function(){var e=m(c().m(function e(){var r,t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,x(!0),e.n=1,s()({path:"/msf/v1/forms/".concat(f,"/submissions")});case 1:r=e.v,_(r.submissions||[]),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Error loading submissions:",t),k({type:"error",message:(0,i.__)("Failed to load submissions","jpjuliao-multi-step-form-builder")});case 3:return e.p=3,x(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}(),I=function(){var e=m(c().m(function e(r){var t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:if(confirm((0,i.__)("Are you sure you want to delete this submission?","jpjuliao-multi-step-form-builder"))){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,s()({path:"/msf/v1/submissions/".concat(r),method:"DELETE"});case 2:k({type:"success",message:(0,i.__)("Submission deleted","jpjuliao-multi-step-form-builder")}),D(),e.n=4;break;case 3:e.p=3,t=e.v,console.error("Error deleting submission:",t),k({type:"error",message:(0,i.__)("Failed to delete submission","jpjuliao-multi-step-form-builder")});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(r){return e.apply(this,arguments)}}(),C=t.map(function(e){return{label:e.title.rendered,value:e.id}});return(0,a.jsxs)("div",{className:"msf-submissions-list",children:[E&&(0,a.jsx)(u.Notice,{status:E.type,onRemove:function(){return k(null)},isDismissible:!0,children:E.message}),(0,a.jsxs)("div",{className:"msf-submissions-header",children:[(0,a.jsx)(u.SelectControl,{label:(0,i.__)("Select Form","jpjuliao-multi-step-form-builder"),value:f,options:[{label:(0,i.__)("Select a form...","jpjuliao-multi-step-form-builder"),value:0}].concat(l(C)),onChange:function(e){return j(parseInt(e))}}),(0,a.jsx)(u.Button,{variant:"secondary",onClick:function(){if(0!==h.length){var e=new Set;h.forEach(function(r){Object.keys(r.submission_data).forEach(function(r){return e.add(r)})});var r=["ID","Date","User ID","IP Address"].concat(l(Array.from(e))).join(",")+"\n";h.forEach(function(t){var n=[t.id,t.created_at,t.user_id||"",t.ip_address||""].concat(l(Array.from(e).map(function(e){var r=t.submission_data[e]||"";return'"'.concat(String(r).replace(/"/g,'""'),'"')})));r+=n.join(",")+"\n"});var t=new Blob([r],{type:"text/csv"}),n=window.URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download="form-".concat(f,"-submissions.csv"),o.click(),window.URL.revokeObjectURL(n)}else alert((0,i.__)("No submissions to export","jpjuliao-multi-step-form-builder"))},disabled:0===h.length,children:(0,i.__)("Export to CSV","jpjuliao-multi-step-form-builder")})]}),y?(0,a.jsx)("div",{className:"msf-loading",children:(0,a.jsx)(u.Spinner,{})}):h.length>0?(0,a.jsxs)("table",{className:"wp-list-table widefat fixed striped",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:(0,i.__)("ID","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("Date","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("User","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("IP Address","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("th",{children:(0,i.__)("Actions","jpjuliao-multi-step-form-builder")})]})}),(0,a.jsx)("tbody",{children:h.map(function(e){return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:e.id}),(0,a.jsx)("td",{children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{children:e.user_id||(0,i.__)("Guest","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("td",{children:e.ip_address}),(0,a.jsxs)("td",{children:[(0,a.jsx)(u.Button,{variant:"secondary",isSmall:!0,onClick:function(){return S(e)},children:(0,i.__)("View","jpjuliao-multi-step-form-builder")})," ",(0,a.jsx)(u.Button,{variant:"secondary",isSmall:!0,isDestructive:!0,onClick:function(){return I(e.id)},children:(0,i.__)("Delete","jpjuliao-multi-step-form-builder")})]})]},e.id)})})]}):(0,a.jsx)("p",{children:(0,i.__)("No submissions yet.","jpjuliao-multi-step-form-builder")}),g&&(0,a.jsx)(u.Modal,{title:(0,i.__)("Submission Details","jpjuliao-multi-step-form-builder"),onRequestClose:function(){return S(null)},children:(0,a.jsxs)("div",{className:"msf-submission-details",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("Date:","jpjuliao-multi-step-form-builder")})," ",new Date(g.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("User ID:","jpjuliao-multi-step-form-builder")})," ",g.user_id||(0,i.__)("Guest","jpjuliao-multi-step-form-builder")]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:(0,i.__)("IP Address:","jpjuliao-multi-step-form-builder")})," ",g.ip_address]}),(0,a.jsx)("hr",{}),(0,a.jsx)("h3",{children:(0,i.__)("Form Data","jpjuliao-multi-step-form-builder")}),(0,a.jsx)("table",{className:"widefat",children:(0,a.jsx)("tbody",{children:Object.entries(g.submission_data).map(function(e){var r=p(e,2),t=r[0],n=r[1];return(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:t}),(0,a.jsx)("td",{children:Array.isArray(n)?n.join(", "):n})]},t)})})})]})})]})}}}]); \ No newline at end of file diff --git a/build/280.js b/build/280.js index aa10c08..892cba8 100644 --- a/build/280.js +++ b/build/280.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[280],{280(e,t,r){r.r(t),r.d(t,{default:()=>s});var o=r(470),n=r(214),i=r(848);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function c(e){for(var t=1;tp});var o=r(470),n=r(214),i=r(848);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function c(e){for(var t=1;tc});var t=r(848);const c=function(s){var e=s.currentStep,r=s.totalSteps,c=s.steps,a=(e+1)/r*100;return(0,t.jsxs)("div",{className:"msf-progress-container",children:[(0,t.jsx)("div",{className:"msf-progress-bar",children:(0,t.jsx)("div",{className:"msf-progress-fill",style:{width:"".concat(a,"%")}})}),(0,t.jsx)("div",{className:"msf-progress-steps",children:c.map(function(s,r){return(0,t.jsxs)("div",{className:"msf-progress-step ".concat(ra});var t=r(848);const a=function(s){var e=s.currentStep,r=s.totalSteps,a=s.steps,l=(e+1)/r*100;return(0,t.jsxs)("div",{className:"msf-progress-container",children:[(0,t.jsx)("div",{className:"msf-progress-bar",children:(0,t.jsx)("div",{className:"msf-progress-fill",style:{width:"".concat(l,"%")}})}),(0,t.jsx)("div",{className:"msf-progress-steps",children:a.map(function(s,r){return(0,t.jsxs)("div",{className:"msf-progress-step ".concat(ru});var n=e(594),o=e(463),i=e(848);function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);eI});var n=e(594),o=e(842),i=e.n(o);function a(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var a=n&&n.prototype instanceof l?n:l,s=Object.create(a.prototype);return u(s,"_invoke",function(e,n,o){var i,a,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,a=0,u=t,p.n=e,c}};function y(e,n){for(a=e,u=n,r=0;!f&&l&&!o&&r3?(o=d===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,a=0))}if(o||e>1)return c;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),a=s,u=d;(r=a<2?t:u)||!f;){i||(a?a<3?(a>1&&(p.n=-1),y(a,u)):p.n=u:p.v=u);try{if(l=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(f=p.n<0)?u:e.call(n,p))!==c)break}catch(r){i=t,a=1,u=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),s}var c={};function l(){}function s(){}function f(){}r=Object.getPrototypeOf;var p=[][n]?r(r([][n]())):(u(r={},n,function(){return this}),r),y=f.prototype=l.prototype=Object.create(p);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,u(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=f,u(y,"constructor",f),u(f,"constructor",s),s.displayName="GeneratorFunction",u(f,o,"GeneratorFunction"),u(y),u(y,o,"Generator"),u(y,n,function(){return this}),u(y,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:d}})()}function u(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}u=function(t,r,e,n){function i(r,e){u(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},u(t,r,e,n)}function c(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)})}}var s=function(){var t=l(a().m(function t(r){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i()({path:"/msf/v1/forms/".concat(r)});case 1:return t.a(2,t.v)}},t)}));return function(r){return t.apply(this,arguments)}}(),f=function(){var t=l(a().m(function t(r,e){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return o={path:"/msf/v1/forms/".concat(r,"/submit"),method:"POST",data:e,headers:{"X-WP-Nonce":null===(n=window)||void 0===n||null===(n=n.msfFrontend)||void 0===n?void 0:n.nonce}},t.n=1,i()(o);case 1:return t.a(2,t.v)}},t)}));return function(r,e){return t.apply(this,arguments)}}();function p(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof u?n:u,l=Object.create(c.prototype);return y(l,"_invoke",function(e,n,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,u=0,c=t,p.n=e,a}};function y(e,n){for(u=e,c=n,r=0;!f&&l&&!o&&r3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,u=0))}if(o||e>1)return a;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(r=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(f=p.n<0)?c:e.call(n,p))!==a)break}catch(r){i=t,u=1,c=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),l}var a={};function u(){}function c(){}function l(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(y(r={},n,function(){return this}),r),f=l.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,y(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,y(f,"constructor",l),y(l,"constructor",c),c.displayName="GeneratorFunction",y(l,o,"GeneratorFunction"),y(f),y(f,o,"Generator"),y(f,n,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:d}})()}function y(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,e,n){function i(r,e){y(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},y(t,r,e,n)}function d(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function v(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,r)||function(t,r){if(t){if("string"==typeof t)return m(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,u=0))}if(o||e>1)return a;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(r=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(f=p.n<0)?c:e.call(n,p))!==a)break}catch(r){i=t,u=1,c=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),l}var a={};function u(){}function c(){}function l(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(g(r={},n,function(){return this}),r),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,g(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,g(f,"constructor",l),g(l,"constructor",c),c.displayName="GeneratorFunction",g(l,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function g(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,r,e,n){function i(r,e){g(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},g(t,r,e,n)}function j(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function w(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function S(t){for(var r=1;rt.length)&&(r=t.length);for(var e=0,n=Array(r);e=r.steps.length)return!0;var t=function(t,r){var e,n={};return null===(e=t.fields)||void 0===e||e.forEach(function(t){var e=r[t.name];t.required&&(!e||Array.isArray(e)&&0===e.length)&&(n[t.name]="".concat(t.label," is required")),"email"===t.type&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)&&(n[t.name]="Please enter a valid email address"),"url"===t.type&&e&&!function(t){try{return new URL(t),!0}catch(t){return!1}}(e)&&(n[t.name]="Please enter a valid URL")}),n}(r.steps[i],c);return y(t),0===Object.keys(t).length},[r,i,c]),G=(0,n.useCallback)(function(t){t&&t.preventDefault(),F()?(a(function(t){return t+1}),y({}),window.scrollTo({top:0,behavior:"smooth"})):window.scrollTo({top:0,behavior:"smooth"})},[F]),N=(0,n.useCallback)(function(){a(function(t){return t-1}),y({}),window.scrollTo({top:0,behavior:"smooth"})},[]),I=(0,n.useCallback)(function(){var n,o=(n=b().m(function n(o){var i,u,l;return b().w(function(n){for(;;)switch(n.p=n.n){case 0:if(o.preventDefault(),F()){n.n=1;break}return window.scrollTo({top:0,behavior:"smooth"}),n.a(2);case 1:return n.p=1,m(!0),n.n=2,f(t,c);case 2:i=n.v,k(i.message),w(!0),_(!1),a(r.steps.length),window.scrollTo({top:0,behavior:"smooth"}),e&&setTimeout(function(){return e()},2e3),n.n=4;break;case 3:n.p=3,l=n.v,console.error("Error submitting form:",l),null!==(u=l.data)&&void 0!==u&&u.errors?(y(l.data.errors),k("Please correct the errors and try again.")):k(l.message||"An error occurred while submitting the form. Please try again."),_(!0),a(r.steps.length),window.scrollTo({top:0,behavior:"smooth"});case 4:return n.p=4,m(!1),n.f(4);case 5:return n.a(2)}},n,null,[[1,3,4,5]])}),function(){var t=this,r=arguments;return new Promise(function(e,o){var i=n.apply(t,r);function a(t){j(i,e,o,a,u,"next",t)}function u(t){j(i,e,o,a,u,"throw",t)}a(void 0)})});return function(t){return o.apply(this,arguments)}}(),[t,c,F,r,e]),D=(0,n.useCallback)(function(){a(r.steps.length-1),w(!1),_(!1)},[r]);return{currentStep:i,formData:c,errors:p,submitting:v,submitted:g,successMessage:T,hasError:E,handleNext:G,handlePrevious:N,handleSubmit:I,updateFieldValue:C,resetForm:D,setCurrentStep:a}},k=e(848);const A=function(){return(0,k.jsx)("div",{className:"msf-spinner"})};function E(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);eu});var n=e(594),o=e(463),i=e(848);function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);eI});var n=e(594),o=e(842),i=e.n(o);function a(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var a=n&&n.prototype instanceof l?n:l,s=Object.create(a.prototype);return u(s,"_invoke",function(e,n,o){var i,a,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,a=0,u=t,p.n=e,c}};function y(e,n){for(a=e,u=n,r=0;!f&&l&&!o&&r3?(o=d===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,a=0))}if(o||e>1)return c;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),a=s,u=d;(r=a<2?t:u)||!f;){i||(a?a<3?(a>1&&(p.n=-1),y(a,u)):p.n=u:p.v=u);try{if(l=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(f=p.n<0)?u:e.call(n,p))!==c)break}catch(r){i=t,a=1,u=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),s}var c={};function l(){}function s(){}function f(){}r=Object.getPrototypeOf;var p=[][n]?r(r([][n]())):(u(r={},n,function(){return this}),r),y=f.prototype=l.prototype=Object.create(p);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,u(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=f,u(y,"constructor",f),u(f,"constructor",s),s.displayName="GeneratorFunction",u(f,o,"GeneratorFunction"),u(y),u(y,o,"Generator"),u(y,n,function(){return this}),u(y,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:d}})()}function u(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}u=function(t,r,e,n){function i(r,e){u(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},u(t,r,e,n)}function c(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)})}}var s=function(){var t=l(a().m(function t(r){return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i()({path:"/msf/v1/forms/".concat(r)});case 1:return t.a(2,t.v)}},t)}));return function(r){return t.apply(this,arguments)}}(),f=function(){var t=l(a().m(function t(r,e){var n,o;return a().w(function(t){for(;;)switch(t.n){case 0:return o={path:"/msf/v1/forms/".concat(r,"/submit"),method:"POST",data:e,headers:{"X-WP-Nonce":null===(n=window)||void 0===n||null===(n=n.msfFrontend)||void 0===n?void 0:n.nonce}},t.n=1,i()(o);case 1:return t.a(2,t.v)}},t)}));return function(r,e){return t.apply(this,arguments)}}();function p(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof u?n:u,l=Object.create(c.prototype);return y(l,"_invoke",function(e,n,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,u=0,c=t,p.n=e,a}};function y(e,n){for(u=e,c=n,r=0;!f&&l&&!o&&r3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,u=0))}if(o||e>1)return a;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(r=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(f=p.n<0)?c:e.call(n,p))!==a)break}catch(r){i=t,u=1,c=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),l}var a={};function u(){}function c(){}function l(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(y(r={},n,function(){return this}),r),f=l.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,y(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,y(f,"constructor",l),y(l,"constructor",c),c.displayName="GeneratorFunction",y(l,o,"GeneratorFunction"),y(f),y(f,o,"Generator"),y(f,n,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:d}})()}function y(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,e,n){function i(r,e){y(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},y(t,r,e,n)}function d(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function v(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,r)||function(t,r){if(t){if("string"==typeof t)return m(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>d)&&(i[4]=e,i[5]=n,p.n=d,u=0))}if(o||e>1)return a;throw f=!0,n}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(r=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(f=p.n<0)?c:e.call(n,p))!==a)break}catch(r){i=t,u=1,c=r}finally{l=1}}return{value:r,done:f}}}(e,o,i),!0),l}var a={};function u(){}function c(){}function l(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(g(r={},n,function(){return this}),r),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,g(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,g(f,"constructor",l),g(l,"constructor",c),c.displayName="GeneratorFunction",g(l,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,n,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function g(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,r,e,n){function i(r,e){g(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},g(t,r,e,n)}function j(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function w(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function S(t){for(var r=1;rt.length)&&(r=t.length);for(var e=0,n=Array(r);e=r.steps.length)return!0;var t=function(t,r){var e,n={};return null===(e=t.fields)||void 0===e||e.forEach(function(t){var e=r[t.name];t.required&&(!e||Array.isArray(e)&&0===e.length)&&(n[t.name]="".concat(t.label," is required")),"email"===t.type&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)&&(n[t.name]="Please enter a valid email address"),"url"===t.type&&e&&!function(t){try{return new URL(t),!0}catch(t){return!1}}(e)&&(n[t.name]="Please enter a valid URL")}),n}(r.steps[i],c);return y(t),0===Object.keys(t).length},[r,i,c]),G=(0,n.useCallback)(function(t){t&&t.preventDefault(),F()?(a(function(t){return t+1}),y({}),window.scrollTo({top:0,behavior:"smooth"})):window.scrollTo({top:0,behavior:"smooth"})},[F]),N=(0,n.useCallback)(function(){a(function(t){return t-1}),y({}),window.scrollTo({top:0,behavior:"smooth"})},[]),I=(0,n.useCallback)(function(){var n,o=(n=b().m(function n(o){var i,u,l;return b().w(function(n){for(;;)switch(n.p=n.n){case 0:if(o.preventDefault(),F()){n.n=1;break}return window.scrollTo({top:0,behavior:"smooth"}),n.a(2);case 1:return n.p=1,m(!0),n.n=2,f(t,c);case 2:i=n.v,k(i.message),w(!0),_(!1),a(r.steps.length),window.scrollTo({top:0,behavior:"smooth"}),e&&setTimeout(function(){return e()},2e3),n.n=4;break;case 3:n.p=3,l=n.v,console.error("Error submitting form:",l),null!==(u=l.data)&&void 0!==u&&u.errors?(y(l.data.errors),k("Please correct the errors and try again.")):k(l.message||"An error occurred while submitting the form. Please try again."),_(!0),a(r.steps.length),window.scrollTo({top:0,behavior:"smooth"});case 4:return n.p=4,m(!1),n.f(4);case 5:return n.a(2)}},n,null,[[1,3,4,5]])}),function(){var t=this,r=arguments;return new Promise(function(e,o){var i=n.apply(t,r);function a(t){j(i,e,o,a,u,"next",t)}function u(t){j(i,e,o,a,u,"throw",t)}a(void 0)})});return function(t){return o.apply(this,arguments)}}(),[t,c,F,r,e]),D=(0,n.useCallback)(function(){a(r.steps.length-1),w(!1),_(!1)},[r]);return{currentStep:i,formData:c,errors:p,submitting:v,submitted:g,successMessage:T,hasError:E,handleNext:G,handlePrevious:N,handleSubmit:I,updateFieldValue:C,resetForm:D,setCurrentStep:a}},k=e(848);const A=function(){return(0,k.jsx)("div",{className:"msf-spinner"})};function E(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);ep});var n=t(594),a=t(214),r=t(470),i=[{type:"text",label:"Text Field",icon:"📝",defaultConfig:{type:"text",label:"Text Field",name:"",placeholder:"",required:!1,helpText:""}},{type:"email",label:"Email",icon:"📧",defaultConfig:{type:"email",label:"Email Address",name:"",placeholder:"example@email.com",required:!1,helpText:""}},{type:"textarea",label:"Textarea",icon:"📄",defaultConfig:{type:"textarea",label:"Message",name:"",placeholder:"",required:!1,rows:4,helpText:""}},{type:"select",label:"Dropdown",icon:"📋",defaultConfig:{type:"select",label:"Select Option",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"radio",label:"Radio Buttons",icon:"🔘",defaultConfig:{type:"radio",label:"Choose One",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"checkbox",label:"Checkboxes",icon:"☑️",defaultConfig:{type:"checkbox",label:"Select All That Apply",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"number",label:"Number",icon:"🔢",defaultConfig:{type:"number",label:"Number",name:"",placeholder:"",required:!1,min:"",max:"",step:"1",helpText:""}},{type:"tel",label:"Phone",icon:"📱",defaultConfig:{type:"tel",label:"Phone Number",name:"",placeholder:"(555) 123-4567",required:!1,helpText:""}},{type:"url",label:"URL",icon:"🔗",defaultConfig:{type:"url",label:"Website URL",name:"",placeholder:"https://example.com",required:!1,helpText:""}},{type:"date",label:"Date",icon:"📅",defaultConfig:{type:"date",label:"Date",name:"",required:!1,helpText:""}}],o=t(848);function u(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,n=Array(l);tp});var a=t(594),n=t(214),r=t(470),i=[{type:"text",label:"Text Field",icon:"📝",defaultConfig:{type:"text",label:"Text Field",name:"",placeholder:"",required:!1,helpText:""}},{type:"email",label:"Email",icon:"📧",defaultConfig:{type:"email",label:"Email Address",name:"",placeholder:"example@email.com",required:!1,helpText:""}},{type:"textarea",label:"Textarea",icon:"📄",defaultConfig:{type:"textarea",label:"Message",name:"",placeholder:"",required:!1,rows:4,helpText:""}},{type:"select",label:"Dropdown",icon:"📋",defaultConfig:{type:"select",label:"Select Option",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"radio",label:"Radio Buttons",icon:"🔘",defaultConfig:{type:"radio",label:"Choose One",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"checkbox",label:"Checkboxes",icon:"☑️",defaultConfig:{type:"checkbox",label:"Select All That Apply",name:"",required:!1,options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"}],helpText:""}},{type:"number",label:"Number",icon:"🔢",defaultConfig:{type:"number",label:"Number",name:"",placeholder:"",required:!1,min:"",max:"",step:"1",helpText:""}},{type:"tel",label:"Phone",icon:"📱",defaultConfig:{type:"tel",label:"Phone Number",name:"",placeholder:"(555) 123-4567",required:!1,helpText:""}},{type:"url",label:"URL",icon:"🔗",defaultConfig:{type:"url",label:"Website URL",name:"",placeholder:"https://example.com",required:!1,helpText:""}},{type:"date",label:"Date",icon:"📅",defaultConfig:{type:"date",label:"Date",name:"",required:!1,helpText:""}}],o=t(848);function u(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,a=Array(l);tn}),r(594);var c=r(848);const n=function(s){var e=s.hasError,r=s.successMessage,n=s.errors,t=s.onBack;return(0,c.jsx)("div",{className:"msf-step-content",children:(0,c.jsxs)("div",{className:"msf-form-".concat(e?"error":"success"),children:[(0,c.jsx)("div",{className:"msf-".concat(e?"error":"success","-icon"),children:e?"✕":"✓"}),(0,c.jsxs)("div",{className:"msf-form-message",children:[(0,c.jsx)("h3",{children:e?"Error":"Success!"}),(0,c.jsx)("p",{children:r})]}),e&&Object.keys(n).length>0&&(0,c.jsx)("button",{type:"button",onClick:t,className:"msf-btn msf-btn-primary",style:{marginTop:"20px"},children:"Go Back"})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[399],{399(s,e,r){r.r(e),r.d(e,{default:()=>a}),r(594);var c=r(848);const a=function(s){var e=s.hasError,r=s.successMessage,a=s.errors,n=s.onBack;return(0,c.jsx)("div",{className:"msf-step-content",children:(0,c.jsxs)("div",{className:"msf-form-".concat(e?"error":"success"),children:[(0,c.jsx)("div",{className:"msf-".concat(e?"error":"success","-icon"),children:e?"✕":"✓"}),(0,c.jsxs)("div",{className:"msf-form-message",children:[(0,c.jsx)("h3",{children:e?"Error":"Success!"}),(0,c.jsx)("p",{children:r})]}),e&&Object.keys(a).length>0&&(0,c.jsx)("button",{type:"button",onClick:n,className:"msf-btn msf-btn-primary",style:{marginTop:"20px"},children:"Go Back"})]})})}}}]); \ No newline at end of file diff --git a/build/404.js b/build/404.js index c2a0e5c..457f4bf 100644 --- a/build/404.js +++ b/build/404.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[404],{404(e,t,l){l.r(t),l.d(t,{default:()=>s});var i=l(214),r=l(470),n=l(848);const s=function(e){var t=e.title,l=e.description,s=e.index,o=e.onUpdate,u=e.onDelete;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"msf-step-header",children:[(0,n.jsx)(i.TextControl,{label:(0,r.__)("Step Title","multi-step-form-builder"),value:t||"",onChange:function(e){return o("title",e)},placeholder:(0,r.__)("Step ".concat(s+1),"multi-step-form-builder")}),(0,n.jsx)(i.Button,{icon:"trash",label:(0,r.__)("Delete Step","multi-step-form-builder"),onClick:u,isDestructive:!0})]}),(0,n.jsx)(i.TextControl,{label:(0,r.__)("Step Description","multi-step-form-builder"),value:l||"",onChange:function(e){return o("description",e)},placeholder:(0,r.__)("Optional description for this step","multi-step-form-builder")})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[404],{404(e,t,l){l.r(t),l.d(t,{default:()=>u});var i=l(214),r=l(470),o=l(848);const u=function(e){var t=e.title,l=e.description,u=e.index,n=e.onUpdate,s=e.onDelete;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"msf-step-header",children:[(0,o.jsx)(i.TextControl,{label:(0,r.__)("Step Title","jpjuliao-multi-step-form-builder"),value:t||"",onChange:function(e){return n("title",e)},placeholder:(0,r.__)("Step ".concat(u+1),"jpjuliao-multi-step-form-builder")}),(0,o.jsx)(i.Button,{icon:"trash",label:(0,r.__)("Delete Step","jpjuliao-multi-step-form-builder"),onClick:s,isDestructive:!0})]}),(0,o.jsx)(i.TextControl,{label:(0,r.__)("Step Description","jpjuliao-multi-step-form-builder"),value:l||"",onChange:function(e){return n("description",e)},placeholder:(0,r.__)("Optional description for this step","jpjuliao-multi-step-form-builder")})]})}}}]); \ No newline at end of file diff --git a/build/414.js b/build/414.js index 636f72d..80be683 100644 --- a/build/414.js +++ b/build/414.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[414],{33(e,r,a){a.r(r),a.d(r,{default:()=>t});var n=a(848);function l(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,n=Array(r);at});var n=a(848);function l(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,n=Array(r);aD});var n=e(594),o=e(842),i=e.n(o);function u(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var u=n&&n.prototype instanceof s?n:s,f=Object.create(u.prototype);return a(f,"_invoke",function(e,n,o){var i,u,a,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,u=0,a=t,p.n=e,c}};function y(e,n){for(u=e,a=n,r=0;!l&&s&&!o&&r3?(o=v===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,u=0))}if(o||e>1)return c;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),u=f,a=v;(r=u<2?t:a)||!l;){i||(u?u<3?(u>1&&(p.n=-1),y(u,a)):p.n=a:p.v=a);try{if(s=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(l=p.n<0)?a:e.call(n,p))!==c)break}catch(r){i=t,u=1,a=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),f}var c={};function s(){}function f(){}function l(){}r=Object.getPrototypeOf;var p=[][n]?r(r([][n]())):(a(r={},n,function(){return this}),r),y=l.prototype=s.prototype=Object.create(p);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,a(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return f.prototype=l,a(y,"constructor",l),a(l,"constructor",f),f.displayName="GeneratorFunction",a(l,o,"GeneratorFunction"),a(y),a(y,o,"Generator"),a(y,n,function(){return this}),a(y,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:v}})()}function a(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}a=function(t,r,e,n){function i(r,e){a(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},a(t,r,e,n)}function c(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function s(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function u(t){c(i,n,o,u,a,"next",t)}function a(t){c(i,n,o,u,a,"throw",t)}u(void 0)})}}var f=function(){var t=s(u().m(function t(r){return u().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i()({path:"/msf/v1/forms/".concat(r)});case 1:return t.a(2,t.v)}},t)}));return function(r){return t.apply(this,arguments)}}(),l=function(){var t=s(u().m(function t(r,e){var n,o;return u().w(function(t){for(;;)switch(t.n){case 0:return o={path:"/msf/v1/forms/".concat(r,"/submit"),method:"POST",data:e,headers:{"X-WP-Nonce":null===(n=window)||void 0===n||null===(n=n.msfFrontend)||void 0===n?void 0:n.nonce}},t.n=1,i()(o);case 1:return t.a(2,t.v)}},t)}));return function(r,e){return t.apply(this,arguments)}}();function p(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof a?n:a,s=Object.create(c.prototype);return y(s,"_invoke",function(e,n,o){var i,a,c,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,a=0,c=t,p.n=e,u}};function y(e,n){for(a=e,c=n,r=0;!l&&s&&!o&&r3?(o=v===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,a=0))}if(o||e>1)return u;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),a=f,c=v;(r=a<2?t:c)||!l;){i||(a?a<3?(a>1&&(p.n=-1),y(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(l=p.n<0)?c:e.call(n,p))!==u)break}catch(r){i=t,a=1,c=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),s}var u={};function a(){}function c(){}function s(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(y(r={},n,function(){return this}),r),l=s.prototype=a.prototype=Object.create(f);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,y(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=s,y(l,"constructor",s),y(s,"constructor",c),c.displayName="GeneratorFunction",y(s,o,"GeneratorFunction"),y(l),y(l,o,"Generator"),y(l,n,function(){return this}),y(l,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:v}})()}function y(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,e,n){function i(r,e){y(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},y(t,r,e,n)}function v(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function d(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,u,a=[],c=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(a.push(n.value),a.length!==r);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}(t,r)||function(t,r){if(t){if("string"==typeof t)return h(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?h(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e3?(o=v===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,a=0))}if(o||e>1)return u;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),a=f,c=v;(r=a<2?t:c)||!l;){i||(a?a<3?(a>1&&(p.n=-1),y(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(l=p.n<0)?c:e.call(n,p))!==u)break}catch(r){i=t,a=1,c=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),s}var u={};function a(){}function c(){}function s(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(g(r={},n,function(){return this}),r),l=s.prototype=a.prototype=Object.create(f);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,g(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=s,g(l,"constructor",s),g(s,"constructor",c),c.displayName="GeneratorFunction",g(s,o,"GeneratorFunction"),g(l),g(l,o,"Generator"),g(l,n,function(){return this}),g(l,"toString",function(){return"[object Generator]"}),(m=function(){return{w:i,m:p}})()}function g(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,r,e,n){function i(r,e){g(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},g(t,r,e,n)}function j(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function w(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function S(t){for(var r=1;rt.length)&&(r=t.length);for(var e=0,n=Array(r);e=r.steps.length)return!0;var t=function(t,r){var e,n={};return null===(e=t.fields)||void 0===e||e.forEach(function(t){var e=r[t.name];t.required&&(!e||Array.isArray(e)&&0===e.length)&&(n[t.name]="".concat(t.label," is required")),"email"===t.type&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)&&(n[t.name]="Please enter a valid email address"),"url"===t.type&&e&&!function(t){try{return new URL(t),!0}catch(t){return!1}}(e)&&(n[t.name]="Please enter a valid URL")}),n}(r.steps[i],c);return y(t),0===Object.keys(t).length},[r,i,c]),C=(0,n.useCallback)(function(t){t&&t.preventDefault(),G()?(u(function(t){return t+1}),y({}),window.scrollTo({top:0,behavior:"smooth"})):window.scrollTo({top:0,behavior:"smooth"})},[G]),N=(0,n.useCallback)(function(){u(function(t){return t-1}),y({}),window.scrollTo({top:0,behavior:"smooth"})},[]),D=(0,n.useCallback)(function(){var n,o=(n=m().m(function n(o){var i,a,s;return m().w(function(n){for(;;)switch(n.p=n.n){case 0:if(o.preventDefault(),G()){n.n=1;break}return window.scrollTo({top:0,behavior:"smooth"}),n.a(2);case 1:return n.p=1,h(!0),n.n=2,l(t,c);case 2:i=n.v,k(i.message),w(!0),_(!1),u(r.steps.length),window.scrollTo({top:0,behavior:"smooth"}),e&&setTimeout(function(){return e()},2e3),n.n=4;break;case 3:n.p=3,s=n.v,console.error("Error submitting form:",s),null!==(a=s.data)&&void 0!==a&&a.errors?(y(s.data.errors),k("Please correct the errors and try again.")):k(s.message||"An error occurred while submitting the form. Please try again."),_(!0),u(r.steps.length),window.scrollTo({top:0,behavior:"smooth"});case 4:return n.p=4,h(!1),n.f(4);case 5:return n.a(2)}},n,null,[[1,3,4,5]])}),function(){var t=this,r=arguments;return new Promise(function(e,o){var i=n.apply(t,r);function u(t){j(i,e,o,u,a,"next",t)}function a(t){j(i,e,o,u,a,"throw",t)}u(void 0)})});return function(t){return o.apply(this,arguments)}}(),[t,c,G,r,e]),I=(0,n.useCallback)(function(){u(r.steps.length-1),w(!1),_(!1)},[r]);return{currentStep:i,formData:c,errors:p,submitting:d,submitted:g,successMessage:T,hasError:A,handleNext:C,handlePrevious:N,handleSubmit:D,updateFieldValue:F,resetForm:I,setCurrentStep:u}},k=e(848);const E=function(){return(0,k.jsx)("div",{className:"msf-spinner"})};function A(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);eD});var n=e(594),o=e(842),i=e.n(o);function u(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var u=n&&n.prototype instanceof s?n:s,f=Object.create(u.prototype);return a(f,"_invoke",function(e,n,o){var i,u,a,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,u=0,a=t,p.n=e,c}};function y(e,n){for(u=e,a=n,r=0;!l&&s&&!o&&r3?(o=v===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,u=0))}if(o||e>1)return c;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),u=f,a=v;(r=u<2?t:a)||!l;){i||(u?u<3?(u>1&&(p.n=-1),y(u,a)):p.n=a:p.v=a);try{if(s=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(l=p.n<0)?a:e.call(n,p))!==c)break}catch(r){i=t,u=1,a=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),f}var c={};function s(){}function f(){}function l(){}r=Object.getPrototypeOf;var p=[][n]?r(r([][n]())):(a(r={},n,function(){return this}),r),y=l.prototype=s.prototype=Object.create(p);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,a(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return f.prototype=l,a(y,"constructor",l),a(l,"constructor",f),f.displayName="GeneratorFunction",a(l,o,"GeneratorFunction"),a(y),a(y,o,"Generator"),a(y,n,function(){return this}),a(y,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:v}})()}function a(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}a=function(t,r,e,n){function i(r,e){a(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},a(t,r,e,n)}function c(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function s(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function u(t){c(i,n,o,u,a,"next",t)}function a(t){c(i,n,o,u,a,"throw",t)}u(void 0)})}}var f=function(){var t=s(u().m(function t(r){return u().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,i()({path:"/msf/v1/forms/".concat(r)});case 1:return t.a(2,t.v)}},t)}));return function(r){return t.apply(this,arguments)}}(),l=function(){var t=s(u().m(function t(r,e){var n,o;return u().w(function(t){for(;;)switch(t.n){case 0:return o={path:"/msf/v1/forms/".concat(r,"/submit"),method:"POST",data:e,headers:{"X-WP-Nonce":null===(n=window)||void 0===n||null===(n=n.msfFrontend)||void 0===n?void 0:n.nonce}},t.n=1,i()(o);case 1:return t.a(2,t.v)}},t)}));return function(r,e){return t.apply(this,arguments)}}();function p(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof a?n:a,s=Object.create(c.prototype);return y(s,"_invoke",function(e,n,o){var i,a,c,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,a=0,c=t,p.n=e,u}};function y(e,n){for(a=e,c=n,r=0;!l&&s&&!o&&r3?(o=v===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,a=0))}if(o||e>1)return u;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),a=f,c=v;(r=a<2?t:c)||!l;){i||(a?a<3?(a>1&&(p.n=-1),y(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(l=p.n<0)?c:e.call(n,p))!==u)break}catch(r){i=t,a=1,c=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),s}var u={};function a(){}function c(){}function s(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(y(r={},n,function(){return this}),r),l=s.prototype=a.prototype=Object.create(f);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,y(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=s,y(l,"constructor",s),y(s,"constructor",c),c.displayName="GeneratorFunction",y(s,o,"GeneratorFunction"),y(l),y(l,o,"Generator"),y(l,n,function(){return this}),y(l,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:v}})()}function y(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,e,n){function i(r,e){y(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},y(t,r,e,n)}function v(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function d(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,u,a=[],c=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(a.push(n.value),a.length!==r);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}(t,r)||function(t,r){if(t){if("string"==typeof t)return h(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?h(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e3?(o=v===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&yn||n>v)&&(i[4]=e,i[5]=n,p.n=v,a=0))}if(o||e>1)return u;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&y(f,v),a=f,c=v;(r=a<2?t:c)||!l;){i||(a?a<3?(a>1&&(p.n=-1),y(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(l=p.n<0)?c:e.call(n,p))!==u)break}catch(r){i=t,a=1,c=r}finally{s=1}}return{value:r,done:l}}}(e,o,i),!0),s}var u={};function a(){}function c(){}function s(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(g(r={},n,function(){return this}),r),l=s.prototype=a.prototype=Object.create(f);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,g(t,o,"GeneratorFunction")),t.prototype=Object.create(l),t}return c.prototype=s,g(l,"constructor",s),g(s,"constructor",c),c.displayName="GeneratorFunction",g(s,o,"GeneratorFunction"),g(l),g(l,o,"Generator"),g(l,n,function(){return this}),g(l,"toString",function(){return"[object Generator]"}),(m=function(){return{w:i,m:p}})()}function g(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,r,e,n){function i(r,e){g(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},g(t,r,e,n)}function j(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function w(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function S(t){for(var r=1;rt.length)&&(r=t.length);for(var e=0,n=Array(r);e=r.steps.length)return!0;var t=function(t,r){var e,n={};return null===(e=t.fields)||void 0===e||e.forEach(function(t){var e=r[t.name];t.required&&(!e||Array.isArray(e)&&0===e.length)&&(n[t.name]="".concat(t.label," is required")),"email"===t.type&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)&&(n[t.name]="Please enter a valid email address"),"url"===t.type&&e&&!function(t){try{return new URL(t),!0}catch(t){return!1}}(e)&&(n[t.name]="Please enter a valid URL")}),n}(r.steps[i],c);return y(t),0===Object.keys(t).length},[r,i,c]),C=(0,n.useCallback)(function(t){t&&t.preventDefault(),G()?(u(function(t){return t+1}),y({}),window.scrollTo({top:0,behavior:"smooth"})):window.scrollTo({top:0,behavior:"smooth"})},[G]),N=(0,n.useCallback)(function(){u(function(t){return t-1}),y({}),window.scrollTo({top:0,behavior:"smooth"})},[]),D=(0,n.useCallback)(function(){var n,o=(n=m().m(function n(o){var i,a,s;return m().w(function(n){for(;;)switch(n.p=n.n){case 0:if(o.preventDefault(),G()){n.n=1;break}return window.scrollTo({top:0,behavior:"smooth"}),n.a(2);case 1:return n.p=1,h(!0),n.n=2,l(t,c);case 2:i=n.v,k(i.message),w(!0),A(!1),u(r.steps.length),window.scrollTo({top:0,behavior:"smooth"}),e&&setTimeout(function(){return e()},2e3),n.n=4;break;case 3:n.p=3,s=n.v,console.error("Error submitting form:",s),null!==(a=s.data)&&void 0!==a&&a.errors?(y(s.data.errors),k("Please correct the errors and try again.")):k(s.message||"An error occurred while submitting the form. Please try again."),A(!0),u(r.steps.length),window.scrollTo({top:0,behavior:"smooth"});case 4:return n.p=4,h(!1),n.f(4);case 5:return n.a(2)}},n,null,[[1,3,4,5]])}),function(){var t=this,r=arguments;return new Promise(function(e,o){var i=n.apply(t,r);function u(t){j(i,e,o,u,a,"next",t)}function a(t){j(i,e,o,u,a,"throw",t)}u(void 0)})});return function(t){return o.apply(this,arguments)}}(),[t,c,G,r,e]),I=(0,n.useCallback)(function(){u(r.steps.length-1),w(!1),A(!1)},[r]);return{currentStep:i,formData:c,errors:p,submitting:d,submitted:g,successMessage:T,hasError:_,handleNext:C,handlePrevious:N,handleSubmit:D,updateFieldValue:F,resetForm:I,setCurrentStep:u}},k=e(848);const E=function(){return(0,k.jsx)("div",{className:"msf-spinner"})};function _(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);ec});var n=o(470),r=o(214),l=o(848);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function s(e){for(var t=1;tp});var n=o(470),r=o(214),l=o(848);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function a(e){for(var t=1;tt});var r=i(848);const t=function(s){var e=s.formConfig,i=e.title,t=e.description,l=e.showTitle,o=void 0===l||l,c=e.showDescription,f=void 0===c||c;return(0,r.jsxs)("div",{className:"msf-form-header",children:[o&&(0,r.jsx)("h2",{className:"msf-form-title",children:i}),f&&(0,r.jsx)("p",{className:"msf-form-description",children:t})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[573],{573(s,e,i){i.r(e),i.d(e,{default:()=>l});var r=i(848);const l=function(s){var e=s.formConfig,i=e.title,l=e.description,o=e.showTitle,t=void 0===o||o,a=e.showDescription,c=void 0===a||a;return(0,r.jsxs)("div",{className:"msf-form-header",children:[t&&(0,r.jsx)("h2",{className:"msf-form-title",children:i}),c&&(0,r.jsx)("p",{className:"msf-form-description",children:l})]})}}}]); \ No newline at end of file diff --git a/build/734.js b/build/734.js index 5fcdb27..d96a9cc 100644 --- a/build/734.js +++ b/build/734.js @@ -1,2 +1,2 @@ /*! For license information please see 734.js.LICENSE.txt */ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[734],{734(t,e,n){n.d(e,{default:()=>D});var r=n(594),o=n(470),i=n(214),u=n(842),a=n.n(u);function c(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return s(l,"_invoke",function(n,r,o){var i,a,c,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,c=t,p.n=n,u}};function d(n,r){for(a=n,c=r,e=0;!f&&s&&!o&&e3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&dr||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,l,m){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,m),a=l,c=m;(e=a<2?t:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(e){i=t,a=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),l}var u={};function a(){}function l(){}function f(){}e=Object.getPrototypeOf;var p=[][r]?e(e([][r]())):(s(e={},r,function(){return this}),e),d=f.prototype=a.prototype=Object.create(p);function m(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return l.prototype=f,s(d,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m}})()}function s(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,n,r){function i(e,n){s(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},s(t,e,n,r)}function l(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function f(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){l(i,r,o,u,a,"next",t)}function a(t){l(i,r,o,u,a,"throw",t)}u(void 0)})}}var p=function(){var t=f(c().m(function t(e){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e),method:"GET"}))},t)}));return function(e){return t.apply(this,arguments)}}(),d=function(){var t=f(c().m(function t(e,n){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e),method:"POST",data:n}))},t)}));return function(e,n){return t.apply(this,arguments)}}(),m=function(){var t=f(c().m(function t(){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms",method:"GET"}))},t)}));return function(){return t.apply(this,arguments)}}(),v=function(){var t=f(c().m(function t(e){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e,"/submissions"),method:"GET"}))},t)}));return function(e){return t.apply(this,arguments)}}(),y={getForm:p,saveForm:d,listForms:m,listSubmissions:v},b=function(){var t,e,n=null===(t=window.wp)||void 0===t||null===(t=t.data)||void 0===t||null===(e=t.dispatch)||void 0===e?void 0:e.call(t,"core/editor");if(null!=n&&n.savePost)n.savePost();else{var r=document.getElementById("publish");if(r)r.click();else{var o=document.getElementById("post");o&&o.submit()}}};function h(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,s=Object.create(c.prototype);return g(s,"_invoke",function(n,r,o){var i,a,c,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,c=t,p.n=n,u}};function d(n,r){for(a=n,c=r,e=0;!f&&s&&!o&&e3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&dr||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,l,m){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,m),a=l,c=m;(e=a<2?t:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(e){i=t,a=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var u={};function a(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(g(e={},r,function(){return this}),e),f=s.prototype=a.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,g(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,g(f,"constructor",s),g(s,"constructor",c),c.displayName="GeneratorFunction",g(s,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,r,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:i,m:p}})()}function g(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,e,n,r){function i(e,n){g(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},g(t,e,n,r)}function j(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function S(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){j(i,r,o,u,a,"next",t)}function a(t){j(i,r,o,u,a,"throw",t)}u(void 0)})}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&void 0!==arguments[2]?arguments[2]:function(){return!1},u=null===(n=window.wp)||void 0===n||null===(n=n.data)||void 0===n||null===(r=n.select)||void 0===r?void 0:r.call(n,"core/editor"),c=null===(o=window.wp)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.subscribe,s=!1;if(c&&u){var l=c(function(){var n,r,o,u,c=null===(n=window.wp)||void 0===n||null===(n=n.data)||void 0===n||null===(r=n.select)||void 0===r?void 0:r.call(n,"core/editor"),l=null==c||null===(o=c.isSavingPost)||void 0===o?void 0:o.call(c),f=null==c||null===(u=c.isAutosavingPost)||void 0===u?void 0:u.call(c);if(l&&!f){if(!s&&(s=!0,!i())){var p=e();a()({path:"/msf/v1/forms/".concat(t),method:"POST",data:p}).catch(function(){})}}else s=!1});return"function"==typeof l?l:function(){}}var f=function(){var n=e();a()({path:"/msf/v1/forms/".concat(t),method:"POST",data:n}).catch(function(){})},p=document.getElementById("publish"),d=document.getElementById("save-post");return p&&p.addEventListener("click",f,{once:!1}),d&&d.addEventListener("click",f,{once:!1}),function(){p&&p.removeEventListener("click",f),d&&d.removeEventListener("click",f)}}(t,function(){return n},function(){return g.current});return function(){"function"==typeof e&&e()}},[t,n]),{formConfig:n,setFormConfig:i,loading:c,saving:f,notice:m,setNotice:v,saveForm:O}}(e),u=n.formConfig,c=n.setFormConfig,s=n.loading,l=n.saving,f=n.notice,p=n.setNotice,d=n.saveForm,m=F(u,c),v=m.addStep,g=m.updateStep,j=m.deleteStep,O=m.moveStep,_=m.updateSettings;if(s)return(0,I.jsxs)("div",{className:"msf-loading",children:[(0,I.jsx)(i.Spinner,{}),(0,I.jsx)("p",{children:(0,o.__)("Loading form...","multi-step-form-builder")})]});var x=[{name:"steps",title:(0,o.__)("Steps","multi-step-form-builder"),className:"msf-tab-steps"},{name:"header",title:(0,o.__)("Header","multi-step-form-builder"),className:"msf-tab-header"},{name:"settings",title:(0,o.__)("Settings","multi-step-form-builder"),className:"msf-tab-settings"}];return(0,I.jsxs)("div",{className:"msf-form-builder",children:[f&&(0,I.jsx)(i.Notice,{status:f.type,onRemove:function(){return p(null)},isDismissible:!0,children:f.message}),(0,I.jsx)("div",{className:"msf-builder-header",children:(0,I.jsx)(i.Button,{variant:"primary",onClick:d,isBusy:l,disabled:l,children:l?(0,o.__)("Saving...","multi-step-form-builder"):(0,o.__)("Save Form","multi-step-form-builder")})}),(0,I.jsx)(i.TabPanel,{className:"msf-tabs",activeClass:"is-active",tabs:x,children:function(t){return(0,I.jsx)(r.Suspense,{fallback:(0,I.jsx)("div",{className:"msf-loading-tab",children:(0,I.jsx)(i.Spinner,{})}),children:"header"===t.name?(0,I.jsx)("div",{className:"msf-header-panel",children:(0,I.jsx)(B,{formConfig:u,updateFormConfig:c})}):"steps"===t.name?(0,I.jsxs)("div",{className:"msf-steps-panel",children:[(null===(n=u.steps)||void 0===n?void 0:n.length)>0?u.steps.map(function(t,e){return(0,I.jsxs)("div",{className:"msf-step-wrapper",children:[(0,I.jsxs)("div",{className:"msf-step-controls",children:[(0,I.jsxs)("span",{className:"msf-step-number",children:[(0,o.__)("Step","multi-step-form-builder")," ",e+1]}),(0,I.jsxs)("div",{className:"msf-step-move-buttons",children:[e>0&&(0,I.jsx)(i.Button,{icon:"arrow-up",onClick:function(){return O(e,e-1)},label:(0,o.__)("Move Up","multi-step-form-builder"),isSmall:!0}),eD});var r=n(594),o=n(470),i=n(214),u=n(842),a=n.n(u);function c(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return s(l,"_invoke",function(n,r,o){var i,a,c,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,c=t,p.n=n,u}};function d(n,r){for(a=n,c=r,e=0;!f&&s&&!o&&e3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&dr||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,l,m){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,m),a=l,c=m;(e=a<2?t:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(e){i=t,a=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),l}var u={};function a(){}function l(){}function f(){}e=Object.getPrototypeOf;var p=[][r]?e(e([][r]())):(s(e={},r,function(){return this}),e),d=f.prototype=a.prototype=Object.create(p);function m(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return l.prototype=f,s(d,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m}})()}function s(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,n,r){function i(e,n){s(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},s(t,e,n,r)}function l(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function f(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){l(i,r,o,u,a,"next",t)}function a(t){l(i,r,o,u,a,"throw",t)}u(void 0)})}}var p=function(){var t=f(c().m(function t(e){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e),method:"GET"}))},t)}));return function(e){return t.apply(this,arguments)}}(),d=function(){var t=f(c().m(function t(e,n){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e),method:"POST",data:n}))},t)}));return function(e,n){return t.apply(this,arguments)}}(),m=function(){var t=f(c().m(function t(){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms",method:"GET"}))},t)}));return function(){return t.apply(this,arguments)}}(),v=function(){var t=f(c().m(function t(e){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,a()({path:"/msf/v1/forms/".concat(e,"/submissions"),method:"GET"}))},t)}));return function(e){return t.apply(this,arguments)}}(),y={getForm:p,saveForm:d,listForms:m,listSubmissions:v},b=function(){var t,e,n=null===(t=window.wp)||void 0===t||null===(t=t.data)||void 0===t||null===(e=t.dispatch)||void 0===e?void 0:e.call(t,"core/editor");if(null!=n&&n.savePost)n.savePost();else{var r=document.getElementById("publish");if(r)r.click();else{var o=document.getElementById("post");o&&o.submit()}}};function h(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,s=Object.create(c.prototype);return j(s,"_invoke",function(n,r,o){var i,a,c,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,c=t,p.n=n,u}};function d(n,r){for(a=n,c=r,e=0;!f&&s&&!o&&e3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&dr||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,l,m){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,m),a=l,c=m;(e=a<2?t:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(s=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(e){i=t,a=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var u={};function a(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(j(e={},r,function(){return this}),e),f=s.prototype=a.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,j(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,j(f,"constructor",s),j(s,"constructor",c),c.displayName="GeneratorFunction",j(s,o,"GeneratorFunction"),j(f),j(f,o,"Generator"),j(f,r,function(){return this}),j(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:i,m:p}})()}function j(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}j=function(t,e,n,r){function i(e,n){j(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},j(t,e,n,r)}function g(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,o)}function S(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){g(i,r,o,u,a,"next",t)}function a(t){g(i,r,o,u,a,"throw",t)}u(void 0)})}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&void 0!==arguments[2]?arguments[2]:function(){return!1},u=null===(n=window.wp)||void 0===n||null===(n=n.data)||void 0===n||null===(r=n.select)||void 0===r?void 0:r.call(n,"core/editor"),c=null===(o=window.wp)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.subscribe,s=!1;if(c&&u){var l=c(function(){var n,r,o,u,c=null===(n=window.wp)||void 0===n||null===(n=n.data)||void 0===n||null===(r=n.select)||void 0===r?void 0:r.call(n,"core/editor"),l=null==c||null===(o=c.isSavingPost)||void 0===o?void 0:o.call(c),f=null==c||null===(u=c.isAutosavingPost)||void 0===u?void 0:u.call(c);if(l&&!f){if(!s&&(s=!0,!i())){var p=e();a()({path:"/msf/v1/forms/".concat(t),method:"POST",data:p}).catch(function(){})}}else s=!1});return"function"==typeof l?l:function(){}}var f=function(){var n=e();a()({path:"/msf/v1/forms/".concat(t),method:"POST",data:n}).catch(function(){})},p=document.getElementById("publish"),d=document.getElementById("save-post");return p&&p.addEventListener("click",f,{once:!1}),d&&d.addEventListener("click",f,{once:!1}),function(){p&&p.removeEventListener("click",f),d&&d.removeEventListener("click",f)}}(t,function(){return n},function(){return j.current});return function(){"function"==typeof e&&e()}},[t,n]),{formConfig:n,setFormConfig:i,loading:c,saving:f,notice:m,setNotice:v,saveForm:_}}(e),u=n.formConfig,c=n.setFormConfig,s=n.loading,l=n.saving,f=n.notice,p=n.setNotice,d=n.saveForm,m=F(u,c),v=m.addStep,j=m.updateStep,g=m.deleteStep,_=m.moveStep,O=m.updateSettings;if(s)return(0,I.jsxs)("div",{className:"msf-loading",children:[(0,I.jsx)(i.Spinner,{}),(0,I.jsx)("p",{children:(0,o.__)("Loading form...","jpjuliao-multi-step-form-builder")})]});var x=[{name:"steps",title:(0,o.__)("Steps","jpjuliao-multi-step-form-builder"),className:"msf-tab-steps"},{name:"header",title:(0,o.__)("Header","jpjuliao-multi-step-form-builder"),className:"msf-tab-header"},{name:"settings",title:(0,o.__)("Settings","jpjuliao-multi-step-form-builder"),className:"msf-tab-settings"}];return(0,I.jsxs)("div",{className:"msf-form-builder",children:[f&&(0,I.jsx)(i.Notice,{status:f.type,onRemove:function(){return p(null)},isDismissible:!0,children:f.message}),(0,I.jsx)("div",{className:"msf-builder-header",children:(0,I.jsx)(i.Button,{variant:"primary",onClick:d,isBusy:l,disabled:l,children:l?(0,o.__)("Saving...","jpjuliao-multi-step-form-builder"):(0,o.__)("Save Form","jpjuliao-multi-step-form-builder")})}),(0,I.jsx)(i.TabPanel,{className:"msf-tabs",activeClass:"is-active",tabs:x,children:function(t){return(0,I.jsx)(r.Suspense,{fallback:(0,I.jsx)("div",{className:"msf-loading-tab",children:(0,I.jsx)(i.Spinner,{})}),children:"header"===t.name?(0,I.jsx)("div",{className:"msf-header-panel",children:(0,I.jsx)(B,{formConfig:u,updateFormConfig:c})}):"steps"===t.name?(0,I.jsxs)("div",{className:"msf-steps-panel",children:[(null===(n=u.steps)||void 0===n?void 0:n.length)>0?u.steps.map(function(t,e){return(0,I.jsxs)("div",{className:"msf-step-wrapper",children:[(0,I.jsxs)("div",{className:"msf-step-controls",children:[(0,I.jsxs)("span",{className:"msf-step-number",children:[(0,o.__)("Step","jpjuliao-multi-step-form-builder")," ",e+1]}),(0,I.jsxs)("div",{className:"msf-step-move-buttons",children:[e>0&&(0,I.jsx)(i.Button,{icon:"arrow-up",onClick:function(){return _(e,e-1)},label:(0,o.__)("Move Up","jpjuliao-multi-step-form-builder"),isSmall:!0}),eb});var n=r(594),o=r(470),l=r(214),i=r(848);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);rb});var n=r(594),o=r(470),l=r(214),i=r(848);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);ro});var i=s(214),l=s(470),t=s(594),r=s(848),d=(0,t.lazy)(function(){return s.e(826).then(s.bind(s,826))});const o=function(e){var n=e.fields,s=e.onUpdateField,o=e.onDeleteField,a=e.onMoveField;return n&&0!==n.length?(0,r.jsx)("div",{className:"msf-fields-list-items",children:n.map(function(e,l){return(0,r.jsxs)("div",{className:"msf-field-item",children:[l>0&&(0,r.jsx)(i.Button,{icon:"arrow-up",onClick:function(){return a(l,l-1)},isSmall:!0,className:"msf-move-btn"}),(0,r.jsx)(t.Suspense,{fallback:(0,r.jsx)("div",{className:"msf-field-loading",children:"Loading field..."}),children:(0,r.jsx)(d,{field:e,onUpdate:function(e){return s(l,e)},onDelete:function(){return o(l)}})}),la});var n=l(214),s=l(470),t=l(594),o=l(848),r=(0,t.lazy)(function(){return l.e(826).then(l.bind(l,826))});const a=function(e){var i=e.fields,l=e.onUpdateField,a=e.onDeleteField,d=e.onMoveField;return i&&0!==i.length?(0,o.jsx)("div",{className:"msf-fields-list-items",children:i.map(function(e,s){return(0,o.jsxs)("div",{className:"msf-field-item",children:[s>0&&(0,o.jsx)(n.Button,{icon:"arrow-up",onClick:function(){return d(s,s-1)},isSmall:!0,className:"msf-move-btn"}),(0,o.jsx)(t.Suspense,{fallback:(0,o.jsx)("div",{className:"msf-field-loading",children:"Loading field..."}),children:(0,o.jsx)(r,{field:e,onUpdate:function(e){return l(s,e)},onDelete:function(){return a(s)}})}),sl});var t=n(594),i=n(848),r=(0,t.lazy)(function(){return n.e(414).then(n.bind(n,33))});const l=function(e){var s,n=e.step,t=e.formData,l=e.errors,a=e.updateFieldValue;return n?(0,i.jsxs)("div",{className:"msf-step-content",children:[n.title&&(0,i.jsx)("h3",{className:"msf-step-title",children:n.title}),n.description&&(0,i.jsx)("p",{className:"msf-step-description",children:n.description}),(0,i.jsx)("div",{className:"msf-fields",children:null===(s=n.fields)||void 0===s?void 0:s.map(function(e,s){return(0,i.jsx)(r,{field:e,value:t[e.name],onChange:function(s){return a(e.name,s)},error:l[e.name]},e.name||s)})})]}):null}}}]); \ No newline at end of file +"use strict";(self.webpackChunkjpjuliao_multi_step_form_builder=self.webpackChunkjpjuliao_multi_step_form_builder||[]).push([[891],{891(e,s,n){n.r(s),n.d(s,{default:()=>r});var t=n(594),i=n(848),l=(0,t.lazy)(function(){return n.e(414).then(n.bind(n,33))});const r=function(e){var s,n=e.step,t=e.formData,r=e.errors,a=e.updateFieldValue;return n?(0,i.jsxs)("div",{className:"msf-step-content",children:[n.title&&(0,i.jsx)("h3",{className:"msf-step-title",children:n.title}),n.description&&(0,i.jsx)("p",{className:"msf-step-description",children:n.description}),(0,i.jsx)("div",{className:"msf-fields",children:null===(s=n.fields)||void 0===s?void 0:s.map(function(e,s){return(0,i.jsx)(l,{field:e,value:t[e.name],onChange:function(s){return a(e.name,s)},error:r[e.name]},e.name||s)})})]}):null}}}]); \ No newline at end of file diff --git a/build/980.js b/build/980.js index 108abc3..76fa86e 100644 --- a/build/980.js +++ b/build/980.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmulti_step_form_builder=self.webpackChunkmulti_step_form_builder||[]).push([[980],{980(e,t,r){r.r(t),r.d(t,{default:()=>v});var n=r(594),i=r(470),o=r(214),l=r(848);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function a(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return f(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rj});var n=r(594),i=r(470),o=r(214),l=r(848);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function a(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return f(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{"use strict";var e,r,t={338(e,r,t){var o=t(206);r.H=o.createRoot,o.hydrateRoot},20(e,r,t){var o=t(594),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var o,a={},u=null,p=null;for(o in void 0!==t&&(u=""+t),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(p=r.ref),r)i.call(r,o)&&!l.hasOwnProperty(o)&&(a[o]=r[o]);if(e&&e.defaultProps)for(o in r=e.defaultProps)void 0===a[o]&&(a[o]=r[o]);return{$$typeof:n,type:e,key:u,ref:p,props:a,_owner:s.current}}r.Fragment=a,r.jsx=u,r.jsxs=u},848(e,r,t){e.exports=t(20)},594(e){e.exports=React},206(e){e.exports=ReactDOM},842(e){e.exports=wp.apiFetch},214(e){e.exports=wp.components},470(e){e.exports=wp.i18n}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+".js",n.miniCssF=e=>{},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="multi-step-form-builder:",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var s,l;if(void 0!==a)for(var u=document.getElementsByTagName("script"),p=0;p{s.onerror=s.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),l&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={884:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>o=e[r]=[t,n]);t.push(o[2]=a);var i=n.p+n.u(r),s=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+r,r)}};var r=(r,t)=>{var o,a,[i,s,l]=t,u=0;if(i.some(r=>0!==e[r])){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);l&&l(n)}for(r&&r(t);u{"use strict";var e,r,t={338(e,r,t){var o=t(206);r.H=o.createRoot,o.hydrateRoot},20(e,r,t){var o=t(594),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var o,a={},u=null,p=null;for(o in void 0!==t&&(u=""+t),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(p=r.ref),r)i.call(r,o)&&!s.hasOwnProperty(o)&&(a[o]=r[o]);if(e&&e.defaultProps)for(o in r=e.defaultProps)void 0===a[o]&&(a[o]=r[o]);return{$$typeof:n,type:e,key:u,ref:p,props:a,_owner:l.current}}r.Fragment=a,r.jsx=u,r.jsxs=u},848(e,r,t){e.exports=t(20)},594(e){e.exports=React},206(e){e.exports=ReactDOM},842(e){e.exports=wp.apiFetch},214(e){e.exports=wp.components},470(e){e.exports=wp.i18n}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+".js",n.miniCssF=e=>{},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jpjuliao-multi-step-form-builder:",n.l=(t,o,a,i)=>{if(e[t])e[t].push(o);else{var l,s;if(void 0!==a)for(var u=document.getElementsByTagName("script"),p=0;p{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach(e=>e(o)),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),s&&document.head.appendChild(l)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={884:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,n)=>o=e[r]=[t,n]);t.push(o[2]=a);var i=n.p+n.u(r),l=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,o[1](l)}},"chunk-"+r,r)}};var r=(r,t)=>{var o,a,[i,l,s]=t,u=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);s&&s(n)}for(r&&r(t);u{"use strict";var e,r,t={338(e,r,t){var n=t(206);r.H=n.createRoot,n.hydrateRoot},20(e,r,t){var n=t(594),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var n,u={},d=null,l=null;for(n in void 0!==t&&(d=""+t),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(l=r.ref),r)a.call(r,n)&&!c.hasOwnProperty(n)&&(u[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===u[n]&&(u[n]=r[n]);return{$$typeof:o,type:e,key:d,ref:l,props:u,_owner:i.current}}r.jsx=u,r.jsxs=u},848(e,r,t){e.exports=t(20)},594(e){e.exports=React},206(e){e.exports=ReactDOM},842(e){e.exports=wp.apiFetch}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+".js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="multi-step-form-builder:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var c,u;if(void 0!==a)for(var d=document.getElementsByTagName("script"),l=0;l{c.onerror=c.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=s.bind(null,c.onerror),c.onload=s.bind(null,c.onload),u&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={343:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=a);var i=o.p+o.u(r),c=new Error;o.l(i,t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;c.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",c.name="ChunkLoadError",c.type=a,c.request=i,n[1](c)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[i,c,u]=t,d=0;if(i.some(r=>0!==e[r])){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);u&&u(o)}for(r&&r(t);d3?(o=m===n)&&(u=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=t<2&&pn||n>m)&&(a[4]=t,a[5]=n,s.n=m,c=0))}if(o||t>1)return i;throw f=!0,n}return function(o,l,m){if(d>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,m),c=l,u=m;(r=c<2?e:u)||!f;){a||(c?c<3?(c>1&&(s.n=-1),p(c,u)):s.n=u:s.v=u);try{if(d=2,a){if(c||(o="next"),r=a[o]){if(!(r=r.call(a,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,c<2&&(c=0)}else 1===c&&(r=a.return)&&r.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((r=(f=s.n<0)?u:t.call(n,s))!==i)break}catch(r){a=e,c=1,u=r}finally{d=1}}return{value:r,done:f}}}(t,o,a),!0),d}var i={};function c(){}function u(){}function f(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(l(r={},n,function(){return this}),r),p=f.prototype=c.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=f,l(p,"constructor",f),l(f,"constructor",u),u.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(d=function(){return{w:a,m}})()}function l(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,r,t,n){function a(r,t){l(e,r,function(e){return this._invoke(r,t,e)})}r?o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(a("next",0),a("throw",1),a("return",2))},l(e,r,t,n)}function f(e,r,t,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){f(a,n,o,i,c,"next",e)}function c(e){f(a,n,o,i,c,"throw",e)}i(void 0)})}}window.msfFrontend&&(c().use(c().createNonceMiddleware(window.msfFrontend.nonce)),c().use(c().createRootURLMiddleware(window.msfFrontend.restUrl))),document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".msf-form-container");Array.from(e).forEach(function(){var e=s(d().m(function e(r){var t,n,i,l,f;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=r.dataset.formId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,c()({path:"/msf/v1/forms/".concat(t)});case 2:n=e.v,(i=n.settings||{}).showModalOnLoad?((l=document.createElement("div")).id="msf-modal-".concat(t),document.body.appendChild(l),o.e(33).then(o.bind(o,414)).then(function(e){var r=e.default;(0,a.H)(l).render((0,u.jsx)(r,{formId:t,showModalOnLoad:!0,modalDelay:i.modalDelay||0}))}),r.remove()):o.e(463).then(o.bind(o,463)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t}))}),e.n=4;break;case 3:e.p=3,f=e.v,console.error("Error initializing form:",f),o.e(463).then(o.bind(o,463)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t}))});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(r){return e.apply(this,arguments)}}());var r=document.querySelectorAll(".msf-modal-trigger");Array.from(r).forEach(function(){var e=s(d().m(function e(r){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=r.dataset.formId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,c()({path:"/msf/v1/forms/".concat(t)});case 2:if((e.v.settings||{}).showModalOnButtonClick){e.n=3;break}return e.a(2);case 3:r.addEventListener("click",function(){var e=document.getElementById("msf-modal-trigger-".concat(t));e&&e.remove();var r=document.createElement("div");r.id="msf-modal-trigger-".concat(t),document.body.appendChild(r),o.e(33).then(o.bind(o,414)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t,showModalOnLoad:!0,modalDelay:0}))})}),e.n=5;break;case 4:e.p=4,n=e.v,console.error("Error initializing modal trigger:",n);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(r){return e.apply(this,arguments)}}()),window.msfFrontend&&window.msfFrontend.modalForms&&window.msfFrontend.modalForms.forEach(function(e){var r=document.createElement("div");r.id="msf-modal-".concat(e.id),document.body.appendChild(r),o.e(33).then(o.bind(o,414)).then(function(t){var n=t.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:e.id,showModalOnLoad:!0,modalDelay:e.delay||0}))})})})})(); \ No newline at end of file +(()=>{"use strict";var e,r,t={338(e,r,t){var n=t(206);r.H=n.createRoot,n.hydrateRoot},20(e,r,t){var n=t(594),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var n,u={},d=null,l=null;for(n in void 0!==t&&(d=""+t),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(l=r.ref),r)a.call(r,n)&&!c.hasOwnProperty(n)&&(u[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===u[n]&&(u[n]=r[n]);return{$$typeof:o,type:e,key:d,ref:l,props:u,_owner:i.current}}r.jsx=u,r.jsxs=u},848(e,r,t){e.exports=t(20)},594(e){e.exports=React},206(e){e.exports=ReactDOM},842(e){e.exports=wp.apiFetch}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+".js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jpjuliao-multi-step-form-builder:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var c,u;if(void 0!==a)for(var d=document.getElementsByTagName("script"),l=0;l{c.onerror=c.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=s.bind(null,c.onerror),c.onload=s.bind(null,c.onload),u&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={343:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=a);var i=o.p+o.u(r),c=new Error;o.l(i,t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;c.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",c.name="ChunkLoadError",c.type=a,c.request=i,n[1](c)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[i,c,u]=t,d=0;if(i.some(r=>0!==e[r])){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);u&&u(o)}for(r&&r(t);d3?(o=m===n)&&(u=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=t<2&&pn||n>m)&&(a[4]=t,a[5]=n,s.n=m,c=0))}if(o||t>1)return i;throw f=!0,n}return function(o,l,m){if(d>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,m),c=l,u=m;(r=c<2?e:u)||!f;){a||(c?c<3?(c>1&&(s.n=-1),p(c,u)):s.n=u:s.v=u);try{if(d=2,a){if(c||(o="next"),r=a[o]){if(!(r=r.call(a,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,c<2&&(c=0)}else 1===c&&(r=a.return)&&r.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((r=(f=s.n<0)?u:t.call(n,s))!==i)break}catch(r){a=e,c=1,u=r}finally{d=1}}return{value:r,done:f}}}(t,o,a),!0),d}var i={};function c(){}function u(){}function f(){}r=Object.getPrototypeOf;var s=[][n]?r(r([][n]())):(l(r={},n,function(){return this}),r),p=f.prototype=c.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=f,l(p,"constructor",f),l(f,"constructor",u),u.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(d=function(){return{w:a,m}})()}function l(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,r,t,n){function a(r,t){l(e,r,function(e){return this._invoke(r,t,e)})}r?o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(a("next",0),a("throw",1),a("return",2))},l(e,r,t,n)}function f(e,r,t,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){f(a,n,o,i,c,"next",e)}function c(e){f(a,n,o,i,c,"throw",e)}i(void 0)})}}window.msfFrontend&&(c().use(c().createNonceMiddleware(window.msfFrontend.nonce)),c().use(c().createRootURLMiddleware(window.msfFrontend.restUrl))),document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".msf-form-container");Array.from(e).forEach(function(){var e=s(d().m(function e(r){var t,n,i,l,f;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=r.dataset.formId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,c()({path:"/msf/v1/forms/".concat(t)});case 2:n=e.v,(i=n.settings||{}).showModalOnLoad?((l=document.createElement("div")).id="msf-modal-".concat(t),document.body.appendChild(l),o.e(33).then(o.bind(o,414)).then(function(e){var r=e.default;(0,a.H)(l).render((0,u.jsx)(r,{formId:t,showModalOnLoad:!0,modalDelay:i.modalDelay||0}))}),r.remove()):o.e(463).then(o.bind(o,463)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t}))}),e.n=4;break;case 3:e.p=3,f=e.v,console.error("Error initializing form:",f),o.e(463).then(o.bind(o,463)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t}))});case 4:return e.a(2)}},e,null,[[1,3]])}));return function(r){return e.apply(this,arguments)}}());var r=document.querySelectorAll(".msf-modal-trigger");Array.from(r).forEach(function(){var e=s(d().m(function e(r){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=r.dataset.formId){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,c()({path:"/msf/v1/forms/".concat(t)});case 2:if((e.v.settings||{}).showModalOnButtonClick){e.n=3;break}return e.a(2);case 3:r.addEventListener("click",function(){var e=document.getElementById("msf-modal-trigger-".concat(t));e&&e.remove();var r=document.createElement("div");r.id="msf-modal-trigger-".concat(t),document.body.appendChild(r),o.e(33).then(o.bind(o,414)).then(function(e){var n=e.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:t,showModalOnLoad:!0,modalDelay:0}))})}),e.n=5;break;case 4:e.p=4,n=e.v,console.error("Error initializing modal trigger:",n);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(r){return e.apply(this,arguments)}}()),window.msfFrontend&&window.msfFrontend.modalForms&&window.msfFrontend.modalForms.forEach(function(e){var r=document.createElement("div");r.id="msf-modal-".concat(e.id),document.body.appendChild(r),o.e(33).then(o.bind(o,414)).then(function(t){var n=t.default;(0,a.H)(r).render((0,u.jsx)(n,{formId:e.id,showModalOnLoad:!0,modalDelay:e.delay||0}))})})})})(); \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..5fc6dec --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "jpjuliao/multi-step-form-builder", + "description": "Multi Step Form Builder for WordPress", + "type": "wordpress-plugin", + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6", + "wp-phpunit/wp-phpunit": "^6.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "wp-coding-standards/wpcs": "^3.0" + }, + "autoload": { + "psr-4": { + "JPJULIAO\\Wordpress\\MultiStepFormBuilder\\": "includes/" + } + }, + "autoload-dev": { + "psr-4": { + "JPJULIAO\\Wordpress\\MultiStepFormBuilder\\Tests\\": "tests/" + } + }, + "scripts": { + "format": "phpcbf", + "lint": "phpcs", + "test": "phpunit" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ef417be --- /dev/null +++ b/composer.lock @@ -0,0 +1,2282 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "37fc7f7eaeb23ad4ee5a63e2f64b5ee5", + "packages": [], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.2", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "^2.2", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-11T04:32:07+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:23:10+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.13.4", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2025-08-01T08:46:24+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.7.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" + }, + "time": "2025-12-06T11:56:16+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "b598aa890815b8df16363271b659d73280129101" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/b598aa890815b8df16363271b659d73280129101", + "reference": "b598aa890815b8df16363271b659d73280129101", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.2.0", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-12T23:06:57+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "c216317e96c8b3f5932808f9b0f1f7a14e3bbf55" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c216317e96c8b3f5932808f9b0f1f7a14e3bbf55", + "reference": "c216317e96c8b3f5932808f9b0f1f7a14e3bbf55", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "phpcs4", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-12-08T14:27:58+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.32", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.19.1 || ^5.1.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.6" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-08-22T04:23:01+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.6.34", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "b36f02317466907a230d3aa1d34467041271ef4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b36f02317466907a230d3aa1d34467041271ef4a", + "reference": "b36f02317466907a230d3aa1d34467041271ef4a", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.5.0 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", + "sebastian/comparator": "^4.0.10", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.8", + "sebastian/global-state": "^5.0.8", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.34" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2026-01-27T05:45:00+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:27:43+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e4df00b9b3571187db2831ae9aada2c6efbd715d", + "reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.10" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-01-24T09:22:56+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c", + "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2025-09-24T06:03:27+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" + } + ], + "time": "2025-08-10T07:10:35+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2025-08-10T06:57:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-14T16:00:52+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.13.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-04T16:30:35+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2025-11-17T20:03:58+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "7795ec6fa05663d716a549d0b44e47ffc8b0d4a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7795ec6fa05663d716a549d0b44e47ffc8b0d4a6", + "reference": "7795ec6fa05663d716a549d0b44e47ffc8b0d4a6", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", + "php": ">=7.2", + "phpcsstandards/phpcsextra": "^1.5.0", + "phpcsstandards/phpcsutils": "^1.1.0", + "squizlabs/php_codesniffer": "^3.13.4" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "suggest": { + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", + "source": "https://github.com/WordPress/WordPress-Coding-Standards", + "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2025-11-25T12:08:04+00:00" + }, + { + "name": "wp-phpunit/wp-phpunit", + "version": "6.9.1", + "source": { + "type": "git", + "url": "https://github.com/wp-phpunit/wp-phpunit.git", + "reference": "15fd216bf6516670d8d07b938675925bfa5c15b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/15fd216bf6516670d8d07b938675925bfa5c15b0", + "reference": "15fd216bf6516670d8d07b938675925bfa5c15b0", + "shasum": "" + }, + "type": "library", + "autoload": { + "files": [ + "__loaded.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Evan Mattson", + "email": "me@aaemnnost.tv" + }, + { + "name": "WordPress Community", + "homepage": "https://wordpress.org/about/" + } + ], + "description": "WordPress core PHPUnit library", + "homepage": "https://github.com/wp-phpunit", + "keywords": [ + "phpunit", + "test", + "wordpress" + ], + "support": { + "docs": "https://github.com/wp-phpunit/docs", + "issues": "https://github.com/wp-phpunit/issues", + "source": "https://github.com/wp-phpunit/wp-phpunit" + }, + "time": "2026-02-04T01:48:23+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^8.0" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/includes/Admin.php b/includes/Admin.php new file mode 100644 index 0000000..5879533 --- /dev/null +++ b/includes/Admin.php @@ -0,0 +1,112 @@ +post_type ) { + \wp_enqueue_script( + 'msf-admin', + \plugin_dir_url( __DIR__ ) . 'build/admin.js', + array( 'wp-element', 'wp-components', 'wp-i18n', 'wp-api-fetch', 'wp-data' ), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/admin.js' ), + true + ); + + \wp_enqueue_style( + 'msf-admin', + \plugin_dir_url( __DIR__ ) . 'build/admin.css', + array( 'wp-components' ), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/admin.css' ) + ); + + \wp_localize_script( + 'msf-admin', + 'msfAdmin', + array( + 'formId' => $post->ID, + 'apiUrl' => \rest_url( 'msf/v1' ), + 'nonce' => \wp_create_nonce( 'wp_rest' ), + ) + ); + } + } + + $page = \sanitize_key( + (string) \filter_input( + INPUT_GET, + 'page', + FILTER_SANITIZE_FULL_SPECIAL_CHARS + ) + ); + if ( 'msf-submissions' === $page ) { + \wp_enqueue_script( + 'msf-admin', + \plugin_dir_url( __DIR__ ) . 'build/admin.js', + array( 'wp-element', 'wp-components', 'wp-i18n', 'wp-api-fetch', 'wp-data' ), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/admin.js' ), + true + ); + + \wp_enqueue_style( + 'msf-admin', + \plugin_dir_url( __DIR__ ) . 'build/admin.css', + array( 'wp-components' ), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/admin.css' ) + ); + + $form_id = (int) \filter_input( + INPUT_GET, + 'form_id', + FILTER_SANITIZE_NUMBER_INT + ); + + \wp_localize_script( + 'msf-admin', + 'msfAdmin', + array( + 'formId' => $form_id, + 'apiUrl' => \rest_url( 'msf/v1' ), + 'nonce' => \wp_create_nonce( 'wp_rest' ), + ) + ); + } + } + + public function add_admin_menu(): void { + \add_submenu_page( + 'edit.php?post_type=msf_form', + __( 'Submissions', 'jpjuliao-multi-step-form-builder' ), + __( 'Submissions', 'jpjuliao-multi-step-form-builder' ), + 'manage_options', + 'msf-submissions', + array( $this, 'render_submissions_page' ) + ); + } + + public function render_submissions_page(): void { + ?> +
+

+ +

+
+
+ table_name = $wpdb->prefix . 'msf_submissions'; + } + + public function create_table(): void { + global $wpdb; + + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE IF NOT EXISTS {$this->table_name} ( + id bigint(20) NOT NULL AUTO_INCREMENT, + form_id bigint(20) NOT NULL, + user_id bigint(20) DEFAULT NULL, + submission_data longtext NOT NULL, + ip_address varchar(100) DEFAULT NULL, + user_agent varchar(255) DEFAULT NULL, + created_at datetime DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id), + KEY form_id (form_id), + KEY user_id (user_id), + KEY created_at (created_at) + ) $charset_collate;"; + + require_once \ABSPATH . 'wp-admin/includes/upgrade.php'; + \dbDelta( $sql ); + } + + public function save_submission( int $form_id, array $data ): int|false { + global $wpdb; + + $user_id = \get_current_user_id(); + $ip_address = $this->get_client_ip(); + $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) + ? \sanitize_text_field( \wp_unslash( (string) $_SERVER['HTTP_USER_AGENT'] ) ) + : ''; + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Using $wpdb->insert for custom plugin table writes. + $result = $wpdb->insert( + $this->table_name, + array( + 'form_id' => $form_id, + 'user_id' => $user_id ? $user_id : null, + 'submission_data' => \wp_json_encode( $data ), + 'ip_address' => $ip_address, + 'user_agent' => $user_agent, + ), + array( '%d', '%d', '%s', '%s', '%s' ) + ); + + return false !== $result ? $wpdb->insert_id : false; + } + + public function get_submissions( int $form_id, int $limit = 50, int $offset = 0 ): array { + global $wpdb; + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + $results = $wpdb->get_results( + $wpdb->prepare( + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is trusted (constructed from $wpdb->prefix + constant); only dynamic values are parameterized via $wpdb->prepare(). + "SELECT * FROM {$this->table_name} WHERE form_id = %d ORDER BY created_at DESC LIMIT %d OFFSET %d", + $form_id, + $limit, + $offset + ) + ); + + foreach ( $results as &$result ) { + $result->submission_data = json_decode( $result->submission_data, true ); + } + + return $results; + } + + public function get_submission_count( int $form_id ): int { + global $wpdb; + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + return (int) $wpdb->get_var( + $wpdb->prepare( + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is trusted (constructed from $wpdb->prefix + constant); only dynamic values are parameterized via $wpdb->prepare(). + "SELECT COUNT(*) FROM {$this->table_name} WHERE form_id = %d", + $form_id + ) + ); + } + + public function delete_submission( int $id ): bool { + global $wpdb; + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Using $wpdb->delete for custom plugin table deletions; no caching layer is required here. + return $wpdb->delete( + $this->table_name, + array( 'id' => $id ), + array( '%d' ) + ); + } + + private function get_client_ip(): string { + $ip_keys = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ); + + foreach ( $ip_keys as $key ) { + if ( array_key_exists( $key, $_SERVER ) === true ) { + $server_value = \sanitize_text_field( \wp_unslash( (string) $_SERVER[ $key ] ) ); + foreach ( explode( ',', $server_value ) as $ip ) { + $ip = trim( $ip ); + if ( filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) { + return $ip; + } + } + } + } + + return ''; + } +} diff --git a/includes/Frontend.php b/includes/Frontend.php new file mode 100644 index 0000000..c0e1587 --- /dev/null +++ b/includes/Frontend.php @@ -0,0 +1,91 @@ +post_content, 'multi_step_form' ) ) { + $should_enqueue = true; + } + + if ( ! $should_enqueue ) { + $modal_forms = $this->get_modal_forms(); + if ( ! empty( $modal_forms ) ) { + $should_enqueue = true; + } + } + + if ( $should_enqueue ) { + \wp_enqueue_script( + 'msf-frontend', + \plugin_dir_url( __DIR__ ) . 'build/frontend.js', + array( 'wp-element', 'wp-i18n', 'wp-api-fetch' ), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/frontend.js' ), + true + ); + + \wp_enqueue_style( + 'msf-frontend', + \plugin_dir_url( __DIR__ ) . 'build/frontend.css', + array(), + \filemtime( \plugin_dir_path( __DIR__ ) . 'build/frontend.css' ) + ); + + $modal_forms = $this->get_modal_forms(); + + \wp_localize_script( + 'msf-frontend', + 'msfFrontend', + array( + 'apiUrl' => \rest_url( 'msf/v1' ), + 'nonce' => \wp_create_nonce( 'wp_rest' ), + 'restUrl' => \rest_url(), + 'modalForms' => $modal_forms, + ) + ); + } + } + + private function get_modal_forms(): array { + $args = array( + 'post_type' => 'msf_form', + 'post_status' => 'publish', + 'posts_per_page' => -1, + 'fields' => 'ids', + ); + + $form_ids = \get_posts( $args ); + $modal_forms = array(); + + foreach ( $form_ids as $form_id ) { + $config = \get_post_meta( $form_id, '_msf_form_config', true ); + if ( $config ) { + $config = json_decode( $config, true ); + $settings = isset( $config['settings'] ) ? $config['settings'] : array(); + + if ( isset( $settings['showModalOnLoad'] ) && $settings['showModalOnLoad'] ) { + $modal_forms[] = array( + 'id' => $form_id, + 'delay' => isset( $settings['modalDelay'] ) ? intval( $settings['modalDelay'] ) : 0, + ); + } + } + } + + return $modal_forms; + } +} diff --git a/includes/Plugin.php b/includes/Plugin.php new file mode 100644 index 0000000..2b1350a --- /dev/null +++ b/includes/Plugin.php @@ -0,0 +1,53 @@ +init_components(); + + \register_activation_hook( dirname( __DIR__ ) . '/multi-step-form-builder.php', array( $this, 'activate' ) ); + \register_deactivation_hook( dirname( __DIR__ ) . '/multi-step-form-builder.php', array( $this, 'deactivate' ) ); + } + + private function init_components(): void { + $this->database = new Database(); + $this->post_type = new PostType(); + $this->admin = new Admin(); + $this->frontend = new Frontend(); + $this->shortcode = new Shortcode(); + $this->rest_api = new RESTapi( $this->database ); + } + + public function activate(): void { + $this->database->create_table(); + \flush_rewrite_rules(); + } + + public function deactivate(): void { + \flush_rewrite_rules(); + } +} diff --git a/includes/PostType.php b/includes/PostType.php new file mode 100644 index 0000000..b343be7 --- /dev/null +++ b/includes/PostType.php @@ -0,0 +1,103 @@ + __( 'Forms', 'jpjuliao-multi-step-form-builder' ), + 'singular_name' => __( 'Form', 'jpjuliao-multi-step-form-builder' ), + 'menu_name' => __( 'Forms', 'jpjuliao-multi-step-form-builder' ), + 'add_new' => __( 'Add New', 'jpjuliao-multi-step-form-builder' ), + 'add_new_item' => __( 'Add New Form', 'jpjuliao-multi-step-form-builder' ), + 'edit_item' => __( 'Edit Form', 'jpjuliao-multi-step-form-builder' ), + 'new_item' => __( 'New Form', 'jpjuliao-multi-step-form-builder' ), + 'view_item' => __( 'View Form', 'jpjuliao-multi-step-form-builder' ), + 'search_items' => __( 'Search Forms', 'jpjuliao-multi-step-form-builder' ), + 'not_found' => __( 'No forms found', 'jpjuliao-multi-step-form-builder' ), + 'not_found_in_trash' => __( 'No forms found in trash', 'jpjuliao-multi-step-form-builder' ), + ); + + $args = array( + 'labels' => $labels, + 'public' => false, + 'show_ui' => true, + 'show_in_menu' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-list-view', + 'capability_type' => 'post', + 'hierarchical' => false, + 'supports' => array( 'title' ), + 'has_archive' => false, + 'rewrite' => false, + 'query_var' => false, + ); + + \register_post_type( 'msf_form', $args ); + } + + public function add_meta_boxes(): void { + \add_meta_box( + 'msf_form_builder', + __( 'Form Builder', 'jpjuliao-multi-step-form-builder' ), + array( $this, 'render_form_builder' ), + 'msf_form', + 'normal', + 'high' + ); + + \add_meta_box( + 'msf_form_shortcode', + __( 'Shortcode', 'jpjuliao-multi-step-form-builder' ), + array( $this, 'render_shortcode_box' ), + 'msf_form', + 'side', + 'default' + ); + } + + public function render_form_builder(): void { + \wp_nonce_field( 'msf_save_form', 'msf_form_nonce' ); + echo '
'; + } + + public function render_shortcode_box( \WP_Post $post ): void { + if ( $post->ID ) { + echo '

' . esc_html__( 'Use this shortcode to display the form:', 'jpjuliao-multi-step-form-builder' ) . '

'; + echo '[multi_step_form id="' . esc_attr( $post->ID ) . '"]'; + echo '

'; + } else { + echo '

' . esc_html__( 'Save the form to get the shortcode.', 'jpjuliao-multi-step-form-builder' ) . '

'; + } + } + + public function save_form_meta( int $post_id ): void { + $nonce = isset( $_POST['msf_form_nonce'] ) + ? sanitize_text_field( \wp_unslash( $_POST['msf_form_nonce'] ) ) + : ''; + + if ( ! $nonce || ! \wp_verify_nonce( $nonce, 'msf_save_form' ) ) { + return; + } + + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { + return; + } + + if ( ! \current_user_can( 'edit_post', $post_id ) ) { + return; + } + } +} diff --git a/includes/RESTapi.php b/includes/RESTapi.php new file mode 100644 index 0000000..64ecada --- /dev/null +++ b/includes/RESTapi.php @@ -0,0 +1,244 @@ +database = $database; + \add_action( 'rest_api_init', array( $this, 'register_routes' ) ); + } + + public function register_routes(): void { + + \register_rest_route( + 'msf/v1', + '/forms/(?P\d+)/submit', + array( + 'methods' => 'POST', + 'callback' => array( $this, 'submit_form' ), + 'permission_callback' => '__return_true', + ) + ); + + \register_rest_route( + 'msf/v1', + '/forms/(?P\d+)/submissions', + array( + 'methods' => 'GET', + 'callback' => array( $this, 'get_submissions' ), + 'permission_callback' => array( $this, 'check_admin_permission' ), + ) + ); + + \register_rest_route( + 'msf/v1', + '/forms/(?P\d+)', + array( + 'methods' => 'GET', + 'callback' => array( $this, 'get_form' ), + 'permission_callback' => '__return_true', + ) + ); + + \register_rest_route( + 'msf/v1', + '/forms/(?P\d+)', + array( + 'methods' => 'POST', + 'callback' => array( $this, 'save_form' ), + 'permission_callback' => array( $this, 'check_admin_permission' ), + ) + ); + + \register_rest_route( + 'msf/v1', + '/submissions/(?P\d+)', + array( + 'methods' => 'DELETE', + 'callback' => array( $this, 'delete_submission' ), + 'permission_callback' => array( $this, 'check_admin_permission' ), + ) + ); + } + + public function get_form( \WP_REST_Request $request ): \WP_REST_Response { + $form_id = $request->get_param( 'id' ); + + $form_config = \get_post_meta( $form_id, '_msf_form_config', true ); + + if ( is_string( $form_config ) ) { + $form_config = json_decode( $form_config, true ); + } + + if ( empty( $form_config ) || ! is_array( $form_config ) ) { + $form_config = array( + 'steps' => array(), + 'settings' => array( + 'submitButtonText' => 'Submit', + 'successMessage' => 'Thank you for your submission!', + 'nextButtonText' => 'Next', + 'previousButtonText' => 'Previous', + ), + ); + } + + return \rest_ensure_response( $form_config ); + } + + public function save_form( \WP_REST_Request $request ): \WP_REST_Response { + $form_id = $request->get_param( 'id' ); + $form_config = wp_json_encode( $request->get_json_params() ); + + \update_post_meta( $form_id, '_msf_form_config', $form_config ); + + return \rest_ensure_response( + array( + 'success' => true, + 'message' => 'Form saved successfully', + ) + ); + } + + public function submit_form( \WP_REST_Request $request ): \WP_REST_Response|\WP_Error { + $form_id = $request->get_param( 'id' ); + $data = $request->get_json_params(); + + $post = \get_post( $form_id ); + if ( ! $post || 'msf_form' !== $post->post_type ) { + return new \WP_Error( 'invalid_form', 'Invalid form ID', array( 'status' => 404 ) ); + } + + $form_config = \get_post_meta( $form_id, '_msf_form_config', true ); + + if ( is_string( $form_config ) ) { + $form_config = json_decode( $form_config, true ); + } + + $errors = $this->validate_submission( $data, $form_config ); + if ( ! empty( $errors ) ) { + return new \WP_Error( + 'validation_failed', + 'Validation failed', + array( + 'status' => 400, + 'errors' => $errors, + ) + ); + } + + $sanitized_data = $this->sanitize_submission( $data ); + + $submission_id = $this->database->save_submission( $form_id, $sanitized_data ); + + if ( $submission_id ) { + $success_message = isset( $form_config['settings']['successMessage'] ) + ? $form_config['settings']['successMessage'] + : 'Thank you for your submission!'; + + return \rest_ensure_response( + array( + 'success' => true, + 'message' => $success_message, + 'submission_id' => $submission_id, + ) + ); + } else { + return new \WP_Error( 'submission_failed', 'Failed to save submission', array( 'status' => 500 ) ); + } + } + + public function get_submissions( \WP_REST_Request $request ): \WP_REST_Response { + $form_id = $request->get_param( 'id' ); + $page = $request->get_param( 'page' ) + ? (int) $request->get_param( 'page' ) : 1; + $per_page = $request->get_param( 'per_page' ) + ? (int) $request->get_param( 'per_page' ) : 50; + + $offset = ( $page - 1 ) * $per_page; + + $submissions = $this->database->get_submissions( $form_id, $per_page, $offset ); + $total = $this->database->get_submission_count( $form_id ); + + return \rest_ensure_response( + array( + 'submissions' => $submissions, + 'total' => $total, + 'page' => $page, + 'per_page' => $per_page, + 'total_pages' => ceil( $total / $per_page ), + ) + ); + } + + public function delete_submission( \WP_REST_Request $request ): \WP_REST_Response|\WP_Error { + $submission_id = $request->get_param( 'id' ); + + $result = $this->database->delete_submission( $submission_id ); + + if ( $result ) { + return \rest_ensure_response( array( 'success' => true ) ); + } else { + return new \WP_Error( 'delete_failed', 'Failed to delete submission', array( 'status' => 500 ) ); + } + } + + private function validate_submission( array $data, array $form_config ): array { + $errors = array(); + + if ( empty( $form_config['steps'] ) ) { + return $errors; + } + + foreach ( $form_config['steps'] as $step ) { + if ( empty( $step['fields'] ) ) { + continue; + } + + foreach ( $step['fields'] as $field ) { + $field_name = $field['name']; + $field_value = isset( $data[ $field_name ] ) ? $data[ $field_name ] : ''; + + if ( ! empty( $field['required'] ) && empty( $field_value ) ) { + $errors[ $field_name ] = $field['label'] . ' is required'; + continue; + } + + if ( 'email' === $field['type'] && ! empty( $field_value ) && ! \is_email( $field_value ) ) { + $errors[ $field_name ] = 'Please enter a valid email address'; + } + + if ( 'url' === $field['type'] && ! empty( $field_value ) && ! filter_var( $field_value, FILTER_VALIDATE_URL ) ) { + $errors[ $field_name ] = 'Please enter a valid URL'; + } + } + } + + return $errors; + } + + private function sanitize_submission( array $data ): array { + $sanitized = array(); + + foreach ( $data as $key => $value ) { + if ( is_array( $value ) ) { + $sanitized[ $key ] = array_map( '\sanitize_text_field', $value ); + } else { + $sanitized[ $key ] = \sanitize_text_field( $value ); + } + } + + return $sanitized; + } + + public function check_admin_permission(): bool { + return \current_user_can( 'manage_options' ); + } +} diff --git a/includes/Shortcode.php b/includes/Shortcode.php new file mode 100644 index 0000000..a50f67a --- /dev/null +++ b/includes/Shortcode.php @@ -0,0 +1,69 @@ + 0, + ), + $atts + ); + + $form_id = intval( $atts['id'] ); + + if ( ! $form_id ) { + return '

' . __( 'Please provide a valid form ID.', 'jpjuliao-multi-step-form-builder' ) . '

'; + } + + $post = \get_post( $form_id ); + if ( ! $post || 'msf_form' !== $post->post_type ) { + return '

' . __( 'Form not found.', 'jpjuliao-multi-step-form-builder' ) . '

'; + } + + return sprintf( + '
', + $form_id + ); + } + + public function render_button_shortcode( array $atts ): string { + $atts = \shortcode_atts( + array( + 'id' => 0, + 'label' => __( 'Open Form', 'jpjuliao-multi-step-form-builder' ), + ), + $atts + ); + + $form_id = intval( $atts['id'] ); + + if ( ! $form_id ) { + return '

' . __( 'Please provide a valid form ID.', 'jpjuliao-multi-step-form-builder' ) . '

'; + } + + $post = \get_post( $form_id ); + if ( ! $post || 'msf_form' !== $post->post_type ) { + return '

' . __( 'Form not found.', 'jpjuliao-multi-step-form-builder' ) . '

'; + } + + return sprintf( + '', + $form_id, + \esc_html( $atts['label'] ) + ); + } +} diff --git a/includes/class-admin.php b/includes/class-admin.php deleted file mode 100644 index 18dfb52..0000000 --- a/includes/class-admin.php +++ /dev/null @@ -1,106 +0,0 @@ -post_type === 'msf_form') { - \wp_enqueue_script( - 'msf-admin', - \plugin_dir_url(dirname(__FILE__)) . 'build/admin.js', - array('wp-element', 'wp-components', 'wp-i18n', 'wp-api-fetch', 'wp-data'), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/admin.js'), - true - ); - - \wp_enqueue_style( - 'msf-admin', - \plugin_dir_url(dirname(__FILE__)) . 'build/admin.css', - array('wp-components'), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/admin.css') - ); - - \wp_localize_script('msf-admin', 'msfAdmin', array( - 'formId' => $post->ID, - 'apiUrl' => \rest_url('msf/v1'), - 'nonce' => \wp_create_nonce('wp_rest'), - )); - } - } - - $page = \sanitize_key( - (string) \filter_input( - INPUT_GET, - 'page', - FILTER_SANITIZE_FULL_SPECIAL_CHARS - ) - ); - if ($page === 'msf-submissions') { - \wp_enqueue_script( - 'msf-admin', - \plugin_dir_url(dirname(__FILE__)) . 'build/admin.js', - array('wp-element', 'wp-components', 'wp-i18n', 'wp-api-fetch', 'wp-data'), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/admin.js'), - true - ); - - \wp_enqueue_style( - 'msf-admin', - \plugin_dir_url(dirname(__FILE__)) . 'build/admin.css', - array('wp-components'), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/admin.css') - ); - - $form_id = (int) \filter_input( - INPUT_GET, - 'form_id', - FILTER_SANITIZE_NUMBER_INT - ); - - \wp_localize_script('msf-admin', 'msfAdmin', array( - 'formId' => $form_id, - 'apiUrl' => \rest_url('msf/v1'), - 'nonce' => \wp_create_nonce('wp_rest'), - )); - } - } - - public function add_admin_menu(): void - { - \add_submenu_page( - 'edit.php?post_type=msf_form', - __('Submissions', 'jpjuliao-multi-step-form-builder'), - __('Submissions', 'jpjuliao-multi-step-form-builder'), - 'manage_options', - 'msf-submissions', - array($this, 'render_submissions_page') - ); - } - - public function render_submissions_page(): void - { -?> -
-

- -

-
-
-table_name = $wpdb->prefix . 'msf_submissions'; - } - - public function create_table(): void - { - global $wpdb; - - $charset_collate = $wpdb->get_charset_collate(); - - $sql = "CREATE TABLE IF NOT EXISTS {$this->table_name} ( - id bigint(20) NOT NULL AUTO_INCREMENT, - form_id bigint(20) NOT NULL, - user_id bigint(20) DEFAULT NULL, - submission_data longtext NOT NULL, - ip_address varchar(100) DEFAULT NULL, - user_agent varchar(255) DEFAULT NULL, - created_at datetime DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (id), - KEY form_id (form_id), - KEY user_id (user_id), - KEY created_at (created_at) - ) $charset_collate;"; - - require_once(\ABSPATH . 'wp-admin/includes/upgrade.php'); - \dbDelta($sql); - } - - public function save_submission(int $form_id, array $data): int|false - { - global $wpdb; - - $user_id = \get_current_user_id(); - $ip_address = $this->get_client_ip(); - $user_agent = isset($_SERVER['HTTP_USER_AGENT']) - ? \sanitize_text_field(\wp_unslash((string) $_SERVER['HTTP_USER_AGENT'])) - : ''; - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Using $wpdb->insert for custom plugin table writes. - $result = $wpdb->insert( - $this->table_name, - array( - 'form_id' => $form_id, - 'user_id' => $user_id ?: null, - 'submission_data' => \wp_json_encode($data), - 'ip_address' => $ip_address, - 'user_agent' => $user_agent, - ), - array('%d', '%d', '%s', '%s', '%s') - ); - - return $result !== false ? $wpdb->insert_id : false; - } - - public function get_submissions(int $form_id, int $limit = 50, int $offset = 0): array - { - global $wpdb; - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching - $results = $wpdb->get_results( - $wpdb->prepare( - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is trusted (constructed from $wpdb->prefix + constant); only dynamic values are parameterized via $wpdb->prepare(). - "SELECT * FROM {$this->table_name} WHERE form_id = %d ORDER BY created_at DESC LIMIT %d OFFSET %d", - $form_id, - $limit, - $offset - ) - ); - - foreach ($results as &$result) { - $result->submission_data = json_decode($result->submission_data, true); - } - - return $results; - } - - public function get_submission_count(int $form_id): int - { - global $wpdb; - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching - return (int) $wpdb->get_var( - $wpdb->prepare( - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is trusted (constructed from $wpdb->prefix + constant); only dynamic values are parameterized via $wpdb->prepare(). - "SELECT COUNT(*) FROM {$this->table_name} WHERE form_id = %d", - $form_id - ) - ); - } - - public function delete_submission(int $id): bool - { - global $wpdb; - - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Using $wpdb->delete for custom plugin table deletions; no caching layer is required here. - return $wpdb->delete( - $this->table_name, - array('id' => $id), - array('%d') - ); - } - - private function get_client_ip(): string - { - $ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); - - foreach ($ip_keys as $key) { - if (array_key_exists($key, $_SERVER) === true) { - $server_value = \sanitize_text_field(\wp_unslash((string) $_SERVER[$key])); - foreach (explode(',', $server_value) as $ip) { - $ip = trim($ip); - if (filter_var($ip, FILTER_VALIDATE_IP) !== false) { - return $ip; - } - } - } - } - - return ''; - } -} diff --git a/includes/class-frontend.php b/includes/class-frontend.php deleted file mode 100644 index a3a5709..0000000 --- a/includes/class-frontend.php +++ /dev/null @@ -1,91 +0,0 @@ -post_content, 'multi_step_form')) { - $should_enqueue = true; - } - - if (!$should_enqueue) { - $modal_forms = $this->get_modal_forms(); - if (!empty($modal_forms)) { - $should_enqueue = true; - } - } - - if ($should_enqueue) { - \wp_enqueue_script( - 'msf-frontend', - \plugin_dir_url(dirname(__FILE__)) . 'build/frontend.js', - array('wp-element', 'wp-i18n', 'wp-api-fetch'), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/frontend.js'), - true - ); - - \wp_enqueue_style( - 'msf-frontend', - \plugin_dir_url(dirname(__FILE__)) . 'build/frontend.css', - array(), - \filemtime(\plugin_dir_path(dirname(__FILE__)) . 'build/frontend.css') - ); - - $modal_forms = $this->get_modal_forms(); - - \wp_localize_script('msf-frontend', 'msfFrontend', array( - 'apiUrl' => \rest_url('msf/v1'), - 'nonce' => \wp_create_nonce('wp_rest'), - 'restUrl' => \rest_url(), - 'modalForms' => $modal_forms, - )); - } - } - - private function get_modal_forms(): array - { - $args = array( - 'post_type' => 'msf_form', - 'post_status' => 'publish', - 'posts_per_page' => -1, - 'fields' => 'ids', - ); - - $form_ids = \get_posts($args); - $modal_forms = array(); - - foreach ($form_ids as $form_id) { - $config = \get_post_meta($form_id, '_msf_form_config', true); - if ($config) { - $config = json_decode($config, true); - $settings = isset($config['settings']) ? $config['settings'] : array(); - - if (isset($settings['showModalOnLoad']) && $settings['showModalOnLoad']) { - $modal_forms[] = array( - 'id' => $form_id, - 'delay' => isset($settings['modalDelay']) ? intval($settings['modalDelay']) : 0, - ); - } - } - } - - return $modal_forms; - } -} diff --git a/includes/class-plugin.php b/includes/class-plugin.php deleted file mode 100644 index 915f6ea..0000000 --- a/includes/class-plugin.php +++ /dev/null @@ -1,64 +0,0 @@ -load_dependencies(); - $this->init_components(); - - \register_activation_hook(dirname(__DIR__) . '/multi-step-form-builder.php', array($this, 'activate')); - \register_deactivation_hook(dirname(__DIR__) . '/multi-step-form-builder.php', array($this, 'deactivate')); - } - - private function load_dependencies(): void - { - require_once \plugin_dir_path(__FILE__) . 'class-database.php'; - require_once \plugin_dir_path(__FILE__) . 'class-post-type.php'; - require_once \plugin_dir_path(__FILE__) . 'class-admin.php'; - require_once \plugin_dir_path(__FILE__) . 'class-frontend.php'; - require_once \plugin_dir_path(__FILE__) . 'class-shortcode.php'; - require_once \plugin_dir_path(__FILE__) . 'class-rest-api.php'; - } - - private function init_components(): void - { - $this->database = new Database(); - $this->post_type = new Post_Type(); - $this->admin = new Admin(); - $this->frontend = new Frontend(); - $this->shortcode = new Shortcode(); - $this->rest_api = new REST_API($this->database); - } - - public function activate(): void - { - $this->database->create_table(); - \flush_rewrite_rules(); - } - - public function deactivate(): void - { - \flush_rewrite_rules(); - } -} diff --git a/includes/class-post-type.php b/includes/class-post-type.php deleted file mode 100644 index 4203ded..0000000 --- a/includes/class-post-type.php +++ /dev/null @@ -1,110 +0,0 @@ - __('Forms', 'jpjuliao-multi-step-form-builder'), - 'singular_name' => __('Form', 'jpjuliao-multi-step-form-builder'), - 'menu_name' => __('Forms', 'jpjuliao-multi-step-form-builder'), - 'add_new' => __('Add New', 'jpjuliao-multi-step-form-builder'), - 'add_new_item' => __('Add New Form', 'jpjuliao-multi-step-form-builder'), - 'edit_item' => __('Edit Form', 'jpjuliao-multi-step-form-builder'), - 'new_item' => __('New Form', 'jpjuliao-multi-step-form-builder'), - 'view_item' => __('View Form', 'jpjuliao-multi-step-form-builder'), - 'search_items' => __('Search Forms', 'jpjuliao-multi-step-form-builder'), - 'not_found' => __('No forms found', 'jpjuliao-multi-step-form-builder'), - 'not_found_in_trash' => __('No forms found in trash', 'jpjuliao-multi-step-form-builder'), - ); - - $args = array( - 'labels' => $labels, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => true, - 'show_in_rest' => true, - 'menu_icon' => 'dashicons-list-view', - 'capability_type' => 'post', - 'hierarchical' => false, - 'supports' => array('title'), - 'has_archive' => false, - 'rewrite' => false, - 'query_var' => false, - ); - - \register_post_type('msf_form', $args); - } - - public function add_meta_boxes(): void - { - \add_meta_box( - 'msf_form_builder', - __('Form Builder', 'jpjuliao-multi-step-form-builder'), - array($this, 'render_form_builder'), - 'msf_form', - 'normal', - 'high' - ); - - \add_meta_box( - 'msf_form_shortcode', - __('Shortcode', 'jpjuliao-multi-step-form-builder'), - array($this, 'render_shortcode_box'), - 'msf_form', - 'side', - 'default' - ); - } - - public function render_form_builder(\WP_Post $post): void - { - \wp_nonce_field('msf_save_form', 'msf_form_nonce'); - echo '
'; - } - - public function render_shortcode_box(\WP_Post $post): void - { - if ($post->ID) { - echo '

' . esc_html__('Use this shortcode to display the form:', 'jpjuliao-multi-step-form-builder') . '

'; - echo '[multi_step_form id="' . esc_attr($post->ID) . '"]'; - echo '

'; - } else { - echo '

' . esc_html__('Save the form to get the shortcode.', 'jpjuliao-multi-step-form-builder') . '

'; - } - } - - public function save_form_meta(int $post_id, \WP_Post $post): void - { - $nonce = isset($_POST['msf_form_nonce']) - ? sanitize_text_field(\wp_unslash($_POST['msf_form_nonce'])) - : ''; - - if (!$nonce || !\wp_verify_nonce($nonce, 'msf_save_form')) { - return; - } - - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { - return; - } - - if (!\current_user_can('edit_post', $post_id)) { - return; - } - } -} diff --git a/includes/class-rest-api.php b/includes/class-rest-api.php deleted file mode 100644 index d7620d2..0000000 --- a/includes/class-rest-api.php +++ /dev/null @@ -1,223 +0,0 @@ -database = $database; - \add_action('rest_api_init', array($this, 'register_routes')); - } - - public function register_routes(): void - { - - \register_rest_route('msf/v1', '/forms/(?P\d+)/submit', array( - 'methods' => 'POST', - 'callback' => array($this, 'submit_form'), - 'permission_callback' => '__return_true', - )); - - \register_rest_route('msf/v1', '/forms/(?P\d+)/submissions', array( - 'methods' => 'GET', - 'callback' => array($this, 'get_submissions'), - 'permission_callback' => array($this, 'check_admin_permission'), - )); - - \register_rest_route('msf/v1', '/forms/(?P\d+)', array( - 'methods' => 'GET', - 'callback' => array($this, 'get_form'), - 'permission_callback' => '__return_true', - )); - - \register_rest_route('msf/v1', '/forms/(?P\d+)', array( - 'methods' => 'POST', - 'callback' => array($this, 'save_form'), - 'permission_callback' => array($this, 'check_admin_permission'), - )); - - \register_rest_route('msf/v1', '/submissions/(?P\d+)', array( - 'methods' => 'DELETE', - 'callback' => array($this, 'delete_submission'), - 'permission_callback' => array($this, 'check_admin_permission'), - )); - } - - public function get_form(\WP_REST_Request $request): \WP_REST_Response - { - $form_id = $request->get_param('id'); - - $form_config = \get_post_meta($form_id, '_msf_form_config', true); - - if (is_string($form_config)) { - $form_config = json_decode($form_config, true); - } - - if (empty($form_config) || !is_array($form_config)) { - $form_config = array( - 'steps' => array(), - 'settings' => array( - 'submitButtonText' => 'Submit', - 'successMessage' => 'Thank you for your submission!', - 'nextButtonText' => 'Next', - 'previousButtonText' => 'Previous', - ) - ); - } - - return \rest_ensure_response($form_config); - } - - public function save_form(\WP_REST_Request $request): \WP_REST_Response - { - $form_id = $request->get_param('id'); - $form_config = json_encode($request->get_json_params()); - - \update_post_meta($form_id, '_msf_form_config', $form_config); - - return \rest_ensure_response(array( - 'success' => true, - 'message' => 'Form saved successfully' - )); - } - - public function submit_form(\WP_REST_Request $request): \WP_REST_Response|\WP_Error - { - $form_id = $request->get_param('id'); - $data = $request->get_json_params(); - - $post = \get_post($form_id); - if (!$post || $post->post_type !== 'msf_form') { - return new \WP_Error('invalid_form', 'Invalid form ID', array('status' => 404)); - } - - $form_config = \get_post_meta($form_id, '_msf_form_config', true); - - if (is_string($form_config)) { - $form_config = json_decode($form_config, true); - } - - $errors = $this->validate_submission($data, $form_config); - if (!empty($errors)) { - return new \WP_Error('validation_failed', 'Validation failed', array( - 'status' => 400, - 'errors' => $errors - )); - } - - $sanitized_data = $this->sanitize_submission($data); - - $submission_id = $this->database->save_submission($form_id, $sanitized_data); - - if ($submission_id) { - $success_message = isset($form_config['settings']['successMessage']) - ? $form_config['settings']['successMessage'] - : 'Thank you for your submission!'; - - return \rest_ensure_response(array( - 'success' => true, - 'message' => $success_message, - 'submission_id' => $submission_id - )); - } else { - return new \WP_Error('submission_failed', 'Failed to save submission', array('status' => 500)); - } - } - - public function get_submissions(\WP_REST_Request $request): \WP_REST_Response - { - $form_id = $request->get_param('id'); - $page = $request->get_param('page') ?: 1; - $per_page = $request->get_param('per_page') ?: 50; - - $offset = ($page - 1) * $per_page; - - $submissions = $this->database->get_submissions($form_id, $per_page, $offset); - $total = $this->database->get_submission_count($form_id); - - return \rest_ensure_response(array( - 'submissions' => $submissions, - 'total' => $total, - 'page' => $page, - 'per_page' => $per_page, - 'total_pages' => ceil($total / $per_page) - )); - } - - public function delete_submission(\WP_REST_Request $request): \WP_REST_Response|\WP_Error - { - $submission_id = $request->get_param('id'); - - $result = $this->database->delete_submission($submission_id); - - if ($result) { - return \rest_ensure_response(array('success' => true)); - } else { - return new \WP_Error('delete_failed', 'Failed to delete submission', array('status' => 500)); - } - } - - private function validate_submission(array $data, array $form_config): array - { - $errors = array(); - - if (empty($form_config['steps'])) { - return $errors; - } - - foreach ($form_config['steps'] as $step) { - if (empty($step['fields'])) { - continue; - } - - foreach ($step['fields'] as $field) { - $field_name = $field['name']; - $field_value = isset($data[$field_name]) ? $data[$field_name] : ''; - - if (!empty($field['required']) && empty($field_value)) { - $errors[$field_name] = $field['label'] . ' is required'; - continue; - } - - if ($field['type'] === 'email' && !empty($field_value) && !\is_email($field_value)) { - $errors[$field_name] = 'Please enter a valid email address'; - } - - if ($field['type'] === 'url' && !empty($field_value) && !filter_var($field_value, FILTER_VALIDATE_URL)) { - $errors[$field_name] = 'Please enter a valid URL'; - } - } - } - - return $errors; - } - - private function sanitize_submission(array $data): array - { - $sanitized = array(); - - foreach ($data as $key => $value) { - if (is_array($value)) { - $sanitized[$key] = array_map('\sanitize_text_field', $value); - } else { - $sanitized[$key] = \sanitize_text_field($value); - } - } - - return $sanitized; - } - - public function check_admin_permission(): bool - { - return \current_user_can('manage_options'); - } -} diff --git a/includes/class-shortcode.php b/includes/class-shortcode.php deleted file mode 100644 index b990dc1..0000000 --- a/includes/class-shortcode.php +++ /dev/null @@ -1,61 +0,0 @@ - 0, - ), $atts); - - $form_id = intval($atts['id']); - - if (!$form_id) { - return '

' . __('Please provide a valid form ID.', 'jpjuliao-multi-step-form-builder') . '

'; - } - - $post = \get_post($form_id); - if (!$post || $post->post_type !== 'msf_form') { - return '

' . __('Form not found.', 'jpjuliao-multi-step-form-builder') . '

'; - } - - return sprintf( - '
', - $form_id - ); - } - - public function render_button_shortcode(array $atts): string - { - $atts = \shortcode_atts(array( - 'id' => 0, - 'label' => __('Open Form', 'jpjuliao-multi-step-form-builder'), - ), $atts); - - $form_id = intval($atts['id']); - - if (!$form_id) { - return '

' . __('Please provide a valid form ID.', 'jpjuliao-multi-step-form-builder') . '

'; - } - - $post = \get_post($form_id); - if (!$post || $post->post_type !== 'msf_form') { - return '

' . __('Form not found.', 'jpjuliao-multi-step-form-builder') . '

'; - } - - return sprintf( - '', - $form_id, - \esc_html($atts['label']) - ); - } -} diff --git a/jpjuliao-multi-step-form-builder.php b/jpjuliao-multi-step-form-builder.php index 239bbb0..e53ba3a 100644 --- a/jpjuliao-multi-step-form-builder.php +++ b/jpjuliao-multi-step-form-builder.php @@ -11,17 +11,12 @@ * Tested up to: 6.9 */ -namespace JPJULIAO\Wordpress\MultiStepFormBuilder; +namespace JPJULIAO\WordPress\MultiStepFormBuilder; if (!defined('ABSPATH')) { exit; } -require_once plugin_dir_path(__FILE__) . 'includes/class-plugin.php'; +require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php'; -function init(): void -{ - Plugin::get_instance(); -} - -\add_action('plugins_loaded', __NAMESPACE__ . '\\init'); +\add_action('plugins_loaded', Plugin::get_instance(...)); diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..b42f623 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,27 @@ + + + PHP_CodeSniffer rules for Multi Step Form Builder plugin. + + + includes + + + + */vendor/* + */node_modules/* + + + + + + + + + + + + + + + +