Skip to content

Commit

Permalink
Merge pull request #29 from infinum/feature/minor-changes
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
MetarDev authored Nov 26, 2020
2 parents 4db7b1d + 669ad2c commit 88c9d52
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/blocks/components/select/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"js-{$component_class}",
! empty( $theme ) ? "{$component_class}__theme--{$theme}" : '',
$hide_loading ? "{$component_class}--has-loader is-loading" : '',
! empty( $is_disabled ) ? "{$component_class}--is-disabled" : '',
"{$block_class}__{$component_class}",
]);

Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/basic-captcha/basic-captcha-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/checkbox/checkbox-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
27 changes: 19 additions & 8 deletions src/blocks/custom/form/assets/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,25 @@ export class Form {
this.siteUrl = window.eightshiftForms.siteUrl;
this.internalServerErrorMessage = window.eightshiftForms.internalServerError;

this.restRouteUrls = {
buckarooIdealRestUri: `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.ideal}`,
buckarooEmandateRestUri: `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.emandate}`,
buckarooPayByEmailRestUri: `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.payByEmail}`,
mailchimpRestUri: `${this.siteUrl}${window.eightshiftForms.mailchimp.restUri}`,
dynamicsCrmRestUri: `${this.siteUrl}${window.eightshiftForms.dynamicsCrm.restUri}`,
sendEmailRestUri: `${this.siteUrl}${window.eightshiftForms.sendEmail.restUri}`,
};
this.restRouteUrls = {};

if (window.eightshiftForms.mailchimp) {
this.restRouteUrls.mailchimpRestUri = `${this.siteUrl}${window.eightshiftForms.mailchimp.restUri}`;
}

if (window.eightshiftForms.dynamicsCrm) {
this.restRouteUrls.dynamicsCrmRestUri = `${this.siteUrl}${window.eightshiftForms.dynamicsCrm.restUri}`;
}

if (window.eightshiftForms.sendEmail) {
this.restRouteUrls.sendEmailRestUri = `${this.siteUrl}${window.eightshiftForms.sendEmail.restUri}`;
}

if (window.eightshiftForms.buckaroo) {
this.restRouteUrls.buckarooIdealRestUri = `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.ideal}`;
this.restRouteUrls.buckarooEmandateRestUri = `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.emandate}`;
this.restRouteUrls.buckarooPayByEmailRestUri = `${this.siteUrl}${window.eightshiftForms.buckaroo.restUri.payByEmail}`;
}

this.formAccessibilityStatus = {
loading: window.eightshiftForms.content.formLoading,
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/custom/form/components/form-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ export const FormOptions = (props) => {
isBuckarooUsed,
isMailchimpUsed,
dynamicsCrm = [],
mailchimp: {
audiences,
},
mailchimp = {},
} = window.eightshiftForms;

const audiences = (mailchimp && mailchimp.audiences) ? mailchimp.audiences : [];

const themeAsOptions = hasThemes ? themes.map((tempTheme) => ({ label: tempTheme, value: tempTheme })) : [];

let crmEntitiesAsOptions = [];
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/form/form-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/forms/forms-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/input/input-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
3 changes: 3 additions & 0 deletions src/blocks/custom/input/input.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
$block_classes = Components::classnames([
$block_class,
"js-{$block_class}",
! empty( $is_required ) ? "{$block_class}--is-required" : '',
! empty( $is_disabled ) ? "{$block_class}--is-disabled" : '',
! empty( $is_read_only ) ? "{$block_class}--is-read-only" : '',
]);

$wrapper_classes = Components::classnames([
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/radio-item/radio-item-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/radio/radio-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/select-option/select-option-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/select/select-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/submit/submit-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
1 change: 1 addition & 0 deletions src/blocks/custom/submit/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$block_classes = Components::classnames([
$block_class,
! empty( $theme ) ? "{$block_class}__theme--{$theme}" : '',
! empty( $is_disabled ) ? "{$block_class}--is-disabled" : '',
]);
?>

Expand Down
4 changes: 4 additions & 0 deletions src/blocks/custom/textarea/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"cols": {
"type": "string"
},
"isRequired": {
"type": "bool",
"default": false
},
"isDisabled": {
"type": "bool",
"default": false
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/custom/textarea/textarea-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { InspectorControls } from '@wordpress/block-editor';

import { getActions } from '@eightshift/frontend-libs/scripts/editor';
import manifest from './manifest.json';
Expand Down
5 changes: 5 additions & 0 deletions src/blocks/custom/textarea/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
$rows = $attributes['rows'] ?? '';
$cols = $attributes['cols'] ?? '';
$theme = $attributes['theme'] ?? '';
$is_required = isset( $attributes['isRequired'] ) && $attributes['isRequired'] ? 'required' : '';
$is_disabled = isset( $attributes['isDisabled'] ) && $attributes['isDisabled'] ? 'disabled' : '';
$is_read_only = isset( $attributes['isReadOnly'] ) && $attributes['isReadOnly'] ? 'readonly' : '';
$prevent_sending = isset( $attributes['preventSending'] ) && $attributes['preventSending'] ? 'data-do-not-send' : '';

$block_classes = Components::classnames([
$block_class,
! empty( $theme ) ? "{$block_class}__theme--{$theme}" : '',
! empty( $is_required ) ? "{$block_class}--is-required" : '',
! empty( $is_disabled ) ? "{$block_class}--is-disabled" : '',
! empty( $is_read_only ) ? "{$block_class}--is-read-only" : '',
]);

?>
Expand All @@ -49,6 +53,7 @@ class="<?php echo esc_attr( "{$classes} {$block_class}__textarea" ); ?>"
value="<?php echo esc_attr( $value ); ?>"
rows="<?php echo esc_attr( $rows ); ?>"
cols="<?php echo esc_attr( $cols ); ?>"
<?php echo esc_attr( $is_required ); ?>
<?php echo esc_attr( $is_disabled ); ?>
<?php echo esc_attr( $is_read_only ); ?>
<?php echo esc_attr( $prevent_sending ); ?>
Expand Down
20 changes: 20 additions & 0 deletions src/integrations/buckaroo/class-response.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class Response {
const EMANDATE_ID_PARAM = 'BRQ_SERVICE_EMANDATE_MANDATEID';
const EMANDATE_REFERENCE_ID_PARAM = 'BRQ_SERVICE_EMANDATE_REFERENCE';
const EMANDATE_BANK_ID_PARAM = 'BRQ_SERVICE_EMANDATE_BANKID';
const EMANDATE_IBAN_PARAM = 'BRQ_SERVICE_EMANDATE_IBAN';
const IDEAL_BANK_NAME_PARAM = 'BRQ_SERVICE_IDEAL_CONSUMERISSUER';
const IDEAL_BANK_ID_PARAM = 'BRQ_SERVICE_IDEAL_CONSUMERBIC';
const IDEAL_PAYMENT_AMOUNT_PARAM = 'BRQ_AMOUNT';
const IDEAL_PAYMENT_ID_PARAM = 'BRQ_PAYMENT';
const IDEAL_INVOICE_NUMBER_PARAM = 'BRQ_INVOICENUMBER';
const IDEAL_IBAN_PARAM = 'BRQ_SERVICE_IDEAL_CONSUMERIBAN';
const MOCK_PAY_BY_EMAIL_PARAM = 'BRQ_MOCK_SERVICE';

/**
Expand Down Expand Up @@ -68,6 +70,13 @@ class Response {
*/
private $bank_id;

/**
* Payer's IBAN.
*
* @var string
*/
private $iban;

/**
* Payer's bank name.
*
Expand Down Expand Up @@ -143,10 +152,12 @@ public function __construct( array $buckaroo_params ) {
$this->ideal_payment_amount = $buckaroo_params[ self::IDEAL_PAYMENT_AMOUNT_PARAM ] ?? '';
$this->ideal_payment_id = $buckaroo_params[ self::IDEAL_PAYMENT_ID_PARAM ] ?? '';
$this->ideal_invoice_number = $buckaroo_params[ self::IDEAL_INVOICE_NUMBER_PARAM ] ?? '';
$this->iban = $buckaroo_params[ self::IDEAL_IBAN_PARAM ] ?? '';
} elseif ( $this->is_emandate() ) {
$this->bank_id = $buckaroo_params[ self::EMANDATE_BANK_ID_PARAM ] ?? '';
$this->emandate_id = $buckaroo_params[ self::EMANDATE_ID_PARAM ] ?? '';
$this->emandate_reference_id = $buckaroo_params[ self::EMANDATE_REFERENCE_ID_PARAM ] ?? '';
$this->iban = $buckaroo_params[ self::EMANDATE_IBAN_PARAM ] ?? '';
}

$this->test = isset( $buckaroo_params[ self::TEST_PARAM ] ) ? filter_var( $buckaroo_params[ self::TEST_PARAM ], FILTER_VALIDATE_BOOL ) : false;
Expand Down Expand Up @@ -199,6 +210,15 @@ public function is_cancel(): bool {
return $this->status === self::STATUS_CODE_CANCELLED;
}

/**
* Get payer's IBAN.
*
* @return string
*/
public function get_iban() {
return $this->iban;
}

/**
* Get emandate reference ID.
*
Expand Down
6 changes: 3 additions & 3 deletions src/routes/class-mailchimp-route.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ public function route_callback( \WP_REST_Request $request ) {
}

$list_id = $params[ self::LIST_ID_PARAM ] ?? '';
$email = $params[ self::EMAIL_PARAM ] ?? '';
$email = ! empty( $params[ self::EMAIL_PARAM ] ) ? strtolower( $params[ self::EMAIL_PARAM ] ) : '';
$tags = $params[ self::TAGS_PARAM ] ?? [];
$merge_field_params = $this->unset_irrelevant_params( $params );
$response = [];

// Make sure we have the list ID
// Make sure we have the list ID.
if ( empty( $list_id ) ) {
return $this->rest_response_handler( 'mailchimp-missing-list-id' );
}

// Make sure we have an email
// Make sure we have an email.
if ( empty( $email ) ) {
return $this->rest_response_handler( 'mailchimp-missing-email' );
}
Expand Down
6 changes: 6 additions & 0 deletions src/view/class-form-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,26 @@ public static function extra_allowed_tags( $allowed_tags ): array {
$allowed_tags['input']['maxlength'] = 1;
$allowed_tags['input']['aria-labelledby'] = 1;
$allowed_tags['input']['aria-describedby'] = 1;
$allowed_tags['input']['disabled'] = 1;
$allowed_tags['textarea']['required'] = 1;
$allowed_tags['textarea']['data-do-not-send'] = 1;
$allowed_tags['textarea']['aria-labelledby'] = 1;
$allowed_tags['textarea']['aria-describedby'] = 1;
$allowed_tags['textarea']['disabled'] = 1;
$allowed_tags['textarea']['placeholder'] = 1;
$allowed_tags['select']['required'] = 1;
$allowed_tags['select']['data-do-not-send'] = 1;
$allowed_tags['select']['aria-describedby'] = 1;
$allowed_tags['select']['aria-labelledby'] = 1;
$allowed_tags['select']['disabled'] = 1;
$allowed_tags['button']['aria-label'] = 1;
$allowed_tags['button']['role'] = 1;
$allowed_tags['button']['aria-describedby'] = 1;
$allowed_tags['button']['aria-labelledby'] = 1;
$allowed_tags['button']['disabled'] = 1;
$allowed_tags['radio']['aria-describedby'] = 1;
$allowed_tags['radio']['aria-labelledby'] = 1;
$allowed_tags['radio']['disabled'] = 1;

return $allowed_tags;
}
Expand Down

0 comments on commit 88c9d52

Please sign in to comment.