Skip to content

Commit

Permalink
Release 4.0.6 (#436)
Browse files Browse the repository at this point in the history
* adding new conditional options for output item
  • Loading branch information
iruzevic authored Jul 15, 2024
1 parent 830866b commit 08a6bcc
Show file tree
Hide file tree
Showing 25 changed files with 441 additions and 115 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

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

## [4.0.6]

### Updated
- `Eightshift-forms-utils` to the latest version `2.0.2`.
- result output item now supports conditional logic with both single and duplicate values.

### Added
- email fallbacks now supports request IP sent from the server, the data is anonymized.
- new form setting that will hide form once it is submitted with success.
- new `esFormsROISF` shortcode that can be used inside the result output item to show the form again.

## [4.0.5]

### Updated
Expand Down Expand Up @@ -450,6 +461,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[4.0.6]: https://github.com/infinum/eightshift-forms/compare/4.0.5...4.0.6
[4.0.5]: https://github.com/infinum/eightshift-forms/compare/4.0.4...4.0.5
[4.0.4]: https://github.com/infinum/eightshift-forms/compare/4.0.3...4.0.4
[4.0.3]: https://github.com/infinum/eightshift-forms/compare/4.0.2...4.0.3
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"require": {
"php": ">=8.2",
"erusev/parsedown": "^1.7.4",
"infinum/eightshift-forms-utils": "^2.0.1"
"infinum/eightshift-forms-utils": "^2.0.2"
},
"autoload": {
"psr-4": {
Expand Down
73 changes: 37 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eightshift-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level.
* Author: WordPress team @Infinum
* Author URI: https://eightshift.com/
* Version: 4.0.5
* Version: 4.0.6
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
25 changes: 17 additions & 8 deletions src/Blocks/components/conditional-tags/assets/utils.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/**
* Conditional tags operators constants.
*
* show - show item if conditions is set, hidden by default.
* hide - hide item if conditions is set, visible by default.
*
* all - activate condition if all conditions in rules array are met.
* any - activate condition if at least one condition in rules array is met.
*
* is - is - if value is exact match.
* isn - is not - if value is not exact match.
* gt - greater than - if value is greater than.
* gte - greater/equal than - if value is greater/equal than.
* gte - greater/equal than - if value is greater/equal than.
* lt - less than - if value is less than.
* lte - less/equal than - if value is less/equal than.
* lte - less/equal than - if value is less/equal than.
* c - contains - if value contains value.
* sw - starts with - if value starts with value.
* ew - ends with - if value starts with value.
Expand All @@ -29,6 +23,21 @@ export const CONDITIONAL_TAGS_OPERATORS = {
EW: 'ew',
};

/**
* Conditional tags operators constants - extended.
*
* b - between range - if value is between two values.
* bs - between range strict - if value is between two values strict.
* bn - not between range - if value is not between two values.
* bns - not between between range strict - if value is not between two values strict.
*/
export const CONDITIONAL_TAGS_OPERATORS_EXTENDED = {
B: 'b',
BS: 'bs',
BN: 'bn',
BNS: 'bns',
};

/**
* Conditional tags actions constants.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CONDITIONAL_TAGS_ACTIONS,
CONDITIONAL_TAGS_LOGIC,
CONDITIONAL_TAGS_OPERATORS,
CONDITIONAL_TAGS_OPERATORS_EXTENDED,
} from '../assets/utils';

export const CONDITIONAL_TAGS_OPERATORS_LABELS = {
Expand All @@ -17,6 +18,13 @@ export const CONDITIONAL_TAGS_OPERATORS_LABELS = {
[CONDITIONAL_TAGS_OPERATORS.EW]: __('ends with', 'eightshift-forms'),
};

export const CONDITIONAL_TAGS_OPERATORS_EXTENDED_LABELS = {
[CONDITIONAL_TAGS_OPERATORS_EXTENDED.B]: __('in range', 'eightshift-forms'),
[CONDITIONAL_TAGS_OPERATORS_EXTENDED.BS]: __('in range (strict)', 'eightshift-forms'),
[CONDITIONAL_TAGS_OPERATORS_EXTENDED.BN]: __('not in range', 'eightshift-forms'),
[CONDITIONAL_TAGS_OPERATORS_EXTENDED.BNS]: __('not in range (strict)', 'eightshift-forms'),
};

export const CONDITIONAL_TAGS_ACTIONS_LABELS = {
[CONDITIONAL_TAGS_ACTIONS.SHOW]: __('visible', 'eightshift-forms'),
[CONDITIONAL_TAGS_ACTIONS.HIDE]: __('hidden', 'eightshift-forms'),
Expand Down
13 changes: 1 addition & 12 deletions src/Blocks/components/form/assets/conditional-tags.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
CONDITIONAL_TAGS_OPERATORS,
CONDITIONAL_TAGS_ACTIONS,
CONDITIONAL_TAGS_LOGIC,
} from '../../conditional-tags/assets/utils';
Expand All @@ -26,17 +25,7 @@ export class ConditionalTags {
this.AND = CONDITIONAL_TAGS_LOGIC.AND;

// Map all conditional logic as a object.
this.OPERATORS = {
[CONDITIONAL_TAGS_OPERATORS.IS]: (input, value) => value === input,
[CONDITIONAL_TAGS_OPERATORS.ISN]: (input, value) => value !== input,
[CONDITIONAL_TAGS_OPERATORS.GT]: (input, value) => parseFloat(String(input)) > parseFloat(String(value)),
[CONDITIONAL_TAGS_OPERATORS.GTE]: (input, value) => parseFloat(String(input)) >= parseFloat(String(value)),
[CONDITIONAL_TAGS_OPERATORS.LT]: (input, value) => parseFloat(String(input)) < parseFloat(String(value)),
[CONDITIONAL_TAGS_OPERATORS.LTE]: (input, value) => parseFloat(String(input)) <= parseFloat(String(value)),
[CONDITIONAL_TAGS_OPERATORS.C]: (input, value) => input.includes(value),
[CONDITIONAL_TAGS_OPERATORS.SW]: (input, value) => input.startsWith(value),
[CONDITIONAL_TAGS_OPERATORS.EW]: (input, value) => input.endsWith(value),
};
this.OPERATORS = this.utils.getComparator();

// Set all public methods.
this.publicMethods();
Expand Down
5 changes: 5 additions & 0 deletions src/Blocks/components/form/assets/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ export class Form {
// Set global msg.
this.utils.setGlobalMsg(formId, message, status);

// This will be changed in the next release.
if (Boolean(this.state.getStateFormElement(formId)?.getAttribute(this.state.getStateAttribute('formHideOnSuccess')))) {
this.state.getStateFormElement(formId).classList.add(this.state.getStateSelector('isHidden'));
}

// Remove local storage for prefill.
if (this.state.getStateEnrichmentIsUsed()) {
this.enrichment.deleteLocalStorage(this.state.getStateEnrichmentFormPrefillStorageName(formId));
Expand Down
Loading

0 comments on commit 08a6bcc

Please sign in to comment.