From 4293f07af2bff412f1c94a36bd30544bc95c4558 Mon Sep 17 00:00:00 2001 From: Joshua Dinh <75056371+JoshuaHungDinh@users.noreply.github.com> Date: Tue, 14 May 2024 23:27:03 +0900 Subject: [PATCH] Epic: add donation amount level descriptions (#7364) Co-authored-by: Paulo Iankoski Co-authored-by: Jon Waldstein --- package-lock.json | 688 +++++++++--------- package.json | 2 +- .../ConvertDonationAmountBlockToFieldsApi.php | 59 +- .../StoreBackwardsCompatibleFormMeta.php | 4 +- .../Migrations/UpdateDonationLevelsSchema.php | 80 ++ src/DonationForms/ServiceProvider.php | 4 +- src/DonationForms/resources/propTypes.ts | 2 +- .../fields/Amount/DonationAmountLevels.tsx | 72 +- .../getAmountLevelsWithCurrencySettings.tsx | 21 - .../templates/fields/Amount/index.tsx | 21 +- .../fields/Amount/withCurrencySettings.tsx | 42 ++ .../resources/styles/components/_amount.scss | 44 +- ...rateDefaultDonationFormBlockCollection.php | 13 +- .../BlockModels/DonationAmountBlockModel.php | 21 +- .../BlockTypes/DonationAmountBlockType.php | 11 +- .../resources/js/form-builder/src/blocks.json | 26 +- .../src/blocks/fields/amount/Edit.tsx | 41 +- .../inspector/donation-type-control.tsx | 39 + .../blocks/fields/amount/inspector/index.tsx | 95 ++- .../blocks/fields/amount/level-buttons.tsx | 3 +- .../src/blocks/fields/amount/level-grid.tsx | 10 +- .../src/blocks/fields/amount/settings.tsx | 5 - .../src/blocks/fields/amount/types.ts | 11 +- .../js/form-builder/src/styles/_blocks.scss | 24 + src/FormMigration/Steps/DonationOptions.php | 17 +- src/Framework/FieldsAPI/Amount.php | 7 +- .../Steps/TestDonationOptions.php | 25 +- ...DefaultDonationFormBlockCollectionTest.php | 15 +- .../DonateFormRouteDataTest.php | 13 +- .../ValidationRouteDataTest.php | 12 +- .../StoreBackwardsCompatibleFormMetaTest.php | 18 +- .../UpdateDonationLevelsSchemaTest.php | 46 ++ .../TestDonationAmountBlockType.php | 14 +- 33 files changed, 968 insertions(+), 537 deletions(-) create mode 100644 src/DonationForms/Migrations/UpdateDonationLevelsSchema.php delete mode 100644 src/DonationForms/resources/registrars/templates/fields/Amount/getAmountLevelsWithCurrencySettings.tsx create mode 100644 src/DonationForms/resources/registrars/templates/fields/Amount/withCurrencySettings.tsx create mode 100644 src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/donation-type-control.tsx create mode 100644 tests/Unit/DonationForms/Migrations/UpdateDonationLevelsSchemaTest.php diff --git a/package-lock.json b/package-lock.json index 2595b877a2..82ec065d65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.12", "@givewp/design-system-foundation": "^1.1.0", - "@givewp/form-builder-library": "^1.2.1", + "@givewp/form-builder-library": "^1.6.0", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^2.9.10", "@paypal/paypal-js": "^5.1.4", @@ -2549,9 +2549,9 @@ "integrity": "sha512-SOAS98QQOytIGsyDX55y4TCS0DeKijjmOPnNaG0YbClTL2u7HFNthqRHk246BXZ0s6U+CUzqZQ8mf/+3NY4Z1g==" }, "node_modules/@givewp/form-builder-library": { - "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==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@givewp/form-builder-library/-/form-builder-library-1.6.0.tgz", + "integrity": "sha512-I/ZLIFHbWSZU+PR3urCyvFR/kiSV0YZI2rBqjBT8/sYbEzh/IXNTbGdp5/1hvzpsGzVN/aThGDut71JxW0oKvA==", "dependencies": { "@wordpress/components": "^25.10.0", "@wordpress/compose": "^6.21.0", @@ -2568,16 +2568,16 @@ } }, "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==" + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.3.11.tgz", + "integrity": "sha512-+MnOeqnA4FLI/7vqsZLbZQHHN4ofd9kvkNjz44fNi0gqmD+ZbMWiDkFAvZII75dYnxYw5ZPpWjA4waK22VBWig==" }, "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==", + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.3.14.tgz", + "integrity": "sha512-h71BPMZ2eW+E2ESbdYxSAEMR1DozYzd5eHE5IOzGd9Egi5u7EZxqmuW4CXVXZ1Y6vbaDMV3SudgPh7iHS/ArFw==", "dependencies": { - "@ariakit/react-core": "0.3.9" + "@ariakit/react-core": "0.3.14" }, "funding": { "type": "opencollective", @@ -2589,11 +2589,11 @@ } }, "node_modules/@givewp/form-builder-library/node_modules/@ariakit/react-core": { - "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==", + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.3.14.tgz", + "integrity": "sha512-16Qj6kDPglpdWtU5roY9q+G66naOjauTY5HvUIaL2aLY0187ATaRrABIKoMMzTtJyhvsud4jFlzivz+/zCQ8yw==", "dependencies": { - "@ariakit/core": "0.3.8", + "@ariakit/core": "0.3.11", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" }, @@ -2603,11 +2603,11 @@ } }, "node_modules/@givewp/form-builder-library/node_modules/@floating-ui/react-dom": { - "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==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.9.tgz", + "integrity": "sha512-q0umO0+LQK4+p6aGyvzASqKbKOJcAHJ7ycE9CuUvfx3s9zTHWmGJTPOIlM/hmSBfUfg/XfY5YhLBLR/LHwShQQ==", "dependencies": { - "@floating-ui/dom": "^1.5.1" + "@floating-ui/dom": "^1.0.0" }, "peerDependencies": { "react": ">=16.8.0", @@ -2615,11 +2615,11 @@ } }, "node_modules/@givewp/form-builder-library/node_modules/@wordpress/components": { - "version": "25.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.13.0.tgz", - "integrity": "sha512-Ym/5Xv7NnkJu40jCSmt/t6B8vT2ue2vobwDEz1FKlB0xGm5bzzh5589m2nZqqY459/Qm9dl5R4BKSdvKqKB2MQ==", + "version": "25.16.0", + "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.16.0.tgz", + "integrity": "sha512-voQuMsO5JbH+JW33TnWurwwvpSb8IQ4XU5wyVMubX4TUwadt+/2ToNJbZIDXoaJPei7vbM81Ft+pH+zGlN8CyA==", "dependencies": { - "@ariakit/react": "^0.3.5", + "@ariakit/react": "^0.3.12", "@babel/runtime": "^7.16.0", "@emotion/cache": "^11.7.1", "@emotion/css": "^11.7.1", @@ -2628,27 +2628,26 @@ "@emotion/styled": "^11.6.0", "@emotion/utils": "^1.0.0", "@floating-ui/react-dom": "^2.0.1", - "@radix-ui/react-dropdown-menu": "2.0.4", "@types/gradient-parser": "0.1.3", "@types/highlight-words-core": "1.2.1", "@use-gesture/react": "^10.2.24", - "@wordpress/a11y": "^3.47.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/date": "^4.47.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/escape-html": "^2.47.0", - "@wordpress/hooks": "^3.47.0", - "@wordpress/html-entities": "^3.47.0", - "@wordpress/i18n": "^4.47.0", - "@wordpress/icons": "^9.38.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/primitives": "^3.45.0", - "@wordpress/private-apis": "^0.29.0", - "@wordpress/rich-text": "^6.24.0", - "@wordpress/warning": "^2.47.0", + "@wordpress/a11y": "^3.50.0", + "@wordpress/compose": "^6.27.0", + "@wordpress/date": "^4.50.0", + "@wordpress/deprecated": "^3.50.0", + "@wordpress/dom": "^3.50.0", + "@wordpress/element": "^5.27.0", + "@wordpress/escape-html": "^2.50.0", + "@wordpress/hooks": "^3.50.0", + "@wordpress/html-entities": "^3.50.0", + "@wordpress/i18n": "^4.50.0", + "@wordpress/icons": "^9.41.0", + "@wordpress/is-shallow-equal": "^4.50.0", + "@wordpress/keycodes": "^3.50.0", + "@wordpress/primitives": "^3.48.0", + "@wordpress/private-apis": "^0.32.0", + "@wordpress/rich-text": "^6.27.0", + "@wordpress/warning": "^2.50.0", "change-case": "^4.1.2", "classnames": "^2.3.1", "colord": "^2.7.0", @@ -2680,21 +2679,21 @@ } }, "node_modules/@givewp/form-builder-library/node_modules/@wordpress/compose": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", - "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.34.0.tgz", + "integrity": "sha512-Xud0mxrfDlzjURNLadrCwhSOZeIQ7tcKpZr4RvmD7Ab5bqZeCd8nOrolosHoSBr8V733NnI2M3VAyR4ASMVpJw==", "dependencies": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/undo-manager": "^0.7.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/dom": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/undo-manager": "^0.17.0", "change-case": "^4.1.2", - "clipboard": "^2.0.8", + "clipboard": "^2.0.11", "mousetrap": "^1.6.5", "use-memo-one": "^1.1.1" }, @@ -2706,9 +2705,9 @@ } }, "node_modules/@givewp/form-builder-library/node_modules/@wordpress/private-apis": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", - "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.32.0.tgz", + "integrity": "sha512-P7nxI/bGMDQhtlTfSe1Y2SDfrd20K5UMnTHbq+hmIkzBGRpNPbdGeNu2bZaZtIvmXk1OCR0Fkef+e6QqkOfYPg==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -2722,9 +2721,9 @@ "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==" + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", + "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==" }, "node_modules/@givewp/form-builder-library/node_modules/remove-accents": { "version": "0.5.0", @@ -7691,13 +7690,13 @@ } }, "node_modules/@wordpress/a11y": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.47.0.tgz", - "integrity": "sha512-4Tnv0D2vJictPtg9nrga0iuliOUSxRrnLYK9Q49CHN4AVr9hE30ndZwn4zy/MYh3K+Oz6YgLBlJrpvL62L0b5w==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.57.0.tgz", + "integrity": "sha512-paf4pp+ze6zk47jDStE1AyO61USvAioIi+gy4lEBKv8LI6LapdYFWR4c/Lta5/aeHPlIHi6J5DkYZpPyVXFueA==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/dom-ready": "^3.47.0", - "@wordpress/i18n": "^4.47.0" + "@wordpress/dom-ready": "^3.57.0", + "@wordpress/i18n": "^4.57.0" }, "engines": { "node": ">=12" @@ -8881,12 +8880,12 @@ } }, "node_modules/@wordpress/date": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.47.0.tgz", - "integrity": "sha512-HIruX+wMaQWKYLCFIu6JeEEoqRYkhpL4cWfZ1lJG78wNsgq3vRiHzXQaXHcbmJQCq0PZOxtmeSzldPiUMFVNpg==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.57.0.tgz", + "integrity": "sha512-azUXRQDhxoCkME7c+0Cw/aCZmyoQeTXhWJYtZBFyPU5wsIXSv/Ucp3WggJR7OSKFnE5rSp5qpCt/nihfLLfZWQ==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.47.0", + "@wordpress/deprecated": "^3.57.0", "moment": "^2.29.4", "moment-timezone": "^0.5.40" }, @@ -8920,33 +8919,33 @@ } }, "node_modules/@wordpress/deprecated": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.47.0.tgz", - "integrity": "sha512-Vq4h6LHGPUc/pqmLOANcPpiMrOVoTeZRDvKxE+ioR9ldEFo+uquMKrEmJZxXVXl0GZdMKQ4jGKx34z8S8VRwQw==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.57.0.tgz", + "integrity": "sha512-rcyiGyd5qTeSaaYVU3gbWot6u0WpN0HPQZWyUq0I+HLmj6gLG7n1z8ZBEpg0iVxEtY46tIAxUWi/FKSlIKMAqg==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.47.0" + "@wordpress/hooks": "^3.57.0" }, "engines": { "node": ">=12" } }, "node_modules/@wordpress/dom": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.47.0.tgz", - "integrity": "sha512-SY6wfAc4yrXYil8fm/uyeKQnPjGuc0G9Q1/5pUKO6dssst8fClsrxy+hXNl0FYFGWnAZBqg5ccrwYydrFt5k/g==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.57.0.tgz", + "integrity": "sha512-3vJ1Z5Lzb7kfMoB8ni275vFGIRrljWFQ2XsVfO6oA/HeoIfHAGVcR58GmbjyxwEgClrizMGIkbs9ubrRpontLQ==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.47.0" + "@wordpress/deprecated": "^3.57.0" }, "engines": { "node": ">=12" } }, "node_modules/@wordpress/dom-ready": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.47.0.tgz", - "integrity": "sha512-VsqaTQJ5Z7Qa3Doi5qk4LMnW0K78JEKLYRcg3ohapgBrQ2tKTS67oWgJx2VgWz8ky6j9UosecSISP3zJHXfEeA==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.57.0.tgz", + "integrity": "sha512-/FEAhSEB5tbTYIhTO/XZChRD/29lk+t5GPdh9eE5z67kGLrPSrludgIRFEuMk1LUDW4d0/0jlIz1rVXKZSZI5g==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -8978,18 +8977,18 @@ } }, "node_modules/@wordpress/element": { - "version": "5.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.24.0.tgz", - "integrity": "sha512-El1E5jlZitrDouvde0dUF2yVRiPsxPnjxB9TU43EhahQ9eT8pwfUaH3I4NT8kUj2LD76WwU8fN7CEmBNBW+ofA==", + "version": "5.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.34.0.tgz", + "integrity": "sha512-/d/lWBDYYgzE2yeXYvPnjMSDG1EdQs5TSLdjM/drQVJMxWayFqAPaF/pVczLHCPYfjgyJN4Zc+bneAKj6dEiLw==", "dependencies": { "@babel/runtime": "^7.16.0", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", - "@wordpress/escape-html": "^2.47.0", + "@wordpress/escape-html": "^2.57.0", "change-case": "^4.1.2", "is-plain-object": "^5.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "react": "^18.3.0", + "react-dom": "^18.3.0" }, "engines": { "node": ">=12" @@ -9133,9 +9132,9 @@ } }, "node_modules/@wordpress/escape-html": { - "version": "2.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.47.0.tgz", - "integrity": "sha512-bBGcTE5chneQJ3yETJyT2suyVtEJNfOiMVBV5qm606TyEzIDm18Sw2mPfOagiB1nOwDkAVfpSVD2NeGpit2alA==", + "version": "2.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.57.0.tgz", + "integrity": "sha512-DkTDo1Qhvs9rfobBpg5vXAOKaev3Jox8R5ryvYIhql5chrkj/V5k2ZzwUChFXxYmivVkWacCwDGmDmwe2ex/ag==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -9144,9 +9143,9 @@ } }, "node_modules/@wordpress/hooks": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.55.0.tgz", - "integrity": "sha512-2bgHAbHR2srPBEkWthlT0i137q01WEYHPA8RQv0jbaBdO6uzkdtraSBZIJQQ1C7dYJloj7RqWuxaJ2TcN0/VXA==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.57.0.tgz", + "integrity": "sha512-+RaPsTj80QNUw3RfiMhxIzaAuYPAvMByrpy97jmodrvhPM5wR9utj40DYIlAiBfMhwACh8NM+kY+UB08CKcmCQ==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -9155,9 +9154,9 @@ } }, "node_modules/@wordpress/html-entities": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.47.0.tgz", - "integrity": "sha512-3wGxzlTNFRnw80jv5ckREDTwNq8FCU+HqdbhwXZWjiIDv2J8GwH1sgD8VbMzlB1Bi9V/3yqteYtv0V/RpC2VfQ==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.57.0.tgz", + "integrity": "sha512-nIMULefL2dIziufq6KchAFbwTqpGrbpzHd1WLL26pqCuiiErVFnrN0yfciVyNWoxcNzjECiPptEQ4bzVV/FTWQ==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -9166,12 +9165,12 @@ } }, "node_modules/@wordpress/i18n": { - "version": "4.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.55.0.tgz", - "integrity": "sha512-ZM1G0AQHgriIe44pp8r/dvbqqRlgfmCeo8ijXgga4GCuxwjENZpJdCjL4UaBljgNfCf+b/H4c6XUUVoHWDBCYw==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.57.0.tgz", + "integrity": "sha512-VYWYHE+7NxnZvE9Swhhe4leQcn0jHNkzRAEV36TkfAL/MvrQYCRh71KLTvKhsilG96HUQdBwjH0VPLmYEmR3sg==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.55.0", + "@wordpress/hooks": "^3.57.0", "gettext-parser": "^1.3.1", "memize": "^2.1.0", "sprintf-js": "^1.1.1", @@ -9190,13 +9189,13 @@ "integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==" }, "node_modules/@wordpress/icons": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.38.0.tgz", - "integrity": "sha512-K+rSZM1eKuWh+rXeMWNLj4dT0a3RJSzoUUh9UDQZCSdnThyAyZECGEKfHSCfd28/yabxLKaziXrb5/MVBrPjZw==", + "version": "9.48.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.48.0.tgz", + "integrity": "sha512-47efXMuqX8Qbf7sFyYeUJ0TPjs3tNqnjHUn3WGc7Gq1IIYD6EGYFmCzPAfciUIXwRBhez2oC4y6IAXl5GP3KBw==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^5.24.0", - "@wordpress/primitives": "^3.45.0" + "@wordpress/element": "^5.34.0", + "@wordpress/primitives": "^3.55.0" }, "engines": { "node": ">=12" @@ -9428,9 +9427,9 @@ } }, "node_modules/@wordpress/is-shallow-equal": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.47.0.tgz", - "integrity": "sha512-mfrw/GXtCzm5jciuXumabfJhJLzGU0EpGgXU9tDHw6CwDrtUMcM05qrvrXFk4IlE2hYFwuTkWryValMt3FFdoQ==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.57.0.tgz", + "integrity": "sha512-qUMqZMLlunwY2J31HG6NZwD2kBIqcwvIDBmdQYvVuQ2aDGeB2Z6sVPXyHCqGfh2ynFfaIL8bDtjW5UtYGPUI4A==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -9554,12 +9553,12 @@ } }, "node_modules/@wordpress/keycodes": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.55.0.tgz", - "integrity": "sha512-93Z479aesGmCo2BZ4UX8gVGabVfj128hCaod1cknZBkOymYxOCc6bobiEQ3ncZ1m6HTxAt5ikjeDXoWuCrPKsQ==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.57.0.tgz", + "integrity": "sha512-8u9MlHE5xPxJf7jROBO8IGYKN54IkjXQD3mfsxVE+dtONeNwRaPvvcZOuOfySerABcCat2OgWCh1s0cV5WNCuw==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.55.0" + "@wordpress/i18n": "^4.57.0" }, "engines": { "node": ">=12" @@ -10055,12 +10054,12 @@ } }, "node_modules/@wordpress/primitives": { - "version": "3.45.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.45.0.tgz", - "integrity": "sha512-8nSRklcrUFIOD/A8gpDrNmf2GTa3x0kuc8EHpra0FBVAwUaacp+HeeP7281tSSIt/yKg3BYhzFnYTB2OQIguGQ==", + "version": "3.55.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.55.0.tgz", + "integrity": "sha512-4vMhlu40+qxkt6lyCv2KWCx9bP7hcpPC9GXj9Kq3gwKIzSSHoqbYs3V8HYeGWrG9g7JWMFN9Pkdy8Bm61ZsKuQ==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^5.24.0", + "@wordpress/element": "^5.34.0", "classnames": "^2.3.1" }, "engines": { @@ -10068,9 +10067,9 @@ } }, "node_modules/@wordpress/priority-queue": { - "version": "2.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.47.0.tgz", - "integrity": "sha512-ZA6BDYkEC3mY1UrEXYnihdb0GoJooxZ9ADPEDEnqY88EuUT8/eeIDOge7OzgatDa9ivzV8TP3Fs4C/mHg/s6dQ==", + "version": "2.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.57.0.tgz", + "integrity": "sha512-g4Oka9aQFVPQUhXkKhHT6BoyTEdCG6S0TUvP4SP16PbkhbvIFwZ25GRQb2ERCVTdseCuDIM5YP0kwZd3NqTlGg==", "dependencies": { "@babel/runtime": "^7.16.0", "requestidlecallback": "^0.3.0" @@ -10091,9 +10090,9 @@ } }, "node_modules/@wordpress/redux-routine": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.47.0.tgz", - "integrity": "sha512-MK9evE2Tn3wVTJhSyAPgIVzMWRd5M9Bjfn4n1in1fbmrYN7qnFYdP4VUJwwYlKRDFpJUxC/4iyREBOryoxKDZw==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.57.0.tgz", + "integrity": "sha512-TfEPeaO8dL3Uk0mlvn1aXyq0g7mYojd12NndEqXR40NC57zs0SeghnBlybSEJ245KixrTIXynbrLLinh0cHCcg==", "dependencies": { "@babel/runtime": "^7.16.0", "is-plain-object": "^5.0.0", @@ -10391,21 +10390,20 @@ } }, "node_modules/@wordpress/rich-text": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-6.24.0.tgz", - "integrity": "sha512-RkvzK8zvLgpd7i5dlL6zs+Dig1lZNSZf/3sYyjX6RalISXNuxF6Zn8Or7kBcq7EcYmey0LMlVIl5FTZ2l7HSIA==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-6.34.0.tgz", + "integrity": "sha512-qeHPgSaI6UolAA9s8ShlbqjWtlh1kTIOMKATDZD6GOACZurXh9ZVJxxsE95FSmLEu4SDmYJ0b2sZlh92yJuaPw==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/a11y": "^3.47.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/data": "^9.17.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/escape-html": "^2.47.0", - "@wordpress/i18n": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "memize": "^2.1.0", - "rememo": "^4.0.2" + "@wordpress/a11y": "^3.57.0", + "@wordpress/compose": "^6.34.0", + "@wordpress/data": "^9.27.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/escape-html": "^2.57.0", + "@wordpress/i18n": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "memize": "^2.1.0" }, "engines": { "node": ">=12" @@ -10415,21 +10413,21 @@ } }, "node_modules/@wordpress/rich-text/node_modules/@wordpress/compose": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", - "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.34.0.tgz", + "integrity": "sha512-Xud0mxrfDlzjURNLadrCwhSOZeIQ7tcKpZr4RvmD7Ab5bqZeCd8nOrolosHoSBr8V733NnI2M3VAyR4ASMVpJw==", "dependencies": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/undo-manager": "^0.7.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/dom": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/undo-manager": "^0.17.0", "change-case": "^4.1.2", - "clipboard": "^2.0.8", + "clipboard": "^2.0.11", "mousetrap": "^1.6.5", "use-memo-one": "^1.1.1" }, @@ -10441,18 +10439,18 @@ } }, "node_modules/@wordpress/rich-text/node_modules/@wordpress/data": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-9.17.0.tgz", - "integrity": "sha512-0FfNL4mHMkX8cBbGAjP8EJ/RGOvf/74qyhBXiLEGUz6swhW6RFrSPm7Dkqe5cMRqXDGoJn15OsOFIuLRllwVoQ==", + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-9.27.0.tgz", + "integrity": "sha512-GorsLO5NIbk3YCkMawHQ1fU6rKgBYOQYT72fSPPsWR5mxIcHB2OXfsQNVFhvFg3znplW8Gl/nh677Cxe2R53tw==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/private-apis": "^0.29.0", - "@wordpress/redux-routine": "^4.47.0", + "@wordpress/compose": "^6.34.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/private-apis": "^0.39.0", + "@wordpress/redux-routine": "^4.57.0", "deepmerge": "^4.3.0", "equivalent-key-map": "^0.2.2", "is-plain-object": "^5.0.0", @@ -10469,9 +10467,9 @@ } }, "node_modules/@wordpress/rich-text/node_modules/@wordpress/private-apis": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", - "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", + "version": "0.39.0", + "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.39.0.tgz", + "integrity": "sha512-JGn7ngLHjbIWcaRNiZP2githQXcLRYS55UpnWa8WemM5vM/Lfql+mBwo1B9/GVvxiGgTy0K3Fv4SsGhZwMjCMg==", "dependencies": { "@babel/runtime": "^7.16.0" }, @@ -12612,12 +12610,12 @@ } }, "node_modules/@wordpress/undo-manager": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.7.0.tgz", - "integrity": "sha512-WhMKX/ETGUJr2GkaPgGwFF8gTU/PgikfvE2b2ZDjUglxIPYnujBa9S6w+kQPzwGniGJutHL1DFK+TmAaxoci9A==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.17.0.tgz", + "integrity": "sha512-K6wSKe93z3QDAn9eKLl6aQVYeafaB1R2FW6Uyqh6OFvQG9q0DXwdgECTT7Ce5tWPEtSjn2CjT5fqDW2Kn/fstg==", "dependencies": { "@babel/runtime": "^7.16.0", - "@wordpress/is-shallow-equal": "^4.47.0" + "@wordpress/is-shallow-equal": "^4.57.0" }, "engines": { "node": ">=12" @@ -14806,9 +14804,9 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, "node_modules/clipboard": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz", - "integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "dependencies": { "good-listener": "^1.2.2", "select": "^1.1.2", @@ -29502,9 +29500,9 @@ } }, "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dependencies": { "loose-envify": "^1.1.0" }, @@ -29814,15 +29812,15 @@ } }, "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dependencies": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^18.2.0" + "react": "^18.3.1" } }, "node_modules/react-dropzone": { @@ -31324,9 +31322,9 @@ } }, "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "dependencies": { "loose-envify": "^1.1.0" } @@ -37056,9 +37054,9 @@ "integrity": "sha512-SOAS98QQOytIGsyDX55y4TCS0DeKijjmOPnNaG0YbClTL2u7HFNthqRHk246BXZ0s6U+CUzqZQ8mf/+3NY4Z1g==" }, "@givewp/form-builder-library": { - "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==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@givewp/form-builder-library/-/form-builder-library-1.6.0.tgz", + "integrity": "sha512-I/ZLIFHbWSZU+PR3urCyvFR/kiSV0YZI2rBqjBT8/sYbEzh/IXNTbGdp5/1hvzpsGzVN/aThGDut71JxW0oKvA==", "requires": { "@wordpress/components": "^25.10.0", "@wordpress/compose": "^6.21.0", @@ -37068,42 +37066,42 @@ }, "dependencies": { "@ariakit/core": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.3.8.tgz", - "integrity": "sha512-LlSCwbyyozMX4ZEobpYGcv1LFqOdBTdTYPZw3lAVgLcFSNivsazi3NkKM9qNWNIu00MS+xTa0+RuIcuWAjlB2Q==" + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.3.11.tgz", + "integrity": "sha512-+MnOeqnA4FLI/7vqsZLbZQHHN4ofd9kvkNjz44fNi0gqmD+ZbMWiDkFAvZII75dYnxYw5ZPpWjA4waK22VBWig==" }, "@ariakit/react": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.3.9.tgz", - "integrity": "sha512-gC+gibh2go8wvBqzYXavlHKwAfmee5GUMrPSQ9WBBLIfm9nQElujxcHJydaRx+ULR5FbOnbZVC3vU2ic8hSrNw==", + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.3.14.tgz", + "integrity": "sha512-h71BPMZ2eW+E2ESbdYxSAEMR1DozYzd5eHE5IOzGd9Egi5u7EZxqmuW4CXVXZ1Y6vbaDMV3SudgPh7iHS/ArFw==", "requires": { - "@ariakit/react-core": "0.3.9" + "@ariakit/react-core": "0.3.14" } }, "@ariakit/react-core": { - "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==", + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.3.14.tgz", + "integrity": "sha512-16Qj6kDPglpdWtU5roY9q+G66naOjauTY5HvUIaL2aLY0187ATaRrABIKoMMzTtJyhvsud4jFlzivz+/zCQ8yw==", "requires": { - "@ariakit/core": "0.3.8", + "@ariakit/core": "0.3.11", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" } }, "@floating-ui/react-dom": { - "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==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.9.tgz", + "integrity": "sha512-q0umO0+LQK4+p6aGyvzASqKbKOJcAHJ7ycE9CuUvfx3s9zTHWmGJTPOIlM/hmSBfUfg/XfY5YhLBLR/LHwShQQ==", "requires": { - "@floating-ui/dom": "^1.5.1" + "@floating-ui/dom": "^1.0.0" } }, "@wordpress/components": { - "version": "25.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.13.0.tgz", - "integrity": "sha512-Ym/5Xv7NnkJu40jCSmt/t6B8vT2ue2vobwDEz1FKlB0xGm5bzzh5589m2nZqqY459/Qm9dl5R4BKSdvKqKB2MQ==", + "version": "25.16.0", + "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-25.16.0.tgz", + "integrity": "sha512-voQuMsO5JbH+JW33TnWurwwvpSb8IQ4XU5wyVMubX4TUwadt+/2ToNJbZIDXoaJPei7vbM81Ft+pH+zGlN8CyA==", "requires": { - "@ariakit/react": "^0.3.5", + "@ariakit/react": "^0.3.12", "@babel/runtime": "^7.16.0", "@emotion/cache": "^11.7.1", "@emotion/css": "^11.7.1", @@ -37112,27 +37110,26 @@ "@emotion/styled": "^11.6.0", "@emotion/utils": "^1.0.0", "@floating-ui/react-dom": "^2.0.1", - "@radix-ui/react-dropdown-menu": "2.0.4", "@types/gradient-parser": "0.1.3", "@types/highlight-words-core": "1.2.1", "@use-gesture/react": "^10.2.24", - "@wordpress/a11y": "^3.47.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/date": "^4.47.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/escape-html": "^2.47.0", - "@wordpress/hooks": "^3.47.0", - "@wordpress/html-entities": "^3.47.0", - "@wordpress/i18n": "^4.47.0", - "@wordpress/icons": "^9.38.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/primitives": "^3.45.0", - "@wordpress/private-apis": "^0.29.0", - "@wordpress/rich-text": "^6.24.0", - "@wordpress/warning": "^2.47.0", + "@wordpress/a11y": "^3.50.0", + "@wordpress/compose": "^6.27.0", + "@wordpress/date": "^4.50.0", + "@wordpress/deprecated": "^3.50.0", + "@wordpress/dom": "^3.50.0", + "@wordpress/element": "^5.27.0", + "@wordpress/escape-html": "^2.50.0", + "@wordpress/hooks": "^3.50.0", + "@wordpress/html-entities": "^3.50.0", + "@wordpress/i18n": "^4.50.0", + "@wordpress/icons": "^9.41.0", + "@wordpress/is-shallow-equal": "^4.50.0", + "@wordpress/keycodes": "^3.50.0", + "@wordpress/primitives": "^3.48.0", + "@wordpress/private-apis": "^0.32.0", + "@wordpress/rich-text": "^6.27.0", + "@wordpress/warning": "^2.50.0", "change-case": "^4.1.2", "classnames": "^2.3.1", "colord": "^2.7.0", @@ -37157,29 +37154,29 @@ } }, "@wordpress/compose": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", - "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.34.0.tgz", + "integrity": "sha512-Xud0mxrfDlzjURNLadrCwhSOZeIQ7tcKpZr4RvmD7Ab5bqZeCd8nOrolosHoSBr8V733NnI2M3VAyR4ASMVpJw==", "requires": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/undo-manager": "^0.7.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/dom": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/undo-manager": "^0.17.0", "change-case": "^4.1.2", - "clipboard": "^2.0.8", + "clipboard": "^2.0.11", "mousetrap": "^1.6.5", "use-memo-one": "^1.1.1" } }, "@wordpress/private-apis": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", - "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.32.0.tgz", + "integrity": "sha512-P7nxI/bGMDQhtlTfSe1Y2SDfrd20K5UMnTHbq+hmIkzBGRpNPbdGeNu2bZaZtIvmXk1OCR0Fkef+e6QqkOfYPg==", "requires": { "@babel/runtime": "^7.16.0" } @@ -37190,9 +37187,9 @@ "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==" + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", + "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==" }, "remove-accents": { "version": "0.5.0", @@ -41108,13 +41105,13 @@ "requires": {} }, "@wordpress/a11y": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.47.0.tgz", - "integrity": "sha512-4Tnv0D2vJictPtg9nrga0iuliOUSxRrnLYK9Q49CHN4AVr9hE30ndZwn4zy/MYh3K+Oz6YgLBlJrpvL62L0b5w==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.57.0.tgz", + "integrity": "sha512-paf4pp+ze6zk47jDStE1AyO61USvAioIi+gy4lEBKv8LI6LapdYFWR4c/Lta5/aeHPlIHi6J5DkYZpPyVXFueA==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/dom-ready": "^3.47.0", - "@wordpress/i18n": "^4.47.0" + "@wordpress/dom-ready": "^3.57.0", + "@wordpress/i18n": "^4.57.0" } }, "@wordpress/api-fetch": { @@ -42024,12 +42021,12 @@ } }, "@wordpress/date": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.47.0.tgz", - "integrity": "sha512-HIruX+wMaQWKYLCFIu6JeEEoqRYkhpL4cWfZ1lJG78wNsgq3vRiHzXQaXHcbmJQCq0PZOxtmeSzldPiUMFVNpg==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.57.0.tgz", + "integrity": "sha512-azUXRQDhxoCkME7c+0Cw/aCZmyoQeTXhWJYtZBFyPU5wsIXSv/Ucp3WggJR7OSKFnE5rSp5qpCt/nihfLLfZWQ==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.47.0", + "@wordpress/deprecated": "^3.57.0", "moment": "^2.29.4", "moment-timezone": "^0.5.40" } @@ -42053,27 +42050,27 @@ } }, "@wordpress/deprecated": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.47.0.tgz", - "integrity": "sha512-Vq4h6LHGPUc/pqmLOANcPpiMrOVoTeZRDvKxE+ioR9ldEFo+uquMKrEmJZxXVXl0GZdMKQ4jGKx34z8S8VRwQw==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.57.0.tgz", + "integrity": "sha512-rcyiGyd5qTeSaaYVU3gbWot6u0WpN0HPQZWyUq0I+HLmj6gLG7n1z8ZBEpg0iVxEtY46tIAxUWi/FKSlIKMAqg==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.47.0" + "@wordpress/hooks": "^3.57.0" } }, "@wordpress/dom": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.47.0.tgz", - "integrity": "sha512-SY6wfAc4yrXYil8fm/uyeKQnPjGuc0G9Q1/5pUKO6dssst8fClsrxy+hXNl0FYFGWnAZBqg5ccrwYydrFt5k/g==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.57.0.tgz", + "integrity": "sha512-3vJ1Z5Lzb7kfMoB8ni275vFGIRrljWFQ2XsVfO6oA/HeoIfHAGVcR58GmbjyxwEgClrizMGIkbs9ubrRpontLQ==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.47.0" + "@wordpress/deprecated": "^3.57.0" } }, "@wordpress/dom-ready": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.47.0.tgz", - "integrity": "sha512-VsqaTQJ5Z7Qa3Doi5qk4LMnW0K78JEKLYRcg3ohapgBrQ2tKTS67oWgJx2VgWz8ky6j9UosecSISP3zJHXfEeA==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.57.0.tgz", + "integrity": "sha512-/FEAhSEB5tbTYIhTO/XZChRD/29lk+t5GPdh9eE5z67kGLrPSrludgIRFEuMk1LUDW4d0/0jlIz1rVXKZSZI5g==", "requires": { "@babel/runtime": "^7.16.0" } @@ -42096,18 +42093,18 @@ } }, "@wordpress/element": { - "version": "5.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.24.0.tgz", - "integrity": "sha512-El1E5jlZitrDouvde0dUF2yVRiPsxPnjxB9TU43EhahQ9eT8pwfUaH3I4NT8kUj2LD76WwU8fN7CEmBNBW+ofA==", + "version": "5.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-5.34.0.tgz", + "integrity": "sha512-/d/lWBDYYgzE2yeXYvPnjMSDG1EdQs5TSLdjM/drQVJMxWayFqAPaF/pVczLHCPYfjgyJN4Zc+bneAKj6dEiLw==", "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", - "@wordpress/escape-html": "^2.47.0", + "@wordpress/escape-html": "^2.57.0", "change-case": "^4.1.2", "is-plain-object": "^5.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "react": "^18.3.0", + "react-dom": "^18.3.0" } }, "@wordpress/env": { @@ -42214,36 +42211,36 @@ } }, "@wordpress/escape-html": { - "version": "2.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.47.0.tgz", - "integrity": "sha512-bBGcTE5chneQJ3yETJyT2suyVtEJNfOiMVBV5qm606TyEzIDm18Sw2mPfOagiB1nOwDkAVfpSVD2NeGpit2alA==", + "version": "2.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.57.0.tgz", + "integrity": "sha512-DkTDo1Qhvs9rfobBpg5vXAOKaev3Jox8R5ryvYIhql5chrkj/V5k2ZzwUChFXxYmivVkWacCwDGmDmwe2ex/ag==", "requires": { "@babel/runtime": "^7.16.0" } }, "@wordpress/hooks": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.55.0.tgz", - "integrity": "sha512-2bgHAbHR2srPBEkWthlT0i137q01WEYHPA8RQv0jbaBdO6uzkdtraSBZIJQQ1C7dYJloj7RqWuxaJ2TcN0/VXA==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.57.0.tgz", + "integrity": "sha512-+RaPsTj80QNUw3RfiMhxIzaAuYPAvMByrpy97jmodrvhPM5wR9utj40DYIlAiBfMhwACh8NM+kY+UB08CKcmCQ==", "requires": { "@babel/runtime": "^7.16.0" } }, "@wordpress/html-entities": { - "version": "3.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.47.0.tgz", - "integrity": "sha512-3wGxzlTNFRnw80jv5ckREDTwNq8FCU+HqdbhwXZWjiIDv2J8GwH1sgD8VbMzlB1Bi9V/3yqteYtv0V/RpC2VfQ==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.57.0.tgz", + "integrity": "sha512-nIMULefL2dIziufq6KchAFbwTqpGrbpzHd1WLL26pqCuiiErVFnrN0yfciVyNWoxcNzjECiPptEQ4bzVV/FTWQ==", "requires": { "@babel/runtime": "^7.16.0" } }, "@wordpress/i18n": { - "version": "4.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.55.0.tgz", - "integrity": "sha512-ZM1G0AQHgriIe44pp8r/dvbqqRlgfmCeo8ijXgga4GCuxwjENZpJdCjL4UaBljgNfCf+b/H4c6XUUVoHWDBCYw==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.57.0.tgz", + "integrity": "sha512-VYWYHE+7NxnZvE9Swhhe4leQcn0jHNkzRAEV36TkfAL/MvrQYCRh71KLTvKhsilG96HUQdBwjH0VPLmYEmR3sg==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.55.0", + "@wordpress/hooks": "^3.57.0", "gettext-parser": "^1.3.1", "memize": "^2.1.0", "sprintf-js": "^1.1.1", @@ -42258,13 +42255,13 @@ } }, "@wordpress/icons": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.38.0.tgz", - "integrity": "sha512-K+rSZM1eKuWh+rXeMWNLj4dT0a3RJSzoUUh9UDQZCSdnThyAyZECGEKfHSCfd28/yabxLKaziXrb5/MVBrPjZw==", + "version": "9.48.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.48.0.tgz", + "integrity": "sha512-47efXMuqX8Qbf7sFyYeUJ0TPjs3tNqnjHUn3WGc7Gq1IIYD6EGYFmCzPAfciUIXwRBhez2oC4y6IAXl5GP3KBw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^5.24.0", - "@wordpress/primitives": "^3.45.0" + "@wordpress/element": "^5.34.0", + "@wordpress/primitives": "^3.55.0" } }, "@wordpress/interactivity": { @@ -42429,9 +42426,9 @@ } }, "@wordpress/is-shallow-equal": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.47.0.tgz", - "integrity": "sha512-mfrw/GXtCzm5jciuXumabfJhJLzGU0EpGgXU9tDHw6CwDrtUMcM05qrvrXFk4IlE2hYFwuTkWryValMt3FFdoQ==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.57.0.tgz", + "integrity": "sha512-qUMqZMLlunwY2J31HG6NZwD2kBIqcwvIDBmdQYvVuQ2aDGeB2Z6sVPXyHCqGfh2ynFfaIL8bDtjW5UtYGPUI4A==", "requires": { "@babel/runtime": "^7.16.0" } @@ -42520,12 +42517,12 @@ } }, "@wordpress/keycodes": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.55.0.tgz", - "integrity": "sha512-93Z479aesGmCo2BZ4UX8gVGabVfj128hCaod1cknZBkOymYxOCc6bobiEQ3ncZ1m6HTxAt5ikjeDXoWuCrPKsQ==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.57.0.tgz", + "integrity": "sha512-8u9MlHE5xPxJf7jROBO8IGYKN54IkjXQD3mfsxVE+dtONeNwRaPvvcZOuOfySerABcCat2OgWCh1s0cV5WNCuw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.55.0" + "@wordpress/i18n": "^4.57.0" } }, "@wordpress/notices": { @@ -42876,19 +42873,19 @@ } }, "@wordpress/primitives": { - "version": "3.45.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.45.0.tgz", - "integrity": "sha512-8nSRklcrUFIOD/A8gpDrNmf2GTa3x0kuc8EHpra0FBVAwUaacp+HeeP7281tSSIt/yKg3BYhzFnYTB2OQIguGQ==", + "version": "3.55.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.55.0.tgz", + "integrity": "sha512-4vMhlu40+qxkt6lyCv2KWCx9bP7hcpPC9GXj9Kq3gwKIzSSHoqbYs3V8HYeGWrG9g7JWMFN9Pkdy8Bm61ZsKuQ==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^5.24.0", + "@wordpress/element": "^5.34.0", "classnames": "^2.3.1" } }, "@wordpress/priority-queue": { - "version": "2.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.47.0.tgz", - "integrity": "sha512-ZA6BDYkEC3mY1UrEXYnihdb0GoJooxZ9ADPEDEnqY88EuUT8/eeIDOge7OzgatDa9ivzV8TP3Fs4C/mHg/s6dQ==", + "version": "2.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.57.0.tgz", + "integrity": "sha512-g4Oka9aQFVPQUhXkKhHT6BoyTEdCG6S0TUvP4SP16PbkhbvIFwZ25GRQb2ERCVTdseCuDIM5YP0kwZd3NqTlGg==", "requires": { "@babel/runtime": "^7.16.0", "requestidlecallback": "^0.3.0" @@ -42903,9 +42900,9 @@ } }, "@wordpress/redux-routine": { - "version": "4.47.0", - "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.47.0.tgz", - "integrity": "sha512-MK9evE2Tn3wVTJhSyAPgIVzMWRd5M9Bjfn4n1in1fbmrYN7qnFYdP4VUJwwYlKRDFpJUxC/4iyREBOryoxKDZw==", + "version": "4.57.0", + "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.57.0.tgz", + "integrity": "sha512-TfEPeaO8dL3Uk0mlvn1aXyq0g7mYojd12NndEqXR40NC57zs0SeghnBlybSEJ245KixrTIXynbrLLinh0cHCcg==", "requires": { "@babel/runtime": "^7.16.0", "is-plain-object": "^5.0.0", @@ -43126,56 +43123,55 @@ } }, "@wordpress/rich-text": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-6.24.0.tgz", - "integrity": "sha512-RkvzK8zvLgpd7i5dlL6zs+Dig1lZNSZf/3sYyjX6RalISXNuxF6Zn8Or7kBcq7EcYmey0LMlVIl5FTZ2l7HSIA==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-6.34.0.tgz", + "integrity": "sha512-qeHPgSaI6UolAA9s8ShlbqjWtlh1kTIOMKATDZD6GOACZurXh9ZVJxxsE95FSmLEu4SDmYJ0b2sZlh92yJuaPw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/a11y": "^3.47.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/data": "^9.17.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/escape-html": "^2.47.0", - "@wordpress/i18n": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "memize": "^2.1.0", - "rememo": "^4.0.2" + "@wordpress/a11y": "^3.57.0", + "@wordpress/compose": "^6.34.0", + "@wordpress/data": "^9.27.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/escape-html": "^2.57.0", + "@wordpress/i18n": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "memize": "^2.1.0" }, "dependencies": { "@wordpress/compose": { - "version": "6.24.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.24.0.tgz", - "integrity": "sha512-aO0HWi12Y7Do5hyGEOXcRtRTIn7P/t4RrHYMTsHvufCrt6ZCLKvY2vBEaDA8XnWFQZ/Tzo4fBAnxAAxDt1DtEw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-6.34.0.tgz", + "integrity": "sha512-Xud0mxrfDlzjURNLadrCwhSOZeIQ7tcKpZr4RvmD7Ab5bqZeCd8nOrolosHoSBr8V733NnI2M3VAyR4ASMVpJw==", "requires": { "@babel/runtime": "^7.16.0", "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/dom": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/keycodes": "^3.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/undo-manager": "^0.7.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/dom": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/keycodes": "^3.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/undo-manager": "^0.17.0", "change-case": "^4.1.2", - "clipboard": "^2.0.8", + "clipboard": "^2.0.11", "mousetrap": "^1.6.5", "use-memo-one": "^1.1.1" } }, "@wordpress/data": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-9.17.0.tgz", - "integrity": "sha512-0FfNL4mHMkX8cBbGAjP8EJ/RGOvf/74qyhBXiLEGUz6swhW6RFrSPm7Dkqe5cMRqXDGoJn15OsOFIuLRllwVoQ==", + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-9.27.0.tgz", + "integrity": "sha512-GorsLO5NIbk3YCkMawHQ1fU6rKgBYOQYT72fSPPsWR5mxIcHB2OXfsQNVFhvFg3znplW8Gl/nh677Cxe2R53tw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/compose": "^6.24.0", - "@wordpress/deprecated": "^3.47.0", - "@wordpress/element": "^5.24.0", - "@wordpress/is-shallow-equal": "^4.47.0", - "@wordpress/priority-queue": "^2.47.0", - "@wordpress/private-apis": "^0.29.0", - "@wordpress/redux-routine": "^4.47.0", + "@wordpress/compose": "^6.34.0", + "@wordpress/deprecated": "^3.57.0", + "@wordpress/element": "^5.34.0", + "@wordpress/is-shallow-equal": "^4.57.0", + "@wordpress/priority-queue": "^2.57.0", + "@wordpress/private-apis": "^0.39.0", + "@wordpress/redux-routine": "^4.57.0", "deepmerge": "^4.3.0", "equivalent-key-map": "^0.2.2", "is-plain-object": "^5.0.0", @@ -43186,9 +43182,9 @@ } }, "@wordpress/private-apis": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.29.0.tgz", - "integrity": "sha512-8t4au9+IXXgJlxxOuYVYi8PKp0uWajNYILNfqCLB65jQEClzGNMQhU6MeJ9+kHN3gdOltMk7UzG28X+FTDlmkQ==", + "version": "0.39.0", + "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-0.39.0.tgz", + "integrity": "sha512-JGn7ngLHjbIWcaRNiZP2githQXcLRYS55UpnWa8WemM5vM/Lfql+mBwo1B9/GVvxiGgTy0K3Fv4SsGhZwMjCMg==", "requires": { "@babel/runtime": "^7.16.0" } @@ -44607,12 +44603,12 @@ } }, "@wordpress/undo-manager": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.7.0.tgz", - "integrity": "sha512-WhMKX/ETGUJr2GkaPgGwFF8gTU/PgikfvE2b2ZDjUglxIPYnujBa9S6w+kQPzwGniGJutHL1DFK+TmAaxoci9A==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@wordpress/undo-manager/-/undo-manager-0.17.0.tgz", + "integrity": "sha512-K6wSKe93z3QDAn9eKLl6aQVYeafaB1R2FW6Uyqh6OFvQG9q0DXwdgECTT7Ce5tWPEtSjn2CjT5fqDW2Kn/fstg==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/is-shallow-equal": "^4.47.0" + "@wordpress/is-shallow-equal": "^4.57.0" } }, "@wordpress/url": { @@ -46276,9 +46272,9 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, "clipboard": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz", - "integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "requires": { "good-listener": "^1.2.2", "select": "^1.1.2", @@ -57169,9 +57165,9 @@ "requires": {} }, "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "requires": { "loose-envify": "^1.1.0" } @@ -57409,12 +57405,12 @@ } }, "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "requires": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" } }, "react-dropzone": { @@ -58527,9 +58523,9 @@ } }, "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "requires": { "loose-envify": "^1.1.0" } diff --git a/package.json b/package.json index cf3d7f4e95..c84655c258 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.12", "@givewp/design-system-foundation": "^1.1.0", - "@givewp/form-builder-library": "^1.2.1", + "@givewp/form-builder-library": "^1.6.0", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^2.9.10", "@paypal/paypal-js": "^5.1.4", diff --git a/src/DonationForms/Actions/ConvertDonationAmountBlockToFieldsApi.php b/src/DonationForms/Actions/ConvertDonationAmountBlockToFieldsApi.php index d6af3da28e..45b797bc44 100644 --- a/src/DonationForms/Actions/ConvertDonationAmountBlockToFieldsApi.php +++ b/src/DonationForms/Actions/ConvertDonationAmountBlockToFieldsApi.php @@ -56,19 +56,25 @@ public function __invoke(DonationAmountBlockModel $block, string $currency): Don /** @var Amount $amountNode */ $amountNode = $group->getNodeByName('amount'); - $defaultLevel = $block->getDefaultLevel() > 0 ? $block->getDefaultLevel() : 10; $amountNode ->label($block->getLabel()) - ->levels(...$block->getLevels()) - ->allowLevels($block->getPriceOption() === 'multi') ->allowCustomAmount($block->isCustomAmountEnabled()) - ->fixedAmountValue($block->getSetPrice()) - ->defaultValue( - $block->getPriceOption() === 'set' ? - $block->getSetPrice() : $defaultLevel - ) ->rules(...$amountRules); + $priceOptions = $block->getPriceOption(); + if ($priceOptions === 'multi') { + ['levels' => $levels, 'checked' => $checked] = $this->prepareLevelsArray($block); + + $amountNode + ->allowLevels() + ->levels(...$levels) + ->defaultValue($checked); + } else { + $amountNode + ->fixedAmountValue($block->getSetPrice()) + ->defaultValue($block->getSetPrice()); + } + /** @var Hidden $currencyNode */ $currencyNode = $group->getNodeByName('currency'); $currencyNode @@ -164,4 +170,41 @@ protected function getRecurringAmountPeriodField(DonationAmountBlockModel $block ->options(...$options) ->rules(new SubscriptionPeriodRule()); } + + /** + * Prepares the options array to be used in the field. + * + * @unreleased + * + * @return array ['options' => ['label' => string, 'value' => string][], 'checked' => string] + */ + private function prepareLevelsArray(DonationAmountBlockModel $block): array + { + $checked = null; + $levels = array_values( + array_filter( + array_map( + function ($item) use (&$checked, $block) { + if (isset($item['checked']) && $item['checked']) { + $checked = $item['value']; + } + + return [ + 'value' => $item['value'] ?? '', + 'label' => $block->isDescriptionEnabled() ? $item['label'] : '', + ]; + }, + $block->getLevels() + ), + function ($item) { + return $item['value'] !== ''; + } + ) + ); + + return [ + 'levels' => $levels, + 'checked' => $checked, + ]; + } } diff --git a/src/DonationForms/Actions/StoreBackwardsCompatibleFormMeta.php b/src/DonationForms/Actions/StoreBackwardsCompatibleFormMeta.php index c8311c8749..29cdfa023d 100644 --- a/src/DonationForms/Actions/StoreBackwardsCompatibleFormMeta.php +++ b/src/DonationForms/Actions/StoreBackwardsCompatibleFormMeta.php @@ -23,6 +23,7 @@ public function __invoke(DonationForm $donationForm) } /** + * @unreleased Update to store donation levels with descriptions * @since 3.0.0 update with dynamic values from amount field * @since 3.0.0 */ @@ -43,7 +44,8 @@ public function storeDonationLevels(DonationForm $donationForm) '_give_id' => [ 'level_id' => $index, ], - '_give_amount' => $donationLevel + '_give_amount' => $donationLevel['value'], + '_give_text' => $donationLevel['label'] ?? '', ]; }, $donationLevels, array_keys($donationLevels)); diff --git a/src/DonationForms/Migrations/UpdateDonationLevelsSchema.php b/src/DonationForms/Migrations/UpdateDonationLevelsSchema.php new file mode 100644 index 0000000000..b95c29fe6a --- /dev/null +++ b/src/DonationForms/Migrations/UpdateDonationLevelsSchema.php @@ -0,0 +1,80 @@ +prepareQuery() + ->whereIsNotNull("give_formmeta_attach_meta_fields.meta_value") + ->getAll(); + + if ( ! $forms) { + return; + } + + foreach ($forms as $form) { + $amountBlock = $form->blocks->findByName('givewp/donation-amount'); + + if ( ! $amountBlock) { + continue; + } + + $blockAttributes = $amountBlock->getAttributes(); + $levels = $blockAttributes["levels"]; + $defaultLevel = $blockAttributes["defaultLevel"] ?? 0; + + if ( ! is_array($levels) || empty($levels) || isset($levels[0]['value'])) { + continue; + } + + $levels = array_map(function($level) use ($defaultLevel) { + return [ + 'value' => $level, + 'label' => '', + 'checked' => $level === $defaultLevel, + ]; + }, $levels); + + $amountBlock->setAttribute('levels', $levels); + $form->save(); + } + } +} diff --git a/src/DonationForms/ServiceProvider.php b/src/DonationForms/ServiceProvider.php index 87dc490b47..2f26728781 100644 --- a/src/DonationForms/ServiceProvider.php +++ b/src/DonationForms/ServiceProvider.php @@ -14,11 +14,12 @@ use Give\DonationForms\DataTransferObjects\DonationFormPreviewRouteData; use Give\DonationForms\DataTransferObjects\DonationFormViewRouteData; use Give\DonationForms\FormDesigns\ClassicFormDesign\ClassicFormDesign; -use Give\DonationForms\FormDesigns\TwoPanelStepsFormLayout\TwoPanelStepsFormLayout; use Give\DonationForms\FormDesigns\MultiStepFormDesign\MultiStepFormDesign; +use Give\DonationForms\FormDesigns\TwoPanelStepsFormLayout\TwoPanelStepsFormLayout; use Give\DonationForms\FormPage\TemplateHandler; use Give\DonationForms\Migrations\CleanMultipleSlashesOnDB; use Give\DonationForms\Migrations\RemoveDuplicateMeta; +use Give\DonationForms\Migrations\UpdateDonationLevelsSchema; use Give\DonationForms\Repositories\DonationFormRepository; use Give\DonationForms\Routes\AuthenticationRoute; use Give\DonationForms\Routes\DonateRoute; @@ -76,6 +77,7 @@ public function boot() give(MigrationsRegister::class)->addMigrations([ CleanMultipleSlashesOnDB::class, RemoveDuplicateMeta::class, + UpdateDonationLevelsSchema::class, ]); } diff --git a/src/DonationForms/resources/propTypes.ts b/src/DonationForms/resources/propTypes.ts index 9238f72a98..5301a05500 100644 --- a/src/DonationForms/resources/propTypes.ts +++ b/src/DonationForms/resources/propTypes.ts @@ -127,7 +127,7 @@ export interface DonationAmountProps extends GroupProps { } export interface AmountProps extends FieldProps { - levels: number[]; + levels: {label: string; value: number}[]; allowLevels: boolean; allowCustomAmount: boolean; fixedAmountValue: number; diff --git a/src/DonationForms/resources/registrars/templates/fields/Amount/DonationAmountLevels.tsx b/src/DonationForms/resources/registrars/templates/fields/Amount/DonationAmountLevels.tsx index 5c841eb794..9322dcc71e 100644 --- a/src/DonationForms/resources/registrars/templates/fields/Amount/DonationAmountLevels.tsx +++ b/src/DonationForms/resources/registrars/templates/fields/Amount/DonationAmountLevels.tsx @@ -6,41 +6,71 @@ import classNames from 'classnames'; type DonationAmountLevelsProps = { name: string; currency: string; - levels: number[]; + levels: Level[]; onLevelClick?: (amount: number) => void; }; +type GroupedLevels = { + labeled: Level[]; + unlabeled: Level[]; +}; + +type Level = {label: string | null; value: number}; + /** + * @unreleased add level descriptions. * @since 3.0.0 */ -export default function DonationAmountLevels({ - name, - currency, - levels, - onLevelClick, -}: DonationAmountLevelsProps) { +export default function DonationAmountLevels({name, currency, levels, onLevelClick}: DonationAmountLevelsProps) { const {useWatch, useCurrencyFormatter} = window.givewp.form.hooks; const amount = useWatch({name}); const formatter = useCurrencyFormatter(currency); + const groupedLevels: GroupedLevels = levels.reduce( + (acc: GroupedLevels, level) => { + const key = level.label ? 'labeled' : 'unlabeled'; + acc[key].push(level); + return acc; + }, + {labeled: [], unlabeled: []} + ); + + const allLevels = [...groupedLevels.labeled, ...groupedLevels.unlabeled]; + return ( -
- {levels.map((levelAmount, index) => { - const label = formatter.format(levelAmount); - const selected = levelAmount === amount; +
0, + })} + > + {allLevels.map((level, index) => { + const label = formatter.format(level.value); + const selected = level.value === amount; + const hasDescription = level.label; + return ( - + + {hasDescription && ( + {level.label} + )} +
); })}
diff --git a/src/DonationForms/resources/registrars/templates/fields/Amount/getAmountLevelsWithCurrencySettings.tsx b/src/DonationForms/resources/registrars/templates/fields/Amount/getAmountLevelsWithCurrencySettings.tsx deleted file mode 100644 index ff72fbf523..0000000000 --- a/src/DonationForms/resources/registrars/templates/fields/Amount/getAmountLevelsWithCurrencySettings.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import {CurrencySwitcherSetting} from '@givewp/forms/types'; -import {isBaseCurrency} from './CurrencySwitcher'; - -/** - * Convert level amounts to the selected currency and fallback to original values if no currency setting is found or exchange rate is 0. - * - * @since 3.0.0 - */ -export default function getAmountLevelsWithCurrencySettings( - levels: number[], - currency: string, - currencySettings: CurrencySwitcherSetting[] -) { - const currencySetting = currencySettings.find(({id}) => id === currency); - - if (currencySetting === undefined || isBaseCurrency(currencySetting)) { - return levels; - } - - return levels.map((levelAmount) => levelAmount * currencySetting.exchangeRate); -} \ No newline at end of file diff --git a/src/DonationForms/resources/registrars/templates/fields/Amount/index.tsx b/src/DonationForms/resources/registrars/templates/fields/Amount/index.tsx index 8ff9d0676d..4ba99034fd 100644 --- a/src/DonationForms/resources/registrars/templates/fields/Amount/index.tsx +++ b/src/DonationForms/resources/registrars/templates/fields/Amount/index.tsx @@ -1,12 +1,13 @@ import {useCallback} from '@wordpress/element'; import type {AmountProps} from '@givewp/forms/propTypes'; import CustomAmount from './CustomAmount'; -import {useState} from 'react'; -import getAmountLevelsWithCurrencySettings from './getAmountLevelsWithCurrencySettings'; +import {useEffect, useState} from 'react'; +import {getAmountLevelsWithCurrencySettings, getDefaultAmountWithCurrencySettings} from './withCurrencySettings'; import DonationAmountCurrency from './DonationAmountCurrency'; import DonationAmountLevels from './DonationAmountLevels'; /** + * @unreleased Update default level when having distinct default currency * @since 3.0.0 */ export default function Amount({ @@ -24,13 +25,26 @@ export default function Amount({ }: AmountProps) { const isFixedAmount = !allowLevels; const [customAmountValue, setCustomAmountValue] = useState( - isFixedAmount ? fixedAmountValue.toString() : ''); + isFixedAmount ? fixedAmountValue.toString() : '' + ); const {useWatch, useFormContext, useDonationFormSettings} = window.givewp.form.hooks; const {setValue} = useFormContext(); const {currencySwitcherSettings} = useDonationFormSettings(); const currency = useWatch({name: 'currency'}); + useEffect(() => { + if (!isFixedAmount) { + const defaultAmount = getDefaultAmountWithCurrencySettings( + levels, + defaultValue, + currency, + currencySwitcherSettings + ); + setValue(name, defaultAmount); + } + }, []); + const getAmountLevels = useCallback(() => { if (currencySwitcherSettings.length <= 1) { return levels; @@ -87,7 +101,6 @@ export default function Amount({ value={customAmountValue} onValueChange={(value) => { setCustomAmountValue(value); - setValue(name, Number(value) ?? null); }} /> diff --git a/src/DonationForms/resources/registrars/templates/fields/Amount/withCurrencySettings.tsx b/src/DonationForms/resources/registrars/templates/fields/Amount/withCurrencySettings.tsx new file mode 100644 index 0000000000..b7de49b97b --- /dev/null +++ b/src/DonationForms/resources/registrars/templates/fields/Amount/withCurrencySettings.tsx @@ -0,0 +1,42 @@ +import {CurrencySwitcherSetting} from '@givewp/forms/types'; +import {isBaseCurrency} from './CurrencySwitcher'; + +/** + * Convert level amounts to the selected currency and fallback to original values if no currency setting is found or exchange rate is 0. + * + * @since 3.0.0 + */ +export function getAmountLevelsWithCurrencySettings( + levels: {label: string; value: number}[], + currency: string, + currencySettings: CurrencySwitcherSetting[] +) { + const currencySetting = currencySettings.find(({id}) => id === currency); + + if (currencySetting === undefined || isBaseCurrency(currencySetting)) { + return levels; + } + + return levels.map((level) => { + return { + ...level, + value: level.value * currencySetting.exchangeRate, + }; + }); +} + +export function getDefaultAmountWithCurrencySettings( + levels: {label: string; value: number}[], + amount: number, + currency: string, + currencySettings: CurrencySwitcherSetting[] +) { + const currencySetting = currencySettings.find(({id}) => id === currency); + const defaultLevel = levels.find((level) => level.value === amount); + + if (currencySetting === undefined || isBaseCurrency(currencySetting) || defaultLevel === undefined) { + return amount; + } + + return defaultLevel.value * currencySetting.exchangeRate; +} diff --git a/src/DonationForms/resources/styles/components/_amount.scss b/src/DonationForms/resources/styles/components/_amount.scss index 8b7c9d094d..f75ba6efbe 100644 --- a/src/DonationForms/resources/styles/components/_amount.scss +++ b/src/DonationForms/resources/styles/components/_amount.scss @@ -114,15 +114,55 @@ $borderColor: #9A9A9A; &__levels-container { display: grid; - grid-auto-rows: 1fr; - grid-template-columns: repeat(2, 1fr); gap: var(--givewp-spacing-2); + grid-template-rows: repeat(2, 1fr); inline-size: 100%; list-style: none; @media screen and (min-width: variables.$givewp-breakpoint-sm) { grid-template-columns: repeat(3, 1fr); } + + &--has-descriptions { + display: flex; + flex-wrap: wrap; + } + + .givewp-fields-amount__level-container { + display: flex; + align-items: start; + flex: 1; + gap: var(--givewp-spacing-4); + min-width: calc((100% - var(--givewp-spacing-2)) / 2); + + @media screen and (min-width: variables.$givewp-breakpoint-sm) { + min-width: calc((100% - var(--givewp-spacing-2) * 2) / 3); + } + + &--col { + flex-basis: 100%; + padding-bottom: var(--givewp-spacing-2); + } + ; + + .givewp-fields-amount__level { + &--description { + flex-basis: 110px; + + @media screen and (min-width: variables.$givewp-breakpoint-sm) { + flex-basis: 144px; + } + } + } + + .givewp-fields-amount__level__description { + align-items: center; + color: var(--givewp-grey-700); + display: flex; + flex: 1; + min-height: 100%; + } + } } &__level { diff --git a/src/FormBuilder/Actions/GenerateDefaultDonationFormBlockCollection.php b/src/FormBuilder/Actions/GenerateDefaultDonationFormBlockCollection.php index 752c11e758..a03c6dfeb4 100644 --- a/src/FormBuilder/Actions/GenerateDefaultDonationFormBlockCollection.php +++ b/src/FormBuilder/Actions/GenerateDefaultDonationFormBlockCollection.php @@ -67,14 +67,13 @@ protected function createAmountBlock(): BlockModel 'attributes' => [ "label" => __("Donation Amount", 'give'), "levels" => [ - 10, - 25, - 50, - 100, - 250, - 500 + ['value' => 10, 'checked' => true], + ['value' => 25], + ['value' => 50], + ['value' => 100], + ['value' => 250], + ['value' => 500], ], - "defaultLevel" => 10, "priceOption" => "multi", "setPrice" => 25, "customAmount" => true, diff --git a/src/FormBuilder/BlockModels/DonationAmountBlockModel.php b/src/FormBuilder/BlockModels/DonationAmountBlockModel.php index 22ac74d90d..0efb652206 100644 --- a/src/FormBuilder/BlockModels/DonationAmountBlockModel.php +++ b/src/FormBuilder/BlockModels/DonationAmountBlockModel.php @@ -60,23 +60,32 @@ public function getLabel(): string } /** + * @unreleased Changed the return type to an array of OptionsProps * @since 3.0.0 * - * @return float[] + * @return array ['label' => string, 'value' => string, 'checked' => bool][] */ public function getLevels(): array { - return array_map(static function($level) { - return (float)filter_var($level, FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); + return array_map(static function ($level) { + return [ + 'label' => htmlspecialchars($level['label'] ?? ''), + 'value' => (float)filter_var( + $level['value'] ?? '', + FILTER_SANITIZE_NUMBER_FLOAT, + FILTER_FLAG_ALLOW_FRACTION + ), + 'checked' => (bool)filter_var($level['checked'] ?? false, FILTER_VALIDATE_BOOLEAN), + ]; }, $this->block->getAttribute('levels')); } /** - * @since 3.0.0 + * @unreleased */ - public function getDefaultLevel(): ?float + public function isDescriptionEnabled(): bool { - return (float)filter_var($this->block->getAttribute('defaultLevel'), FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); + return $this->block->getAttribute('descriptionsEnabled') === true; } /** diff --git a/src/FormBuilder/BlockTypes/DonationAmountBlockType.php b/src/FormBuilder/BlockTypes/DonationAmountBlockType.php index 422428ab14..3c71a6c69e 100644 --- a/src/FormBuilder/BlockTypes/DonationAmountBlockType.php +++ b/src/FormBuilder/BlockTypes/DonationAmountBlockType.php @@ -54,15 +54,20 @@ public static function name(): string ]; /** + * @unreleased Update levels array schema. * @since 3.8.0 * * @return float[] */ public function getLevels(): array { - return array_map(static function ($level) { - return (float)filter_var($level, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); - }, $this->levels); + return array_map(static function($level) { + return [ + 'label' => (string)filter_var($level['label'] ?? '', FILTER_SANITIZE_STRING), + 'value' => (float)filter_var($level['value'] ?? '', FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION), + 'checked' => (bool)filter_var($level['checked'] ?? false, FILTER_VALIDATE_BOOLEAN), + ]; + }, $this->block->getAttribute('levels')); } /** diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks.json b/src/FormBuilder/resources/js/form-builder/src/blocks.json index c9ab2d63ea..352d1d69c8 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks.json +++ b/src/FormBuilder/resources/js/form-builder/src/blocks.json @@ -15,14 +15,26 @@ "attributes": { "label": "Donation Amount", "levels": [ - 10, - 25, - 50, - 100, - 250, - 500 + { + "value": 10, + "checked": true + }, + { + "value": 25 + }, + { + "value": 50 + }, + { + "value": 100 + }, + { + "value": 250 + }, + { + "value": 500 + } ], - "defaultLevel": 10, "priceOption": "multi", "setPrice": 25, "customAmount": true, diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/Edit.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/Edit.tsx index 21786950f5..aa9a10fc5b 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/Edit.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/Edit.tsx @@ -10,21 +10,39 @@ import {OneTimeAmountMessage, RecurringAmountMessage} from '@givewp/forms/shared import Notice from './notice'; import {getFormBuilderWindowData} from '@givewp/form-builder/common/getWindowData'; import {DonationAmountAttributes} from '@givewp/form-builder/blocks/fields/amount/types'; - -const DonationLevels = ({levels, defaultLevel}: {levels: DonationAmountAttributes['levels']; defaultLevel: DonationAmountAttributes['defaultLevel']}) => ( - +import cx from 'classnames'; + +const DonationLevels = ({ + levels, + descriptionsEnabled, +}: { + levels: DonationAmountAttributes['levels']; + descriptionsEnabled: DonationAmountAttributes['descriptionsEnabled']; +}) => ( + {levels.map((level, index) => { - const levelAmount = formatCurrencyAmount(level.toString()); + const levelAmount = formatCurrencyAmount(level?.value?.toString()); return ( - - {levelAmount} + + + {levelAmount} + + + {descriptionsEnabled && ( + + {level.label ? level.label : __('Description goes here', 'give')} + + )} ); })} ); - const CustomAmount = ({amount}: {amount: DonationAmountAttributes['setPrice']}) => ( ); @@ -57,7 +75,6 @@ const Edit = ({attributes, setAttributes}) => { const { label = __('Donation Amount', 'give'), levels, - defaultLevel, priceOption, setPrice, customAmount, @@ -67,6 +84,7 @@ const Edit = ({attributes, setAttributes}) => { recurringLengthOfTime, recurringOptInDefaultBillingPeriod, recurringEnableOneTimeDonations, + descriptionsEnabled, } = attributes as DonationAmountAttributes; const {gateways} = getFormBuilderWindowData(); @@ -102,7 +120,12 @@ const Edit = ({attributes, setAttributes}) => { /> )} - {isMultiLevel && } + {isMultiLevel && ( + + )} {customAmount && } diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/donation-type-control.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/donation-type-control.tsx new file mode 100644 index 0000000000..f591d2b76f --- /dev/null +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/donation-type-control.tsx @@ -0,0 +1,39 @@ +import {__} from '@wordpress/i18n'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOption as ToggleGroupControlOption, +} from '@wordpress/components'; + +type DonationTypeControlProps = { + priceOption: string; + setAttributes: any; + attributes: any; +}; + +/** + * @unreleased + */ + +export default function DonationTypeControl({priceOption, setAttributes, attributes}: DonationTypeControlProps) { + const handleTypeChange = (value: string) => { + setAttributes({priceOption: value}); + }; + + return ( + + + + + ); +} diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/index.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/index.tsx index 848c11061c..c974664e2b 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/index.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/inspector/index.tsx @@ -9,16 +9,17 @@ import { } from '@wordpress/components'; import {__, sprintf} from '@wordpress/i18n'; import {InspectorControls} from '@wordpress/block-editor'; -import {CurrencyControl, formatCurrencyAmount} from '@givewp/form-builder/components/CurrencyControl'; +import {CurrencyControl} from '@givewp/form-builder/components/CurrencyControl'; import periodLookup from '../period-lookup'; import RecurringDonationsPromo from '@givewp/form-builder/promos/recurring-donations'; import {getFormBuilderWindowData} from '@givewp/form-builder/common/getWindowData'; -import {useCallback, useState} from '@wordpress/element'; -import {OptionsPanel} from '@givewp/form-builder-library'; +import {useCallback} from '@wordpress/element'; import type {OptionProps} from '@givewp/form-builder-library/build/OptionsPanel/types'; -import {useEffect} from 'react'; +import {useEffect, useState} from 'react'; import {DonationAmountAttributes} from '@givewp/form-builder/blocks/fields/amount/types'; import {subscriptionPeriod} from '@givewp/forms/registrars/templates/groups/DonationAmount/subscriptionPeriod'; +import {OptionsPanel} from '@givewp/form-builder-library'; +import DonationTypeControl from '@givewp/form-builder/blocks/fields/amount/inspector/donation-type-control'; const compareBillingPeriods = (val1: string, val2: string): number => { const index1 = Object.keys(periodLookup).indexOf(val1); @@ -56,11 +57,15 @@ const numberOfDonationsControlOptions = [{label: __('Ongoing', 'give'), value: ' })) ); +/** + * @unreleased add description fields to levels. + * @since 3.0.0 + */ const Inspector = ({attributes, setAttributes}) => { const { label = __('Donation Amount', 'give'), levels, - defaultLevel, + descriptionsEnabled = false, priceOption, setPrice, customAmount, @@ -118,21 +123,20 @@ const Inspector = ({attributes, setAttributes}) => { const recurringGateways = gateways.filter((gateway) => gateway.supportsSubscriptions); const isRecurringSupported = enabledGateways.some((gateway) => gateway.supportsSubscriptions); const isRecurring = isRecurringSupported && recurringEnabled; - const [donationLevels, setDonationLevels] = useState( levels.map((level) => ({ + ...level, id: String(Math.floor(Math.random() * 1000000)), - label: formatCurrencyAmount(level.toString()), - value: level.toString(), - checked: defaultLevel === level, + value: level?.value.toString() ?? '', })) ); const handleLevelAdded = () => { - const newLevelValue = levels.length ? String(Math.max(...levels) * 2) : '10'; + const levelValues = levels.map((level) => Number(level.value)); + const newLevelValue = levelValues.length ? String(Math.max(...levelValues) * 2) : '10'; const newLevel = { id: String(Math.floor(Math.random() * 1000000)), - label: formatCurrencyAmount(newLevelValue), + label: '', value: newLevelValue, checked: false, }; @@ -140,32 +144,35 @@ const Inspector = ({attributes, setAttributes}) => { // If there are no levels, set the new level as the default. if (!levels.length) { newLevel.checked = true; - setAttributes({defaultLevel: Number(newLevelValue)}); } setDonationLevels([...donationLevels, newLevel]); - setAttributes({levels: [...levels, Number(newLevelValue)]}); + setAttributes({levels: [...levels, newLevel]}); }; const handleLevelRemoved = (level: OptionProps, index: number) => { const newLevels = levels.filter((_, i) => i !== index); - const newDonationLevels = donationLevels.filter((_, i) => i !== index); - if (level.checked && newDonationLevels.length > 0) { - newDonationLevels[0].checked = true; - setAttributes({defaultLevel: Number(newDonationLevels[0].value)}); + if (level.checked && newLevels.length > 0) { + newLevels[0].checked = true; } - setDonationLevels(newDonationLevels); + setDonationLevels(newLevels); setAttributes({levels: newLevels}); }; const handleLevelsChange = (options: OptionProps[]) => { - const checkedLevel = options.filter((option) => option.checked); - const newLevels = options.filter((option) => option.value).map((option) => Number(option.value)); + const newLevels = options + .filter((option) => option.value) + .map((option) => ({ + ...option, + value: Number(option.value), + })); setDonationLevels(options); - setAttributes({levels: newLevels, defaultLevel: Number(checkedLevel[0].value)}); + setAttributes({ + levels: newLevels, + }); }; const getDefaultBillingPeriodOptions = useCallback( @@ -198,27 +205,29 @@ const Inspector = ({attributes, setAttributes}) => { - setAttributes({priceOption})} - value={priceOption} - options={[ - {label: __('Multi-level Donation', 'give'), value: 'multi'}, - {label: __('Fixed Donation', 'give'), value: 'set'}, - ]} - help={ - 'multi' === priceOption - ? __('Set multiple price donations for this form.', 'give') - : __('The donation amount is fixed to the following amount:', 'give') - } - /> - {priceOption === 'set' && ( + + + {priceOption === 'set' ? ( !setPrice && setAttributes({setPrice: 25})} onValueChange={(setPrice) => setAttributes({setPrice: setPrice ? parseInt(setPrice) : 0})} /> + ) : ( + setAttributes({descriptionsEnabled: value})} + maxLabelLength={120} + /> )} @@ -248,20 +257,6 @@ const Inspector = ({attributes, setAttributes}) => { )} - {priceOption === 'multi' && ( - - - - )} - {!isRecurringSupported && (recurringAddonData.isInstalled ? ( diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-buttons.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-buttons.tsx index 1e3ecc6ff9..2e4c9b2fcb 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-buttons.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-buttons.tsx @@ -1,9 +1,10 @@ import cx from 'classnames'; -const LevelButton = ({selected, children}) => { +const LevelButton = ({selected, children, descriptionsEnabled}) => { const classes = cx({ 'give-donation-block__level': true, 'give-donation-block__level--selected': selected, + 'give-donation-block__level--descriptions': descriptionsEnabled, }); return
{children}
; diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-grid.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-grid.tsx index 7b953420b2..d2200d5bd2 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-grid.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/level-grid.tsx @@ -1,5 +1,11 @@ -const LevelGrid = ({children}) => { - return
{children}
; +import cx from 'classnames'; + +const LevelGrid = ({children, descriptionsEnabled}) => { + const classes = cx({ + 'give-donation-block__levels': true, + 'give-donation-block__levels--descriptions': descriptionsEnabled, + }); + return
{children}
; }; export default LevelGrid; diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/settings.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/settings.tsx index b27bfb9e20..f1e74c51d0 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/settings.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/settings.tsx @@ -18,7 +18,6 @@ const { setPrice, priceOption, levels, - defaultLevel, } = getDefaultBlockAttributes('givewp/donation-amount'); const settings: FieldBlock['settings'] = { @@ -39,10 +38,6 @@ const settings: FieldBlock['settings'] = { type: 'array', default: levels, }, - defaultLevel: { - type: 'number', - default: defaultLevel, - }, priceOption: { type: 'string', default: priceOption, diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/types.ts b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/types.ts index 2a0d945172..ad84d2f89a 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/types.ts +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/fields/amount/types.ts @@ -1,9 +1,10 @@ -import type {subscriptionPeriod} from "@givewp/forms/registrars/templates/groups/DonationAmount/subscriptionPeriod"; +import {OptionProps} from '@givewp/form-builder-library/build/OptionsPanel/types'; +import type {subscriptionPeriod} from '@givewp/forms/registrars/templates/groups/DonationAmount/subscriptionPeriod'; export interface DonationAmountAttributes { label: string; - levels: number[]; - defaultLevel: number; + levels: OptionProps[]; + descriptionsEnabled: boolean; priceOption: string; setPrice: number; customAmount: boolean; @@ -14,5 +15,5 @@ export interface DonationAmountAttributes { recurringBillingPeriodOptions: subscriptionPeriod[]; recurringLengthOfTime: string; recurringOptInDefaultBillingPeriod: subscriptionPeriod | 'one-time'; - recurringEnableOneTimeDonations: boolean -} \ No newline at end of file + recurringEnableOneTimeDonations: boolean; +} diff --git a/src/FormBuilder/resources/js/form-builder/src/styles/_blocks.scss b/src/FormBuilder/resources/js/form-builder/src/styles/_blocks.scss index b290f62699..1946f9da5d 100644 --- a/src/FormBuilder/resources/js/form-builder/src/styles/_blocks.scss +++ b/src/FormBuilder/resources/js/form-builder/src/styles/_blocks.scss @@ -12,6 +12,10 @@ grid-template-columns: repeat(3, 1fr); gap: var(--givewp-spacing-4); text-align: center; + + &--descriptions { + grid-template-columns: 1fr; + } } &__level { @@ -22,6 +26,26 @@ background-color: var(--givewp-neutral-70); cursor: pointer; + &__label { + flex: 1; + text-align: left; + } + + &__amount { + display: flex; + justify-content: flex-start; + align-items: center; + width: 112px; + } + + &--descriptions { + display: flex; + justify-content: space-between; + font-size: 16px; + font-weight: 500; + line-height: 1.5; + } + &--selected { background-color: var(--givewp-neutral-90); color: var(--givewp-shades-white); diff --git a/src/FormMigration/Steps/DonationOptions.php b/src/FormMigration/Steps/DonationOptions.php index 2318f63e48..97b691131e 100644 --- a/src/FormMigration/Steps/DonationOptions.php +++ b/src/FormMigration/Steps/DonationOptions.php @@ -3,11 +3,13 @@ namespace Give\FormMigration\Steps; use Give\FormMigration\Contracts\FormMigrationStep; +use Give\Framework\Blocks\BlockModel; class DonationOptions extends FormMigrationStep { public function process() { + /** @var BlockModel $amountField */ $amountField = $this->fieldBlocks->findByName('givewp/donation-amount'); $priceOption = $this->getMetaV2('_give_price_option'); @@ -20,9 +22,20 @@ public function process() if('multi' === $priceOption) { // @note $formV2->levels only returns a single level $donationLevels = $this->getMetaV2('_give_donation_levels'); - // @note No corresponding setting in v3 for `_give_text` for Donation Levels. + + $isDescriptionEnabled = false; $amountField->setAttribute('levels', - array_map([$this, 'roundAmount'], wp_list_pluck($donationLevels, '_give_amount'))); + array_map(function ($donationLevel) use (&$isDescriptionEnabled) { + $isDescriptionEnabled = $isDescriptionEnabled || ! empty($donationLevel['_give_text']); + + return [ + 'value' => $this->roundAmount($donationLevel['_give_amount']), + 'label' => $donationLevel['_give_text'], + 'checked' => isset($donationLevel['_give_default']) && $donationLevel['_give_default'] === 'default', + ]; + }, $donationLevels) + ); + $amountField->setAttribute('descriptionsEnabled', $isDescriptionEnabled); } $isCustomAmountEnabled = $this->formV2->isCustomAmountOptionEnabled(); diff --git a/src/Framework/FieldsAPI/Amount.php b/src/Framework/FieldsAPI/Amount.php index bbdc891ea4..caa6e38daf 100644 --- a/src/Framework/FieldsAPI/Amount.php +++ b/src/Framework/FieldsAPI/Amount.php @@ -13,7 +13,7 @@ class Amount extends Field const TYPE = 'amount'; /** - * @var int[] + * @var array ['label' => string, 'value' => int, 'checked' => bool] */ protected $levels = []; /** @@ -36,11 +36,12 @@ class Amount extends Field protected $fixedAmountValue; /** - * Set the preset donation levels. Provide levels in minor units. + * Set the preset donation levels. Provide level amounts in minor units. * + * @unreleased Changed to receive an array as a parameter. * @since 3.0.0 */ - public function levels(float ...$levels): self + public function levels(array ...$levels): self { $this->levels = $levels; diff --git a/tests/Feature/FormMigration/Steps/TestDonationOptions.php b/tests/Feature/FormMigration/Steps/TestDonationOptions.php index 59a0315d17..d79e9c1548 100644 --- a/tests/Feature/FormMigration/Steps/TestDonationOptions.php +++ b/tests/Feature/FormMigration/Steps/TestDonationOptions.php @@ -47,6 +47,7 @@ public function testProcessShouldUpdateDonationAmountBlockAttributes(): void } /** + * @unreleased Updated test to include donation levels with descriptions * @since 3.4.0 */ public function testProcessShouldUpdateDonationAmountBlockAttributesWithDonationLevels(): void @@ -67,7 +68,29 @@ public function testProcessShouldUpdateDonationAmountBlockAttributesWithDonation $block = $payload->formV3->blocks->findByName('givewp/donation-amount'); - $this->assertSame([10.00, 25.00, 50.00, 100.00], $block->getAttribute('levels')); + $expectedLevels = [ + [ + 'value' => 10.00, + 'label' => 'Small Gift', + 'checked' => false, + ], + [ + 'value' => 25.00, + 'label' => 'Mid-size Gift', + 'checked' => true, + ], + [ + 'value' => 50.00, + 'label' => 'Large Gift', + 'checked' => false, + ], + [ + 'value' => 100.00, + 'label' => 'Big Gift', + 'checked' => false, + ], + ]; + $this->assertSame($expectedLevels, $block->getAttribute('levels')); $this->assertTrue($block->getAttribute('customAmount')); $this->assertSame((float)$meta['_give_custom_amount_range_minimum'], $block->getAttribute('customAmountMin')); $this->assertSame((float)$meta['_give_custom_amount_range_maximum'], $block->getAttribute('customAmountMax')); diff --git a/tests/Unit/Actions/GenerateDefaultDonationFormBlockCollectionTest.php b/tests/Unit/Actions/GenerateDefaultDonationFormBlockCollectionTest.php index 76b519690c..17112e7cd8 100644 --- a/tests/Unit/Actions/GenerateDefaultDonationFormBlockCollectionTest.php +++ b/tests/Unit/Actions/GenerateDefaultDonationFormBlockCollectionTest.php @@ -37,14 +37,13 @@ public function testShouldIncludeDefaultDonationAmountBlock(): void [ "label" => __("Donation Amount", 'give'), "levels" => [ - 10, - 25, - 50, - 100, - 250, - 500 + ['value' => 10, 'checked' => true], + ['value' => 25], + ['value' => 50], + ['value' => 100], + ['value' => 250], + ['value' => 500], ], - "defaultLevel" => 10, "priceOption" => "multi", "setPrice" => 25, "customAmount" => true, @@ -137,4 +136,4 @@ public function testShouldIncludeDefaultPaymentGatewaysBlock(): void $this->assertEquals([], $block->getAttributes()); } -} \ No newline at end of file +} diff --git a/tests/Unit/DataTransferObjects/DonateFormRouteDataTest.php b/tests/Unit/DataTransferObjects/DonateFormRouteDataTest.php index becf5d5f5a..c7466ef474 100644 --- a/tests/Unit/DataTransferObjects/DonateFormRouteDataTest.php +++ b/tests/Unit/DataTransferObjects/DonateFormRouteDataTest.php @@ -140,14 +140,13 @@ public function testValidatedShouldReturnValidatedDataWithSubscriptionData() "attributes": { "label": "Donation Amount", "levels": [ - "10", - "25", - "50", - "100", - "250", - "500" + {"value": "10"}, + {"value": "25"}, + {"value": "50"}, + {"value": "100", "checked": true}, + {"value": "250"}, + {"value": "500"} ], - "defaultLevel": "100", "priceOption": "multi", "setPrice": "100", "customAmount": "true", diff --git a/tests/Unit/DataTransferObjects/ValidationRouteDataTest.php b/tests/Unit/DataTransferObjects/ValidationRouteDataTest.php index c1102f3c70..84ebbf3a64 100644 --- a/tests/Unit/DataTransferObjects/ValidationRouteDataTest.php +++ b/tests/Unit/DataTransferObjects/ValidationRouteDataTest.php @@ -154,12 +154,12 @@ public function testValidateShouldReturnTrueWithRecurringOptions() "attributes": { "label": "Donation Amount", "levels": [ - "10", - "25", - "50", - "100", - "250", - "500" + {"value": "10"}, + {"value": "25"}, + {"value": "50"}, + {"value": "100"}, + {"value": "250"}, + {"value": "500"} ], "priceOption": "multi", "setPrice": "100", diff --git a/tests/Unit/DonationForms/Actions/StoreBackwardsCompatibleFormMetaTest.php b/tests/Unit/DonationForms/Actions/StoreBackwardsCompatibleFormMetaTest.php index 562de4aa64..3660eaa473 100644 --- a/tests/Unit/DonationForms/Actions/StoreBackwardsCompatibleFormMetaTest.php +++ b/tests/Unit/DonationForms/Actions/StoreBackwardsCompatibleFormMetaTest.php @@ -82,7 +82,14 @@ public function testRecurringMetaIsStoredOnUpdate() 'isValid' => true, 'attributes' => [ 'label' => 'Donation Amount', - 'levels' => ['10', '25', '50', '100', '250', '500'], + 'levels' => [ + ['value' => '10'], + ['value' => '25'], + ['value' => '50'], + ['value' => '100'], + ['value' => '250'], + ['value' => '500'], + ], 'priceOption' => 'multi', 'setPrice' => '25', 'customAmount' => 'true', @@ -131,7 +138,14 @@ public function testRecurringMetaIsStoredOnInsert() 'isValid' => true, 'attributes' => [ 'label' => 'Donation Amount', - 'levels' => ['10', '25', '50', '100', '250', '500'], + 'levels' => [ + ['value' => '10'], + ['value' => '25'], + ['value' => '50'], + ['value' => '100'], + ['value' => '250'], + ['value' => '500'], + ], 'priceOption' => 'multi', 'setPrice' => '25', 'customAmount' => 'true', diff --git a/tests/Unit/DonationForms/Migrations/UpdateDonationLevelsSchemaTest.php b/tests/Unit/DonationForms/Migrations/UpdateDonationLevelsSchemaTest.php new file mode 100644 index 0000000000..08fc31cbeb --- /dev/null +++ b/tests/Unit/DonationForms/Migrations/UpdateDonationLevelsSchemaTest.php @@ -0,0 +1,46 @@ +findByName('givewp/donation-amount') + ->setAttribute('levels', ['10', '25', '50', '100', '250', '500']) + ->setAttribute('defaultLevel', '100'); + + $form = DonationForm::factory()->create([ + 'blocks' => $blockCollection, + ]); + + // Act + $migration = new UpdateDonationLevelsSchema(); + $migration->run(); + + // Assert + $form = DonationForm::find($form->id); + $block = $form->blocks->findByName('givewp/donation-amount'); + + $this->assertIsArray($block->getAttribute('levels')); + $this->assertEquals([ + ['label' => '', 'value' => '10', 'checked' => false], + ['label' => '', 'value' => '25', 'checked' => false], + ['label' => '', 'value' => '50', 'checked' => false], + ['label' => '', 'value' => '100', 'checked' => true], + ['label' => '', 'value' => '250', 'checked' => false], + ['label' => '', 'value' => '500', 'checked' => false], + ], $block->getAttribute('levels')); + } +} diff --git a/tests/Unit/FormBuilder/BlockTypes/TestDonationAmountBlockType.php b/tests/Unit/FormBuilder/BlockTypes/TestDonationAmountBlockType.php index 314340aa52..326f9787be 100644 --- a/tests/Unit/FormBuilder/BlockTypes/TestDonationAmountBlockType.php +++ b/tests/Unit/FormBuilder/BlockTypes/TestDonationAmountBlockType.php @@ -25,6 +25,7 @@ public function testGetName(): void } /** + * @unreleased Update test to use the new levels schema * @since 3.8.0 * @throws Exception */ @@ -35,14 +36,13 @@ public function testDefaultBlockModelAttributesMatchBlockTypeProperties(): void $this->assertSame(__("Donation Amount", 'give'), $block->label); $this->assertSame([ - 10, - 25, - 50, - 100, - 250, - 500 + ['value' => 10, 'checked' => true], + ['value' => 25], + ['value' => 50], + ['value' => 100], + ['value' => 250], + ['value' => 500], ], $block->levels); - $this->assertSame(10.00, $block->defaultLevel); $this->assertSame("multi", $block->priceOption); $this->assertSame(25, $block->setPrice); $this->assertTrue($block->customAmount);