Skip to content

Commit e95fa64

Browse files
authored
3.2.0 (#13)
* setting up oauth
1 parent 10ea0d3 commit e95fa64

5 files changed

+86
-34
lines changed

CHANGELOG.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
44

55
This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
66

7+
## [3.2.0]
8+
9+
### Removed
10+
11+
- `SETTINGS_DEBUG_QM_LOG` constant.
12+
- `isDeveloperQMLogActive` method.
13+
- `setQmLogsOutput` method.
14+
15+
### Changed
16+
17+
- Typo in `getTestAliConnection` method to `getTestApiConnection`.
18+
19+
### Added
20+
21+
- `getOauthConnection` method.
22+
- `NotionBuilder` icon.
23+
724
## [3.1.3]
825

926
### Removed
@@ -354,7 +371,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
354371

355372
- Initial production release.
356373

357-
[3.1.3]: https://github.com/infinum/eightshift-forms-utils/compare/3.1.2...3.1.3
374+
[3.2.0]: https://github.com/infinum/eightshift-forms-utils/compare/3.1.3...3.2.0
358375
[3.1.2]: https://github.com/infinum/eightshift-forms-utils/compare/3.1.1...3.1.2
359376
[3.1.1]: https://github.com/infinum/eightshift-forms-utils/compare/3.1.0...3.1.1
360377
[3.1.0]: https://github.com/infinum/eightshift-forms-utils/compare/3.0.18...3.1.0

src/Config/UtilsConfig.php

-7
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,6 @@ class UtilsConfig
246246
*/
247247
public const SETTINGS_DEBUG_DEVELOPER_MODE_KEY = 'developer-mode';
248248

249-
/**
250-
* Debug settings name - skip Query Monitor plugin log mode.
251-
*
252-
* @var string
253-
*/
254-
public const SETTINGS_DEBUG_QM_LOG = 'skip-qm-log';
255-
256249
// ------------------------------------------------------------------
257250
// SETTINGS TYPES
258251
// ------------------------------------------------------------------

src/Helpers/UtilsDeveloperHelper.php

-24
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,4 @@ public static function isDeveloperModeActive(): bool
8686
{
8787
return \apply_filters(UtilsConfig::FILTER_SETTINGS_IS_DEBUG_ACTIVE, false, UtilsConfig::SETTINGS_DEBUG_DEVELOPER_MODE_KEY);
8888
}
89-
90-
/**
91-
* Check if QA Monitor Log mode is active.
92-
*
93-
* @return boolean
94-
*/
95-
public static function isDeveloperQMLogActive(): bool
96-
{
97-
return \apply_filters(UtilsConfig::FILTER_SETTINGS_IS_DEBUG_ACTIVE, false, UtilsConfig::SETTINGS_DEBUG_QM_LOG);
98-
}
99-
100-
/**
101-
* Set and output data to output log using Query Monitor plugin.
102-
*
103-
* @param mixed $data Data to output.
104-
*
105-
* @return void
106-
*/
107-
public static function setQmLogsOutput($data = ''): void
108-
{
109-
if (\is_plugin_active('query-monitor/query-monitor.php') && UtilsDeveloperHelper::isDeveloperQMLogActive() && $data) {
110-
\do_action('qm/debug', $data); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
111-
}
112-
}
11389
}

src/Helpers/UtilsSettingsOutputHelper.php

+66-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public static function getOptionFieldWithConstant(
287287
*
288288
* @return array<string, mixed>
289289
*/
290-
public static function getTestAliConnection(string $key): array
290+
public static function getTestApiConnection(string $key): array
291291
{
292292
return [
293293
'component' => 'submit',
@@ -300,6 +300,71 @@ public static function getTestAliConnection(string $key): array
300300
];
301301
}
302302

303+
/**
304+
* Setting output for Test api connection
305+
*
306+
* @param string $url Oauth url.
307+
* @param string $tokenKey Token key.
308+
* @param string $allowKey Allow key.
309+
*
310+
* @return array<string, mixed>
311+
*/
312+
public static function getOauthConnection(string $url, string $tokenKey, string $allowKey): array
313+
{
314+
$token = UtilsSettingsHelper::getOptionValue($tokenKey);
315+
$allowIsChecked = UtilsSettingsHelper::isOptionCheckboxChecked($allowKey, $allowKey);
316+
317+
$msg = isset($_GET['oauthMsg']) ? \sanitize_text_field(\wp_unslash($_GET['oauthMsg'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
318+
319+
return [
320+
'component' => 'layout',
321+
'layoutType' => 'layout-v-stack-clean-full',
322+
'layoutContent' => [
323+
[
324+
'component' => 'checkboxes',
325+
'checkboxesFieldLabel' => '',
326+
'checkboxesName' => UtilsSettingsHelper::getOptionName($allowKey),
327+
'checkboxesContent' => [
328+
[
329+
'component' => 'checkbox',
330+
'checkboxLabel' => \__('Enable Oauth connection', 'eightshift-forms'),
331+
'checkboxHelp' => \__('Due to security reasons, the Oauth connection should be disabled unless you are actively using it to connect to the application.', 'eightshift-forms'),
332+
'checkboxIsChecked' => $allowIsChecked,
333+
'checkboxValue' => $allowKey,
334+
'checkboxSingleSubmit' => true,
335+
'checkboxAsToggle' => true,
336+
]
337+
]
338+
],
339+
$allowIsChecked ? [
340+
'component' => 'intro',
341+
'introSubtitle' => \__('Make sure you turn off the Oauth connection when the connection is created or it will turn off automatically after 5 minutes if your Cron events are set correctly. ', 'eightshift-forms'),
342+
'introIsHighlighted' => true,
343+
'introIsHighlightedImportant' => true,
344+
] : [],
345+
[
346+
'component' => 'card-inline',
347+
'cardInlineTitle' => \__('Connect with Oauth', 'eightshift-forms'),
348+
'cardInlineSubTitle' => $token ? \__('Oauth connected.', 'eightshift-forms') : \__('Oauth connection required!', 'eightshift-forms'),
349+
'cardInlineRightContent' => [
350+
[
351+
'component' => 'submit',
352+
'submitValue' => \__('Oauth Connect', 'eightshift-forms'),
353+
'submitVariant' => $token ? 'success' : 'error',
354+
'submitButtonAsLink' => true,
355+
'submitButtonAsLinkUrl' => $url,
356+
'submitIsDisabled' => $allowIsChecked ? false : true,
357+
],
358+
],
359+
],
360+
$msg ? [
361+
'component' => 'intro',
362+
'introSubtitle' => $msg,
363+
] : [],
364+
],
365+
];
366+
}
367+
303368
// --------------------------------------------------
304369
// Partials output helpers.
305370
// --------------------------------------------------

src/manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
"compute": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M4 5.5A1.5 1.5 0 0 1 5.5 4h9A1.5 1.5 0 0 1 16 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5v-9Z' stroke='currentColor' fill='none'/><path d='M7 7.75A.75.75 0 0 1 7.75 7h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1-.75-.75v-4.5Z' fill='currentColor' fill-opacity='0.3' stroke='currentColor' stroke-linejoin='round'/><path d='M7 4V1.5M10 4V1.5M13 4V1.5m-6 17V16m3 2.5V16m3 2.5V16M1.5 7H4m-2.5 3H4m-2.5 3H4m12-6h2.5M16 10h2.5M16 13h2.5' stroke='currentColor' stroke-linecap='round' fill='none'/></svg>",
113113
"dynamic": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M14.5 10 10 12.5V19l4.5-2.5V10Z' fill='currentColor' fill-opacity='0.3'/><path d='M5.209 2.886 8.674 6.99a.5.5 0 0 1 .118.323v2.813a.5.5 0 0 0 .754.43l1.212-.715a.5.5 0 0 0 .246-.43V7.323a.5.5 0 0 1 .13-.337l3.762-4.11' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' fill='none'/><path d='M15.111 2.444c0 .798-2.263 1.445-5.055 1.445C7.263 3.889 5 3.242 5 2.444 5 1.647 7.263 1 10.056 1c2.792 0 5.055.647 5.055 1.444Z' stroke='currentColor' fill='none'/><path d='m9.941 19-4.563-2.608a.75.75 0 0 1-.378-.65V9.823l4.941 2.823V19Z' fill='currentColor' fill-opacity='0.12' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/><path d='m9.94 19 4.564-2.608a.75.75 0 0 0 .378-.65V9.823L9.94 12.647V19Z' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' fill='none'/><path d='M8.664 7.73 5 9.824l4.941 2.823 4.941-2.823L11 7.605' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>",
114114
"corvus": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M4.884 10.004c-.372-4.092-2.17-3.72-3.255-3.255 1.085-1.24 3.255-3.72 5.58-1.396 2.326-4.65 8.61-3.459 11.162-2.325v3.256c-1.86-1.86-6.494-1.418-7.906.465-1.395 1.86-1.395 6.975 1.86 7.905 2.28.652 5.115-.155 6.046-.93v2.79c-2.233 2.233-6.511 1.706-8.371.93-1.55-.774-4.744-3.348-5.116-7.44Z' stroke='currentColor' stroke-linejoin='round' fill='none'/><path d='M8.605 14.19C6.67 11.356 6.589 7.368 7.209 5.352l.466-.93 1.86-1.395 1.86-.93h2.325l2.79.465c-3.166.327-5.688 2.825-6.393 4.08l-.582 3.36.93 3.721 1.86.93h3.72l2.322-.928c.002-.413.003-.6.003-.002 0 .505-.006.863-.012 1.15a7.042 7.042 0 0 1-.008.37c.089.452-1.756 1.111-3.805 1.281-2.352.097-4.319.039-5.94-2.336Z' fill='currentColor' fill-opacity='0.3'/></svg>",
115-
"paycek": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M2.733 10.688 1.5 18.5h1.54a3 3 0 0 0 2.942-2.412L6.5 13.5h5.143A6.857 6.857 0 0 0 18.5 6.643 5.143 5.143 0 0 0 13.357 1.5h-2.474a4 4 0 0 0-3.795 2.735L6.5 6H13a1.5 1.5 0 0 1 0 3H4.709a2 2 0 0 0-1.976 1.688Z' stroke='currentColor' fill='none'/><path d='M12.495 13.5c3.6-1.2 3.107-4.926 2.44-6.426l-.94 1.426-1 .5h-3c-2.8 0-3.698 2.817-3.981 4.39l6.481.11Z' fill='currentColor' fill-opacity='0.3'/></svg>"
115+
"paycek": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M2.733 10.688 1.5 18.5h1.54a3 3 0 0 0 2.942-2.412L6.5 13.5h5.143A6.857 6.857 0 0 0 18.5 6.643 5.143 5.143 0 0 0 13.357 1.5h-2.474a4 4 0 0 0-3.795 2.735L6.5 6H13a1.5 1.5 0 0 1 0 3H4.709a2 2 0 0 0-1.976 1.688Z' stroke='currentColor' fill='none'/><path d='M12.495 13.5c3.6-1.2 3.107-4.926 2.44-6.426l-.94 1.426-1 .5h-3c-2.8 0-3.698 2.817-3.981 4.39l6.481.11Z' fill='currentColor' fill-opacity='0.3'/></svg>",
116+
"nationbuilder": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path opacity='0.8' d='M6.317 2.337a8.515 8.515 0 0 0-4.606 5.77' stroke='currentColor' fill='none'/><path opacity='0.7' d='M1.711 8.108A8.574 8.574 0 0 0 3.354 15.3' stroke='currentColor' fill='none'/><path opacity='0.5' d='M10 18.5a8.484 8.484 0 0 1-6.646-3.2' stroke='currentColor' fill='none'/><path opacity='0.7' d='M10 18.5c2.696 0 5.1-1.256 6.657-3.214' stroke='currentColor' fill='none'/><path d='M16.656 15.286a8.564 8.564 0 0 0 1.632-7.178' stroke='currentColor' fill='none'/><path opacity='0.9' d='M18.289 8.108a8.516 8.516 0 0 0-4.59-5.764' stroke='currentColor' fill='none'/><path opacity='0.5' d='M6.316 2.337a8.57 8.57 0 0 1 7.382.007' stroke='currentColor' fill='none'/><path d='m9 5.5-1.5 9m5-9-1.5 9m-5-3h7.5M6.5 8H14' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>"
116117
},
117118
"enums": {
118119
"selectorsAdmin": {

0 commit comments

Comments
 (0)