From b4923b960176256d5a9ca3221f4f4830bf2a4601 Mon Sep 17 00:00:00 2001 From: Glauber Silva Date: Tue, 19 Mar 2024 12:27:52 -0300 Subject: [PATCH] Feature: add excerpt for v3 forms (#7287) --- package-lock.json | 129 +++++++----------- src/DonationForms/Properties/FormSettings.php | 10 ++ src/FormBuilder/Actions/UpdateFormExcerpt.php | 24 ++++ src/FormBuilder/ServiceProvider.php | 2 + .../ViewModels/FormBuilderViewModel.php | 2 + .../form-builder/src/common/getWindowData.ts | 4 +- .../group-general/form-summary/index.jsx | 28 +++- .../js/form-builder/src/types/formSettings.ts | 2 + src/FormMigration/ServiceProvider.php | 1 + src/FormMigration/Steps/FormExcerpt.php | 19 +++ .../ViewModels/FormBuilderViewModelTest.php | 3 + 11 files changed, 142 insertions(+), 82 deletions(-) create mode 100644 src/FormBuilder/Actions/UpdateFormExcerpt.php create mode 100644 src/FormMigration/Steps/FormExcerpt.php diff --git a/package-lock.json b/package-lock.json index f71e26fc9e..25df5ee29b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -624,7 +624,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.17.3.tgz", "integrity": "sha512-yuL5iQA/TbZn+RGAfxQXfi7CNLmKi1f8zInn4IgobuCWcAb7i+zj4TYzQ9l8cEzVyJ89PDGuqxK1xZpUDISesw==", "dev": true, - "peer": true, "dependencies": { "@babel/compat-data": "^7.17.0", "@babel/helper-compilation-targets": "^7.16.7", @@ -2542,14 +2541,12 @@ "node_modules/@givewp/form-builder-library/node_modules/@ariakit/core": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.3.8.tgz", - "integrity": "sha512-LlSCwbyyozMX4ZEobpYGcv1LFqOdBTdTYPZw3lAVgLcFSNivsazi3NkKM9qNWNIu00MS+xTa0+RuIcuWAjlB2Q==", - "peer": true + "integrity": "sha512-LlSCwbyyozMX4ZEobpYGcv1LFqOdBTdTYPZw3lAVgLcFSNivsazi3NkKM9qNWNIu00MS+xTa0+RuIcuWAjlB2Q==" }, "node_modules/@givewp/form-builder-library/node_modules/@ariakit/react": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.3.9.tgz", "integrity": "sha512-gC+gibh2go8wvBqzYXavlHKwAfmee5GUMrPSQ9WBBLIfm9nQElujxcHJydaRx+ULR5FbOnbZVC3vU2ic8hSrNw==", - "peer": true, "dependencies": { "@ariakit/react-core": "0.3.9" }, @@ -2566,7 +2563,6 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.3.9.tgz", "integrity": "sha512-K1Rcxr6FpF0n3L7Uvo+e5hm+zqoZmXLRcYF/skI+/j+ole+uNbnsnfGhG1avqJlklqH4bmkFkjZzmMdOnUC0Ig==", - "peer": true, "dependencies": { "@ariakit/core": "0.3.8", "@floating-ui/dom": "^1.0.0", @@ -2581,7 +2577,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.4.tgz", "integrity": "sha512-CF8k2rgKeh/49UrnIBs4BdxPUV6vize/Db1d/YbCLyp9GiVZ0BEwf5AiDSxJRCr6yOkGqTFHtmrULxkEfYZ7dQ==", - "peer": true, "dependencies": { "@floating-ui/dom": "^1.5.1" }, @@ -2594,7 +2589,6 @@ "version": "25.13.0", "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.13.0.tgz", "integrity": "sha512-Ym/5Xv7NnkJu40jCSmt/t6B8vT2ue2vobwDEz1FKlB0xGm5bzzh5589m2nZqqY459/Qm9dl5R4BKSdvKqKB2MQ==", - "peer": true, "dependencies": { "@ariakit/react": "^0.3.5", "@babel/runtime": "^7.16.0", @@ -2660,7 +2654,6 @@ "version": "6.24.0", "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", - "peer": true, "dependencies": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", @@ -2687,7 +2680,6 @@ "version": "0.29.0", "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", - "peer": true, "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -2698,26 +2690,22 @@ "node_modules/@givewp/form-builder-library/node_modules/memize": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz", - "integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==", - "peer": true + "integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==" }, "node_modules/@givewp/form-builder-library/node_modules/path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", - "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", - "peer": true + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" }, "node_modules/@givewp/form-builder-library/node_modules/remove-accents": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz", - "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==", - "peer": true + "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==" }, "node_modules/@givewp/form-builder-library/node_modules/valtio": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.7.0.tgz", "integrity": "sha512-3Tnix66EERwMcrl1rfB3ylcewOcL5L/GiPmC3FlVNreQzqf2jufEeqlNmgnLgSGchkEmH3WYVtS+x6Qw4r+yzQ==", - "peer": true, "dependencies": { "proxy-compare": "2.3.0", "use-sync-external-store": "1.2.0" @@ -6523,14 +6511,12 @@ "node_modules/@types/gradient-parser": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@types/gradient-parser/-/gradient-parser-0.1.3.tgz", - "integrity": "sha512-XDbrTSBlQV9nxE1GiDL3FaOPy4G/KaJkhDutBX48Kg8CYZMBARyyDFGCWfWJn4pobmInmwud1xxH7VJMAr0CKQ==", - "peer": true + "integrity": "sha512-XDbrTSBlQV9nxE1GiDL3FaOPy4G/KaJkhDutBX48Kg8CYZMBARyyDFGCWfWJn4pobmInmwud1xxH7VJMAr0CKQ==" }, "node_modules/@types/highlight-words-core": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/highlight-words-core/-/highlight-words-core-1.2.1.tgz", - "integrity": "sha512-9VZUA5omXBfn+hDxFjUDu1FOJTBM3LmvqfDey+Z6Aa8B8/JmF5SMj6FBrjfgJ/Q3YXOZd3qyTDfJyMZSs/wCUA==", - "peer": true + "integrity": "sha512-9VZUA5omXBfn+hDxFjUDu1FOJTBM3LmvqfDey+Z6Aa8B8/JmF5SMj6FBrjfgJ/Q3YXOZd3qyTDfJyMZSs/wCUA==" }, "node_modules/@types/hoist-non-react-statics": { "version": "3.3.1", @@ -12155,8 +12141,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -12172,9 +12156,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/ajv-keywords": { "version": "3.5.2", @@ -13102,8 +13084,7 @@ "node_modules/brcast": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/brcast/-/brcast-2.0.2.tgz", - "integrity": "sha512-Tfn5JSE7hrUlFcOoaLzVvkbgIemIorMIyoMr3TgvszWW7jFt2C9PdeMLtysYD9RU0MmU17b69+XJG1eRY2OBRg==", - "peer": true + "integrity": "sha512-Tfn5JSE7hrUlFcOoaLzVvkbgIemIorMIyoMr3TgvszWW7jFt2C9PdeMLtysYD9RU0MmU17b69+XJG1eRY2OBRg==" }, "node_modules/brorand": { "version": "1.1.0", @@ -15573,7 +15554,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/direction/-/direction-1.0.4.tgz", "integrity": "sha512-GYqKi1aH7PJXxdhTeZBFrg8vUBeKXi+cNprXsC1kpJcbcVnV9wBsrOu1cQEdG0WeQwlfHiy3XvnKfIrJ2R0NzQ==", - "peer": true, "bin": { "direction": "cli.js" }, @@ -27943,7 +27923,6 @@ "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -27957,7 +27936,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "peer": true, "dependencies": { "airbnb-prop-types": "^2.16.0", "brcast": "^2.0.2", @@ -28551,7 +28529,6 @@ "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -28565,7 +28542,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "peer": true, "dependencies": { "airbnb-prop-types": "^2.16.0", "brcast": "^2.0.2", @@ -33794,7 +33770,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.17.3.tgz", "integrity": "sha512-yuL5iQA/TbZn+RGAfxQXfi7CNLmKi1f8zInn4IgobuCWcAb7i+zj4TYzQ9l8cEzVyJ89PDGuqxK1xZpUDISesw==", "dev": true, - "peer": true, "requires": { "@babel/compat-data": "^7.17.0", "@babel/helper-compilation-targets": "^7.16.7", @@ -35114,19 +35089,23 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@givewp/form-builder-library/-/form-builder-library-1.2.1.tgz", "integrity": "sha512-7Yv3lt7C6mx+tZGON4ChdJrV43ApUu0sgsqJCX99YUxbeheRR0YSC8LEq6I2ojWHNZJz0/2Fa60xyQhY72vhIA==", - "requires": {}, + "requires": { + "@wordpress/components": "^25.10.0", + "@wordpress/compose": "^6.21.0", + "@wordpress/element": "^5.21.0", + "react-beautiful-dnd": "^13.1.1", + "react-currency-input-field": "^3.6.11" + }, "dependencies": { "@ariakit/core": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.3.8.tgz", - "integrity": "sha512-LlSCwbyyozMX4ZEobpYGcv1LFqOdBTdTYPZw3lAVgLcFSNivsazi3NkKM9qNWNIu00MS+xTa0+RuIcuWAjlB2Q==", - "peer": true + "integrity": "sha512-LlSCwbyyozMX4ZEobpYGcv1LFqOdBTdTYPZw3lAVgLcFSNivsazi3NkKM9qNWNIu00MS+xTa0+RuIcuWAjlB2Q==" }, "@ariakit/react": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.3.9.tgz", "integrity": "sha512-gC+gibh2go8wvBqzYXavlHKwAfmee5GUMrPSQ9WBBLIfm9nQElujxcHJydaRx+ULR5FbOnbZVC3vU2ic8hSrNw==", - "peer": true, "requires": { "@ariakit/react-core": "0.3.9" } @@ -35135,7 +35114,6 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.3.9.tgz", "integrity": "sha512-K1Rcxr6FpF0n3L7Uvo+e5hm+zqoZmXLRcYF/skI+/j+ole+uNbnsnfGhG1avqJlklqH4bmkFkjZzmMdOnUC0Ig==", - "peer": true, "requires": { "@ariakit/core": "0.3.8", "@floating-ui/dom": "^1.0.0", @@ -35146,15 +35124,14 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.4.tgz", "integrity": "sha512-CF8k2rgKeh/49UrnIBs4BdxPUV6vize/Db1d/YbCLyp9GiVZ0BEwf5AiDSxJRCr6yOkGqTFHtmrULxkEfYZ7dQ==", - "peer": true, "requires": { "@floating-ui/dom": "^1.5.1" } }, "@wordpress/components": { - "version": "https://registry.npmjs.org/@wordpress/components/-/components-25.13.0.tgz", + "version": "25.13.0", + "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.13.0.tgz", "integrity": "sha512-Ym/5Xv7NnkJu40jCSmt/t6B8vT2ue2vobwDEz1FKlB0xGm5bzzh5589m2nZqqY459/Qm9dl5R4BKSdvKqKB2MQ==", - "peer": true, "requires": { "@ariakit/react": "^0.3.5", "@babel/runtime": "^7.16.0", @@ -35213,7 +35190,6 @@ "version": "6.24.0", "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", - "peer": true, "requires": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", @@ -35234,7 +35210,6 @@ "version": "0.29.0", "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", - "peer": true, "requires": { "@babel/runtime": "^7.16.0" } @@ -35242,26 +35217,22 @@ "memize": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz", - "integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==", - "peer": true + "integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==" }, "path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", - "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", - "peer": true + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" }, "remove-accents": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz", - "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==", - "peer": true + "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==" }, "valtio": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.7.0.tgz", "integrity": "sha512-3Tnix66EERwMcrl1rfB3ylcewOcL5L/GiPmC3FlVNreQzqf2jufEeqlNmgnLgSGchkEmH3WYVtS+x6Qw4r+yzQ==", - "peer": true, "requires": { "proxy-compare": "2.3.0", "use-sync-external-store": "1.2.0" @@ -38173,14 +38144,12 @@ "@types/gradient-parser": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@types/gradient-parser/-/gradient-parser-0.1.3.tgz", - "integrity": "sha512-XDbrTSBlQV9nxE1GiDL3FaOPy4G/KaJkhDutBX48Kg8CYZMBARyyDFGCWfWJn4pobmInmwud1xxH7VJMAr0CKQ==", - "peer": true + "integrity": "sha512-XDbrTSBlQV9nxE1GiDL3FaOPy4G/KaJkhDutBX48Kg8CYZMBARyyDFGCWfWJn4pobmInmwud1xxH7VJMAr0CKQ==" }, "@types/highlight-words-core": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/highlight-words-core/-/highlight-words-core-1.2.1.tgz", - "integrity": "sha512-9VZUA5omXBfn+hDxFjUDu1FOJTBM3LmvqfDey+Z6Aa8B8/JmF5SMj6FBrjfgJ/Q3YXOZd3qyTDfJyMZSs/wCUA==", - "peer": true + "integrity": "sha512-9VZUA5omXBfn+hDxFjUDu1FOJTBM3LmvqfDey+Z6Aa8B8/JmF5SMj6FBrjfgJ/Q3YXOZd3qyTDfJyMZSs/wCUA==" }, "@types/hoist-non-react-statics": { "version": "3.3.1", @@ -42421,14 +42390,15 @@ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, - "requires": {}, + "requires": { + "ajv": "^8.0.0" + }, "dependencies": { "ajv": { - "version": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", "dev": true, - "optional": true, - "peer": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -42440,9 +42410,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "optional": true, - "peer": true + "dev": true } } }, @@ -43159,8 +43127,7 @@ "brcast": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/brcast/-/brcast-2.0.2.tgz", - "integrity": "sha512-Tfn5JSE7hrUlFcOoaLzVvkbgIemIorMIyoMr3TgvszWW7jFt2C9PdeMLtysYD9RU0MmU17b69+XJG1eRY2OBRg==", - "peer": true + "integrity": "sha512-Tfn5JSE7hrUlFcOoaLzVvkbgIemIorMIyoMr3TgvszWW7jFt2C9PdeMLtysYD9RU0MmU17b69+XJG1eRY2OBRg==" }, "brorand": { "version": "1.1.0", @@ -43521,7 +43488,9 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/chartjs-plugin-crosshair/-/chartjs-plugin-crosshair-1.1.6.tgz", "integrity": "sha512-faqHKnZzhNYh2ahIKaxTWB9ZX5afRJkQ+7jsZ8u0Z+PE4YPcs1jNCCKwWINWacYaryh6ih/OT6pLmMnkNMusHQ==", - "requires": {} + "requires": { + "chart.js": "^2.9.3" + } }, "check-node-version": { "version": "4.2.1", @@ -45056,8 +45025,7 @@ "direction": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/direction/-/direction-1.0.4.tgz", - "integrity": "sha512-GYqKi1aH7PJXxdhTeZBFrg8vUBeKXi+cNprXsC1kpJcbcVnV9wBsrOu1cQEdG0WeQwlfHiy3XvnKfIrJ2R0NzQ==", - "peer": true + "integrity": "sha512-GYqKi1aH7PJXxdhTeZBFrg8vUBeKXi+cNprXsC1kpJcbcVnV9wBsrOu1cQEdG0WeQwlfHiy3XvnKfIrJ2R0NzQ==" }, "dns-equal": { "version": "1.0.0", @@ -49760,6 +49728,11 @@ "integrity": "sha512-SOO+C1aOpVSAUs30DYc6k/e0QJxfyD42aav4IKJtE5UZKw9ROWcVzkVoek2J475jNeNnl7GkoLAC27gejZsQ8g==", "dev": true, "requires": { + "@babel/core": "^7.15.8", + "@babel/plugin-proposal-object-rest-spread": "^7.15.6", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.15.8", + "@babel/preset-env": "^7.15.8", "@babel/runtime": "^7.15.4", "@types/babel__core": "^7.1.16", "@types/clean-css": "^4.2.5", @@ -49798,6 +49771,8 @@ "terser": "^5.9.0", "terser-webpack-plugin": "^5.2.4", "vue-style-loader": "^4.1.3", + "webpack": "^5.60.0", + "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.7.3", "webpack-merge": "^5.8.0", "webpack-notifier": "^1.14.1", @@ -54237,6 +54212,7 @@ "react-moment-proptypes": "^1.6.0", "react-outside-click-handler": "^1.2.4", "react-portal": "^4.2.0", + "react-with-direction": "^1.3.1", "react-with-styles": "^4.1.0", "react-with-styles-interface-css": "^6.0.0" }, @@ -54260,8 +54236,7 @@ "deepmerge": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "peer": true + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" }, "react-is": { "version": "16.13.1", @@ -54269,9 +54244,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "react-with-direction": { - "version": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "peer": true, "requires": { "airbnb-prop-types": "^2.16.0", "brcast": "^2.0.2", @@ -54366,7 +54341,9 @@ "version": "1.8.1", "resolved": "https://registry.npmjs.org/react-moment-proptypes/-/react-moment-proptypes-1.8.1.tgz", "integrity": "sha512-Er940DxWoObfIqPrZNfwXKugjxMIuk1LAuEzn23gytzV6hKS/sw108wibi9QubfMN4h+nrlje8eUCSbQRJo2fQ==", - "requires": {} + "requires": { + "moment": ">=1.6.0" + } }, "react-onclickoutside": { "version": "6.13.0", @@ -54654,7 +54631,8 @@ "airbnb-prop-types": "^2.14.0", "hoist-non-react-statics": "^3.2.1", "object.assign": "^4.1.0", - "prop-types": "^15.7.2" + "prop-types": "^15.7.2", + "react-with-direction": "^1.3.1" }, "dependencies": { "airbnb-prop-types": { @@ -54676,8 +54654,7 @@ "deepmerge": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "peer": true + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" }, "react-is": { "version": "16.13.1", @@ -54685,9 +54662,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "react-with-direction": { - "version": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "peer": true, "requires": { "airbnb-prop-types": "^2.16.0", "brcast": "^2.0.2", diff --git a/src/DonationForms/Properties/FormSettings.php b/src/DonationForms/Properties/FormSettings.php index 721da4c4dc..fe7533dc5f 100644 --- a/src/DonationForms/Properties/FormSettings.php +++ b/src/DonationForms/Properties/FormSettings.php @@ -230,6 +230,14 @@ class FormSettings implements Arrayable, Jsonable */ public $designSettingsImageOpacity; + /* @unreleased + * @var string + */ + public $formExcerpt; + + /** + * @unreleased Added formExcerpt + /** * @since 3.2.0 Added registrationNotification * @since 3.0.0 @@ -327,6 +335,8 @@ public static function fromArray(array $array): self $self->designSettingsImageOpacity = $array['designSettingsImageOpacity'] ?? ''; + $self->formExcerpt = $array['formExcerpt'] ?? ''; + return $self; } diff --git a/src/FormBuilder/Actions/UpdateFormExcerpt.php b/src/FormBuilder/Actions/UpdateFormExcerpt.php new file mode 100644 index 0000000000..1325f4dbc3 --- /dev/null +++ b/src/FormBuilder/Actions/UpdateFormExcerpt.php @@ -0,0 +1,24 @@ + $form->id, + 'post_excerpt' => $form->settings->formExcerpt, + ]); + } +} diff --git a/src/FormBuilder/ServiceProvider.php b/src/FormBuilder/ServiceProvider.php index 45e8b7c339..fe7916c56b 100644 --- a/src/FormBuilder/ServiceProvider.php +++ b/src/FormBuilder/ServiceProvider.php @@ -9,6 +9,7 @@ use Give\FormBuilder\Actions\UpdateDonorCommentsMeta; use Give\FormBuilder\Actions\UpdateEmailSettingsMeta; use Give\FormBuilder\Actions\UpdateEmailTemplateMeta; +use Give\FormBuilder\Actions\UpdateFormExcerpt; use Give\FormBuilder\Actions\UpdateFormGridMeta; use Give\FormBuilder\EmailPreview\Routes\RegisterEmailPreviewRoutes; use Give\FormBuilder\Routes\CreateFormRoute; @@ -62,6 +63,7 @@ public function boot() give(UpdateEmailSettingsMeta::class)->__invoke($form); give(UpdateEmailTemplateMeta::class)->__invoke($form); give(UpdateDonorCommentsMeta::class)->__invoke($form); + give(UpdateFormExcerpt::class)->__invoke($form); }); Hooks::addAction('givewp_form_builder_new_form', ConvertGlobalDefaultOptionsToDefaultBlocks::class); diff --git a/src/FormBuilder/ViewModels/FormBuilderViewModel.php b/src/FormBuilder/ViewModels/FormBuilderViewModel.php index 4fef5ea514..82556b916c 100644 --- a/src/FormBuilder/ViewModels/FormBuilderViewModel.php +++ b/src/FormBuilder/ViewModels/FormBuilderViewModel.php @@ -20,6 +20,7 @@ class FormBuilderViewModel { /** + * @unreleased Add support to isExcerptEnabled key in the compared array * @since 3.2.0 Add nameTitlePrefixes key to the returned array * @since 3.0.0 */ @@ -76,6 +77,7 @@ public function storageData(int $donationFormId): array ], 'goalTypeOptions' => $this->getGoalTypeOptions(), 'nameTitlePrefixes' => give_get_option('title_prefixes'), + 'isExcerptEnabled' => give_is_setting_enabled(give_get_option('forms_excerpt')), ]; } diff --git a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts index c4719c074c..ebee54cdcd 100644 --- a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts +++ b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts @@ -18,6 +18,7 @@ type GoalTypeOption = { }; /** + * @unreleased Added isExcerptEnabled * @since 3.0.0 */ interface FormBuilderWindowData { @@ -48,6 +49,7 @@ interface FormBuilderWindowData { termsAndConditions: TermsAndConditions; goalTypeOptions: GoalTypeOption[]; nameTitlePrefixes: string[]; + isExcerptEnabled: boolean; } /** @@ -62,7 +64,7 @@ declare const window: { [key: string]: Component; }; }; - } + }; } & Window; /** diff --git a/src/FormBuilder/resources/js/form-builder/src/settings/group-general/form-summary/index.jsx b/src/FormBuilder/resources/js/form-builder/src/settings/group-general/form-summary/index.jsx index 49f82c036c..1d5c99e9bf 100644 --- a/src/FormBuilder/resources/js/form-builder/src/settings/group-general/form-summary/index.jsx +++ b/src/FormBuilder/resources/js/form-builder/src/settings/group-general/form-summary/index.jsx @@ -1,14 +1,18 @@ -import { PanelRow, SelectControl, TextControl } from "@wordpress/components"; -import { __ } from "@wordpress/i18n"; +import {PanelRow, SelectControl, TextareaControl, TextControl} from '@wordpress/components'; +import {__} from '@wordpress/i18n'; -import { isFormPageEnabled, PageSlugControl } from "./page-slug"; -import { cleanForSlug } from "@wordpress/url"; +import {isFormPageEnabled, PageSlugControl} from './page-slug'; +import {cleanForSlug} from '@wordpress/url'; +import {getWindowData} from '@givewp/form-builder/common'; + +const {isExcerptEnabled} = getWindowData(); /** + * @unreleased Added formExcerpt text area * @since 3.1.0 dispatch page slug from form title on initial publish. */ const FormSummarySettings = ({settings, setSettings}) => { - const {formTitle, pageSlug, formStatus, newFormStatus} = settings; + const {formTitle, pageSlug, formStatus, newFormStatus, formExcerpt} = settings; const isPublished = ['publish', 'private'].includes(formStatus); const isTitleSlug = !isPublished && cleanForSlug(formTitle) === pageSlug; @@ -51,6 +55,20 @@ const FormSummarySettings = ({settings, setSettings}) => { onChange={(newFormStatus) => setSettings({newFormStatus})} /> + + {isExcerptEnabled && ( + + setSettings({formExcerpt})} + /> + + )} ); }; diff --git a/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts b/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts index 299cbcde7d..ddfd60c518 100644 --- a/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts +++ b/src/FormBuilder/resources/js/form-builder/src/types/formSettings.ts @@ -2,6 +2,7 @@ import {FormStatus} from '@givewp/form-builder/types/formStatus'; import {EmailTemplateOption} from '@givewp/form-builder/types/emailTemplateOption'; /** + * @unreleased Added formExcerpt * @since 3.0.0 */ export type FormSettings = { @@ -50,4 +51,5 @@ export type FormSettings = { designSettingsTextFieldStyle: string; designSettingsImageOpacity: string; designSettingsImageColor: string; + formExcerpt: string; }; diff --git a/src/FormMigration/ServiceProvider.php b/src/FormMigration/ServiceProvider.php index 82965aac01..4911aa0f20 100644 --- a/src/FormMigration/ServiceProvider.php +++ b/src/FormMigration/ServiceProvider.php @@ -50,6 +50,7 @@ public function register() Steps\FundsAndDesignations::class, Steps\GiftAid::class, Steps\FormFeaturedImage::class, + Steps\FormExcerpt::class, ]); }); } diff --git a/src/FormMigration/Steps/FormExcerpt.php b/src/FormMigration/Steps/FormExcerpt.php new file mode 100644 index 0000000000..c5766e096d --- /dev/null +++ b/src/FormMigration/Steps/FormExcerpt.php @@ -0,0 +1,19 @@ +formV3->settings->formExcerpt = get_the_excerpt($this->formV2->id); + } +} diff --git a/tests/Unit/ViewModels/FormBuilderViewModelTest.php b/tests/Unit/ViewModels/FormBuilderViewModelTest.php index 3e0a2bd35d..080118d9e7 100644 --- a/tests/Unit/ViewModels/FormBuilderViewModelTest.php +++ b/tests/Unit/ViewModels/FormBuilderViewModelTest.php @@ -23,6 +23,8 @@ class FormBuilderViewModelTest extends TestCase use RefreshDatabase; /** + * + * @unreleased Add support to isExcerptEnabled key in the compared array * @since 3.2.0 Add support to nameTitlePrefixes key in the compared array * @since 3.0.0 * @@ -85,6 +87,7 @@ public function testShouldReturnStorageData() ], 'goalTypeOptions' => $viewModel->getGoalTypeOptions(), 'nameTitlePrefixes' => give_get_option('title_prefixes'), + 'isExcerptEnabled' => give_is_setting_enabled(give_get_option('forms_excerpt')), ], $viewModel->storageData($formId) );