diff --git a/package-lock.json b/package-lock.json index a84e6a9..1843293 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "givewp-addon-boilerplate", "dependencies": { "@givewp/form-builder-library": "^1.3.0", "@wordpress/api-fetch": "^6.26.0", @@ -6955,13 +6956,13 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -6969,7 +6970,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -7963,9 +7964,9 @@ } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true, "engines": { "node": ">= 0.6" @@ -10347,17 +10348,17 @@ "dev": true }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -18554,9 +18555,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { "bytes": "3.1.2", @@ -22159,9 +22160,9 @@ } }, "node_modules/webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, "dependencies": { "colorette": "^2.0.10", @@ -28082,13 +28083,13 @@ "dev": true }, "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "requires": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -28096,7 +28097,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -28877,9 +28878,9 @@ } }, "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true }, "cookie-signature": { @@ -30679,17 +30680,17 @@ "dev": true }, "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -36747,9 +36748,9 @@ "dev": true }, "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "requires": { "bytes": "3.1.2", @@ -39528,9 +39529,9 @@ } }, "webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, "requires": { "colorette": "^2.0.10", diff --git a/src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php b/src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php index df62dc8..ed4728e 100644 --- a/src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php +++ b/src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php @@ -44,6 +44,7 @@ public function exports(): array 'colorSettingsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-addon-color-settings')), 'globalOptionsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=give-addon-global-settings')), 'sampleTags' => $sampleTags, + 'previewUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=givewp-form-builder')) ]; } } diff --git a/src/FormExtension/FormBuilder/resources/js/index.tsx b/src/FormExtension/FormBuilder/resources/js/index.tsx index 45897d3..e84da84 100644 --- a/src/FormExtension/FormBuilder/resources/js/index.tsx +++ b/src/FormExtension/FormBuilder/resources/js/index.tsx @@ -21,7 +21,7 @@ const addGiveAddonSettings = (settings) => { return [ ...settings, { - name: __('Give Addon Settings', 'ADDON_TEXTDOMAIN'), + name: __('Give Addon Settings Sample', 'ADDON_TEXTDOMAIN'), path: 'give-addon-settings', element: GiveAddonSettings, }, diff --git a/src/FormExtension/FormBuilder/resources/js/interfaces/IGiveAddonFormBuilder.ts b/src/FormExtension/FormBuilder/resources/js/interfaces/IGiveAddonFormBuilder.ts index 5b4b6d6..2d88bb5 100644 --- a/src/FormExtension/FormBuilder/resources/js/interfaces/IGiveAddonFormBuilder.ts +++ b/src/FormExtension/FormBuilder/resources/js/interfaces/IGiveAddonFormBuilder.ts @@ -1,17 +1,12 @@ -import {colorProps} from '../types/ColorProps.ts.off'; +import {ColorOptionProps} from '../types/ColorOptionProps'; /** * @since 1.0.0 */ export interface IGiveAddonFormBuilder { - colors: colorProps[]; + colors: ColorOptionProps[]; colorSettingsUrl: string; globalOptionsUrl: string; sampleTags: {tag: string; desc: string}[]; previewUrl: string; - - setPdfPreviewUrl: string; - customPdfPreviewUrl: string; - templatesPdfTags: string; - customPdfTags: string; } diff --git a/src/FormExtension/FormBuilder/resources/js/settings/CustomSettings/index.tsx b/src/FormExtension/FormBuilder/resources/js/settings/CustomSettings/index.tsx index 9ee156c..daa912d 100644 --- a/src/FormExtension/FormBuilder/resources/js/settings/CustomSettings/index.tsx +++ b/src/FormExtension/FormBuilder/resources/js/settings/CustomSettings/index.tsx @@ -182,7 +182,9 @@ const CustomSettings = ({addonSettings, updateAddonSettings}: customSettingsProp diff --git a/src/FormExtension/FormBuilder/resources/js/settings/index.tsx b/src/FormExtension/FormBuilder/resources/js/settings/index.tsx index 2e7fddd..1d095b8 100644 --- a/src/FormExtension/FormBuilder/resources/js/settings/index.tsx +++ b/src/FormExtension/FormBuilder/resources/js/settings/index.tsx @@ -10,9 +10,16 @@ import CustomSettings from './CustomSettings'; * @since 1.0.0 */ export default function GiveAddonSettings({settings, setSettings}) { + console.log('settings: ', settings); const addonSettings: GiveAddonSettingsProps = settings.addonSettings ?? {}; const {globalOptionsUrl} = getGiveAddonFormBuilderWindowData(); + /** + * This is just a sample demonstrating how to start a Form settings extension, but the values will NOT be updated + * because there is no "addonSettings" attribute defined in the core form settings. At this moment, there is no way + * to extend the default form settings without changing the core codebase. In the future, we can change this sample + * to support updates if a way to extend the form settings is implemented in the core. + */ const updateAddonSettings = (property: string, value: any) => { setSettings({ addonSettings: { @@ -32,7 +39,7 @@ export default function GiveAddonSettings({settings, setSettings}) { return (
+ IMPORTANT: This is just a sample demonstrating how to start a Form settings + extension, but the values will NOT be updated because there is no "addonSettings" attribute defined + in the core form settings. At this moment, there is no way to extend the default form settings + without changing the core codebase. In the future, we can change this sample to support updates if a + way to extend the form settings is implemented in the core. +
)}