Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
"use strict";

var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
  var c = arguments.length,
      r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
      d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};

Object.defineProperty(exports, "__esModule", {
  value: true
});

const mobx_1 = require("xmobx/mobx");

const exotic_1 = require("exotic");

class PaymentWithBillingAddressFormState {
  constructor() {
    this.paymentWithBillingAddress = {};

    this.handlePaymentWithBillingAddressFormBlur = () => {
      const isValidForm = this.paymentWithBillingAddress.validateForm(); // console.log('[Payment with Billing Address] hasAllValidInputs: ', isValidForm)

      if (isValidForm === true) {
        console.log('[Payment with Billing Address] onBlur serialized data', this.paymentWithBillingAddress.state.toSerialized());
      }
    };
  }

  setPaymentWithBillingAddressForm(form) {
    this.paymentWithBillingAddress = form;
    console.log('[Payment with Billing Address] setPaymentWithBillingAddressForm()', this);
  }

  toggleBillingAddress(props) {
    const checkBoxState = props.state.get('billingAddressSameasShipping');
    const isSelected = exotic_1.isSafe(checkBoxState) && checkBoxState.isSelected;

    const toList = state => exotic_1.isArray(state.inputsList) && state.inputsList;

    const inputStateList = toList(props.state);
    inputStateList.map(inputs => {
      if (inputs.name === 'billing-address') {
        inputs.isHidden = isSelected;
      }
    });
  }

}

__decorate([mobx_1.observable], PaymentWithBillingAddressFormState.prototype, "paymentWithBillingAddress", void 0);

__decorate([mobx_1.action], PaymentWithBillingAddressFormState.prototype, "setPaymentWithBillingAddressForm", null);

__decorate([mobx_1.action.bound], PaymentWithBillingAddressFormState.prototype, "handlePaymentWithBillingAddressFormBlur", void 0);

__decorate([mobx_1.action.bound], PaymentWithBillingAddressFormState.prototype, "toggleBillingAddress", null); // Object Creation


const paymentWithBillingAddressFormState = new PaymentWithBillingAddressFormState();
exports.paymentWithBillingAddressFormState = paymentWithBillingAddressFormState;
exports.default = paymentWithBillingAddressFormState; //# sourceMappingURL=state.js.map