import { isDemo, useSetParent } from "@saasquatch/component-boilerplate";
import { useState, withHooks } from "@saasquatch/stencil-hooks";
import { useEffect } from "@saasquatch/universal-hooks";
import { Component, Host, Prop, State, h } from "@stencil/core";
import deepmerge from "deepmerge";
import { intl } from "../../../global/global";
import { createStyleSheet } from "../../../styling/JSS";
import { getProps } from "../../../utils/utils";
import { TAX_CONTEXT_NAMESPACE } from "../data";
import { getFormMap } from "./formDefinitions";
import { mockPaymentOptions } from "./mockData";
import { BankingInfoFormView, } from "./sqm-banking-info-form-view";
import { getFormInputs, paypalFeeMap, useBankingInfoForm, } from "./useBankingInfoForm";
/**
 * @uiName Banking Information Form
 * @exampleGroup Common Components
 *
 */
export class BankingInfoForm {
  constructor() {
    this.ignored = true;
    /**
     * @uiName Setup progress
     */
    this.formStep = "Step {step} of {count}";
    /**
     * @uiName Step 4 title
     */
    this.taxAndPayouts = "Payouts";
    /**
     * Displayed at the top of the page on all set up steps.
     * @uiName Page description
     */
    this.taxAndPayoutsDescription = "Submit your tax documents and add your banking information to receive your rewards.";
    /**
     * @uiName Direct to bank payout option
     */
    this.directlyToBankAccount = "Directly to my bank account";
    /**
     * @uiName PayPal payout option
     */
    this.toPayPalAccount = "PayPal (2% processing fee capped to {feeCap})";
    /**
     * @uiName Threshold balance payment schedule option
     */
    this.paymentScheduleBalanceThreshold = "Pay me when my balance reaches a threshold";
    /**
     * @uiName Fixed day payment schedule option
     */
    this.paymentScheduleFixedDay = "Pay me on a fixed day of the month";
    /**
     * Let the participant choose what day of the month they’ll get paid
     * @uiName Payment day field label
     */
    this.paymentDaySelectLabel = "Payment Day";
    /**
     * Participant use this field to select the balance at which they want to be paid
     * @uiName Payment threshold field label
     */
    this.paymentThresholdSelectLabel = "Payment Threshold";
    /**
     * One of two payment day options
     * @uiName First of month payday option
     */
    this.paymentDayFirstOfMonthLabelText = "1st of the month";
    /**
     * Label text for the payment day select option for the fifteenth of the month
     * @uiName Fifteenth of month payday option
     */
    this.paymentDayFifteenthOfMonthLabelText = "15th of the month";
    /**
     * @uiName Payment method section header
     */
    this.paymentMethod = "Payment method";
    /**
     * @uiName Payment schedule section header
     */
    this.paymentSchedule = "Payment schedule";
    /**
     * @uiName Payment method section description
     */
    this.paymentMethodSubtext = "Payouts will be sent from our referral program provider, impact.com.";
    /**
     * Displayed to participants who choose PayPal as their payout method
     * @uiName PayPal email field label
     */
    this.payPalInputLabel = "PayPal email";
    /**
     * @uiName Bank country field label
     */
    this.bankLocationLabel = "Bank country location";
    /**
     * @uiName Beneficiary account field label
     */
    this.beneficiaryAccountNameLabel = "Account holder name";
    /**
     * @uiName Beneficiary account field description
     */
    this.beneficiaryAccountNameDescription = "The beneficiary name of your bank account. Ensure this matches the name on your tax form.";
    /**
     * @uiName Bank account type field label
     */
    this.bankAccountTypeLabel = "Bank account type";
    /**
     * @uiName Checking account option
     */
    this.checkingSelectItemLabel = "Checking";
    /**
     * @uiName Savings account options
     */
    this.savingsSelectItemLabel = "Savings";
    /**
     * @uiName Bank account number field label
     */
    this.bankAccountNumberLabel = "Bank account number";
    /**
     * @uiName IBAN field label
     */
    this.ibanLabel = "IBAN";
    /**
     * @uiName SWIFT code field label
     */
    this.swiftCodeLabel = "SWIFT code";
    /**
     * @uiName Routing code field label
     */
    this.routingCodeLabel = "{bankCountry, select, AU {BSB number} CA {Routing number} CZ {Bank code} HK {Clearing code} SG {Clearing code} US {ABA routing number} NZ {BSB number} ZA {Bank/Branch number} IN {IFSC} CNY {CNAPS} other {Routing code} }";
    /**
     * @uiName Bank name field label
     */
    this.bankNameLabel = "Bank Name";
    /**
     * @uiName Classification entity field label
     */
    this.classificationEntityLabel = "Classification Entity";
    /**
     * One of three options listed for the classification field
     * @uiName Business classification option
     */
    this.businessSelectItemLabel = "Business";
    /**
     * One of three options listed for the classification field
     * @uiName Individual classification option
     */
    this.individualSelectItemLabel = "Individual";
    /**
     * One of three options listed for the classification field
     * @uiName Foreign classification option
     */
    this.foreignSelectItemLabel = "Foreign";
    /**
     * @uiName Classification CPF field label
     */
    this.classificationCPFLabel = "Classification CPF";
    /**
     * @uiName Patronymic name field label
     */
    this.patronymicNameLabel = "Patronymic name";
    /**
     * @uiName VO code field label
     */
    this.voCodeLabel = "VO code";
    /**
     * @uiName Agency code field label
     */
    this.agencyCodeLabel = "Agency code";
    /**
     * @uiName Branch code field label
     */
    this.branchCodeLabel = "Branch code";
    /**
     * Label text for the classification input field
     * @uiName Classification field label
     */
    this.classificationLabel = "Classification";
    /**
     * @uiName Taxpayer ID field label
     */
    this.taxPayerIdLabel = "{country, select, AR {CUIT/CUIL} KR {Classification ID} other { Beneficiary INN } }";
    /**
     * @uiName Bank address field label
     */
    this.bankAddressLabel = "Bank address";
    /**
     * @uiName Bank city field label
     */
    this.bankCityLabel = "Bank city";
    /**
     * @uiName Bank province/state field label
     */
    this.bankStateLabel = "Bank province/state";
    /**
     * @uiName Bank postal code field label
     */
    this.bankPostalCodeLabel = "Bank postal code";
    /**
     * Default payment method to the participants’ bank account.
     * @uiName EFT withdrawal payment method
     */
    this.eftWithdrawalLabel = "EFT withdrawal (free)";
    /**
     * @uiName FX Wire Processing fee text
     */
    this.fxWireProcessingFeeLabel = "FX Wire (Processing Fee {currency}{defaultFxFee}.00)";
    /**
     * Placeholder text displayed in the country search dropdown
     * @uiName Country field placeholder text
     */
    this.searchForCountryText = "Search for country..";
    /**
     * Part of the alert displayed at the top of the page if the participant is already a registered partner on impact.com.
     * @uiName Participant is a partner alert title
     * @uiWidget textArea
     */
    this.isPartnerAlertHeader = "An account with this email already exists with our referral program provider, impact.com";
    /**
     * Part of the alert displayed at the top of the page if the participant is already a registered partner on impact.com.
     * @uiName Participant is a partner alert description
     * @uiWidget textArea
     */
    this.isPartnerAlertDescription = "If you don’t recognize this referral program provider or believe this is a mistake, please contact our {supportLink} or sign up for this referral program with a different email.";
    /**
     * Text for verify email dialog
     * @uiName Verify email header
     */
    this.verifyEmailHeaderText = "Verify your email";
    /**
     * @uiName Verify code widget header text
     */
    this.verifyEmailDescriptionText = "Verify your email to update your payment settings. Enter the code sent to {email} from our referral provider, impact.com.";
    /**
     * Part of the alert displayed at the top of the page.
     * @uiName Form submission error message title
     * @uiWidget textArea
     */
    this.generalErrorTitle = "There was a problem submitting your information";
    /**
     * Part of the alert displayed at the top of the page.
     * @uiName Form submission error message description
     * @uiWidget textArea
     */
    this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact our {supportLink}.";
    /**
     * Displayed under a field that is missing required information.
     * @uiName Empty form field error message
     */
    this.fieldRequiredError = "{fieldName} is required";
    /**
     * Displayed under a field when it has an invalid entry.
     * @uiName Form field error message
     */
    this.fieldInvalidError = "{fieldName} is invalid";
    /**
     * @uiName Support link text
     */
    this.supportLink = "support team";
    /**
     * @uiName Continue button label
     */
    this.continueButton = "Save";
    /**
     * Text for the back button in the form
     * @uiName Back button label
     */
    this.backButton = "Back";
    /**
     * Part of the alert displayed at the top of the page.
     * @uiName Page load error message title
     * @uiWidget textArea
     */
    this.loadingErrorAlertHeader = "There was a problem loading your form";
    /**
     * Part of the alert displayed at the top of the page.
     * @uiName Page load error message description
     * @uiWidget textArea
     */
    this.loadingErrorAlertDescription = "Please refresh the page and try again. If this problem continues, contact Support.";
    /**
     * @uiName Information modal title
     */
    this.modalTitle = "Important Note";
    /**
     * @uiName Information modal description text
     */
    this.modalDescription = "Updating payment information places your account and payouts on hold for up to 48 hours while we verify your change. Payments scheduled during the hold period are skipped.";
    /**
     * @uiName Information modal button text
     */
    this.modalButtonText = "I understand, update my information";
    withHooks(this);
  }
  disconnectedCallback() { }
  getTextProps() {
    const props = getProps(this);
    return {
      ...props,
      error: {
        generalTitle: props.generalErrorTitle,
        generalDescription: props.generalErrorDescription,
        loadingErrorAlertDescription: props.loadingErrorAlertDescription,
        loadingErrorAlertHeader: props.loadingErrorAlertHeader,
      },
    };
  }
  render() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
    const props = isDemo()
      ? useDemoBankingInfoForm(this)
      : useBankingInfoForm(this);
    const { errors } = props.states.formState;
    const fieldRequiredError = this.fieldRequiredError;
    const fieldInvalidError = this.fieldInvalidError;
    function getValidationErrorMessage({ type, label, }) {
      if (type === "required") {
        return intl.formatMessage({
          id: `requiredText-${label}`,
          defaultMessage: fieldRequiredError,
        }, {
          fieldName: label,
        });
      }
      if (type === "invalid") {
        return intl.formatMessage({
          id: `invalidText-${label}`,
          defaultMessage: fieldInvalidError,
        }, {
          fieldName: label,
        });
      }
      return "";
    }
    const formMap = getFormMap({
      props,
      getValidationErrorMessage,
      bankCountry: props.states.bankCountry,
    });
    const inputFields = getFormInputs({
      bitset: props.states.bitset,
      formMap,
    });
    const style = {
      Dialog: {
        position: "relative",
        "&::part(panel)": {
          maxWidth: "420px",
        },
        "&::part(title)": {
          padding: "var(--sl-spacing-large) var(--sl-spacing-large) 0 var(--sl-spacing-large)",
        },
        "&::part(base)": {
          position: "absolute",
        },
        "&::part(close-button)": {
          marginBottom: "var(--sl-spacing-large)",
        },
        "&::part(body)": {
          padding: "0 var(--sl-spacing-large) 0 var(--sl-spacing-large)",
          fontSize: "var(--sl-font-size-small)",
        },
        "&::part(footer)": {
          display: "flex",
          flexDirection: "column",
          gap: "var(--sl-spacing-small)",
          marginBottom: "var(--sl-spacing-xx-small)",
          alignItems: "center",
          flex: "1",
        },
      },
      SearchInput: {
        padding: "var(--sl-spacing-x-small)",
      },
    };
    const sheet = createStyleSheet(style);
    const styleString = sheet.toString();
    const verifyDescription = intl.formatMessage({
      id: "codeResentSuccessfully",
      defaultMessage: props.text.verifyEmailDescriptionText,
    }, {
      email: props.states.email,
    });
    const vanillaStyle = `
      sl-menu-item::part(base) {
      color: var(--sqm-input-color);
    }
     sl-menu-item::part(base):hover {
      background-color: var(--sqm-input-border-color-hover);
    }
    `;
    return (h(Host, null,
      h("style", { type: "text/css" }, styleString),
      h("style", { type: "text/css" }, vanillaStyle),
      props.states.isPartner && props.states.showVerification ? (h("sl-dialog", { class: sheet.classes.Dialog, open: true, "onSl-hide": props.callbacks.onVerificationHide, label: props.text.verifyEmailHeaderText },
        h("sqm-code-verification", { verifyCodeHeaderText: verifyDescription, reverifyCodeHeaderText: verifyDescription, onVerification: props.callbacks.onVerification }))) : null,
      h(BankingInfoFormView, { callbacks: props.callbacks, text: props.text, states: props.states, refs: props.refs, slots: {
          formInputsSlot: inputFields === null || inputFields === void 0 ? void 0 : inputFields.map(({ input }) => input),
          countryInputSlot: (h("sl-select", Object.assign({ label: props.text.bankLocationLabel, disabled: props.states.saveLoading, required: true, name: "/bankCountry", id: "bankCountry", value: props.states.formState.bankCountry || "", "onSl-select": (e) => { var _a, _b; return props.callbacks.setBankCountry((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.value); } }, (((_a = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _a === void 0 ? void 0 : _a.bankCountry) && {
            class: "error-input",
            helpText: getValidationErrorMessage({
              type: (_c = (_b = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _b === void 0 ? void 0 : _b.bankCountry) === null || _c === void 0 ? void 0 : _c.type,
              label: props.text.bankLocationLabel,
            }),
          })),
            h("sl-input", { disabled: props.states.saveLoading, class: sheet.classes.SearchInput, placeholder: this.searchForCountryText, onKeyDown: (e) => {
                // Stop shoelace intercepting key presses
                e.stopPropagation();
              }, "onSl-input": (e) => {
                props.callbacks.setCountrySearch(e.target.value);
              } }), (_d = props.states.countries) === null || _d === void 0 ? void 0 :
            _d.map((country) => {
              return (h("sl-menu-item", { value: country.countryCode }, country.displayName));
            }), (_f = (_e = props.states) === null || _e === void 0 ? void 0 : _e.allCountries) === null || _f === void 0 ? void 0 :
            _f.map((c) => (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName))))),
          paymentMethodSlot: (h("sl-input", { key: "paymentMethod", label: props.text.paymentMethod, placeholder: props.states.paymentMethodFeeLabel, disabled: true })),
          paymentThresholdSelectSlot: (h("sl-select", Object.assign({ required: true, disabled: props.states.saveLoading, label: props.text.paymentThresholdSelectLabel, name: "/paymentThreshold", id: "paymentThreshold", value: ((_h = (_g = props.states) === null || _g === void 0 ? void 0 : _g.formState) === null || _h === void 0 ? void 0 : _h.paymentThreshold) || "" }, (((_j = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _j === void 0 ? void 0 : _j.paymentThreshold) && {
            class: "error-input",
            helpText: getValidationErrorMessage({
              type: (_l = (_k = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _k === void 0 ? void 0 : _k.paymentThreshold) === null || _l === void 0 ? void 0 : _l.type,
              label: props.text.paymentThresholdSelectLabel,
            }),
          })), props.states.thresholds.map((t) => (h("sl-menu-item", { value: t }, `${props.states.currency}${t}`))))),
          paymentFixedDaySelectSlot: (h("sl-select", Object.assign({ required: true, disabled: props.states.saveLoading, label: props.text.paymentDaySelectLabel, value: ((_o = (_m = props.states) === null || _m === void 0 ? void 0 : _m.formState) === null || _o === void 0 ? void 0 : _o.paymentDay) || "", name: "/paymentDay", id: "paymentDay" }, (((_p = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _p === void 0 ? void 0 : _p.paymentDay) && {
            class: "error-input",
            helpText: getValidationErrorMessage({
              type: (_r = (_q = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _q === void 0 ? void 0 : _q.paymentDay) === null || _r === void 0 ? void 0 : _r.type,
              label: props.text.paymentDaySelectLabel,
            }),
          })),
            h("sl-menu-item", { value: "1" }, props.text.paymentDayFirstOfMonthLabelText),
            h("sl-menu-item", { value: "15" }, props.text.paymentDayFifteenthOfMonthLabelText))),
          paypalInputSlot: (h("sl-input", Object.assign({ required: true, disabled: props.states.saveLoading, value: ((_t = (_s = props.states) === null || _s === void 0 ? void 0 : _s.formState) === null || _t === void 0 ? void 0 : _t.paypalEmailAddress) || "", label: props.text.payPalInputLabel, key: "paypalEmailAddress", name: "/paypalEmailAddress", id: "paypalEmailAddress", type: "text" }, (((_w = (_v = (_u = props.states.formState) === null || _u === void 0 ? void 0 : _u.errors) === null || _v === void 0 ? void 0 : _v.inputErrors) === null || _w === void 0 ? void 0 : _w.paypalEmailAddress) && {
            class: "error-input",
            helpText: getValidationErrorMessage({
              type: (_0 = (_z = (_y = (_x = props.states.formState) === null || _x === void 0 ? void 0 : _x.errors) === null || _y === void 0 ? void 0 : _y.inputErrors) === null || _z === void 0 ? void 0 : _z.paypalEmailAddress) === null || _0 === void 0 ? void 0 : _0.type,
              label: props.text.payPalInputLabel,
            }),
          })))),
        } })));
  }
  static get is() { return "sqm-banking-info-form"; }
  static get properties() { return {
    "formStep": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Setup progress",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "form-step",
      "reflect": false,
      "defaultValue": "\"Step {step} of {count}\""
    },
    "taxAndPayouts": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Step 4 title",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "tax-and-payouts",
      "reflect": false,
      "defaultValue": "\"Payouts\""
    },
    "taxAndPayoutsDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Page description",
            "name": "uiName"
          }],
        "text": "Displayed at the top of the page on all set up steps."
      },
      "attribute": "tax-and-payouts-description",
      "reflect": false,
      "defaultValue": "\"Submit your tax documents and add your banking information to receive your rewards.\""
    },
    "directlyToBankAccount": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Direct to bank payout option",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "directly-to-bank-account",
      "reflect": false,
      "defaultValue": "\"Directly to my bank account\""
    },
    "toPayPalAccount": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "PayPal payout option",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "to-pay-pal-account",
      "reflect": false,
      "defaultValue": "\"PayPal (2% processing fee capped to {feeCap})\""
    },
    "paymentScheduleBalanceThreshold": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Threshold balance payment schedule option",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "payment-schedule-balance-threshold",
      "reflect": false,
      "defaultValue": "\"Pay me when my balance reaches a threshold\""
    },
    "paymentScheduleFixedDay": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Fixed day payment schedule option",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "payment-schedule-fixed-day",
      "reflect": false,
      "defaultValue": "\"Pay me on a fixed day of the month\""
    },
    "paymentDaySelectLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Payment day field label",
            "name": "uiName"
          }],
        "text": "Let the participant choose what day of the month they\u2019ll get paid"
      },
      "attribute": "payment-day-select-label",
      "reflect": false,
      "defaultValue": "\"Payment Day\""
    },
    "paymentThresholdSelectLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Payment threshold field label",
            "name": "uiName"
          }],
        "text": "Participant use this field to select the balance at which they want to be paid"
      },
      "attribute": "payment-threshold-select-label",
      "reflect": false,
      "defaultValue": "\"Payment Threshold\""
    },
    "paymentDayFirstOfMonthLabelText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "First of month payday option",
            "name": "uiName"
          }],
        "text": "One of two payment day options"
      },
      "attribute": "payment-day-first-of-month-label-text",
      "reflect": false,
      "defaultValue": "\"1st of the month\""
    },
    "paymentDayFifteenthOfMonthLabelText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Fifteenth of month payday option",
            "name": "uiName"
          }],
        "text": "Label text for the payment day select option for the fifteenth of the month"
      },
      "attribute": "payment-day-fifteenth-of-month-label-text",
      "reflect": false,
      "defaultValue": "\"15th of the month\""
    },
    "paymentMethod": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Payment method section header",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "payment-method",
      "reflect": false,
      "defaultValue": "\"Payment method\""
    },
    "paymentSchedule": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Payment schedule section header",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "payment-schedule",
      "reflect": false,
      "defaultValue": "\"Payment schedule\""
    },
    "paymentMethodSubtext": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Payment method section description",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "payment-method-subtext",
      "reflect": false,
      "defaultValue": "\"Payouts will be sent from our referral program provider, impact.com.\""
    },
    "payPalInputLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "PayPal email field label",
            "name": "uiName"
          }],
        "text": "Displayed to participants who choose PayPal as their payout method"
      },
      "attribute": "pay-pal-input-label",
      "reflect": false,
      "defaultValue": "\"PayPal email\""
    },
    "bankLocationLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank country field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-location-label",
      "reflect": false,
      "defaultValue": "\"Bank country location\""
    },
    "beneficiaryAccountNameLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Beneficiary account field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "beneficiary-account-name-label",
      "reflect": false,
      "defaultValue": "\"Account holder name\""
    },
    "beneficiaryAccountNameDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Beneficiary account field description",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "beneficiary-account-name-description",
      "reflect": false,
      "defaultValue": "\"The beneficiary name of your bank account. Ensure this matches the name on your tax form.\""
    },
    "bankAccountTypeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank account type field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-account-type-label",
      "reflect": false,
      "defaultValue": "\"Bank account type\""
    },
    "checkingSelectItemLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Checking account option",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "checking-select-item-label",
      "reflect": false,
      "defaultValue": "\"Checking\""
    },
    "savingsSelectItemLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Savings account options",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "savings-select-item-label",
      "reflect": false,
      "defaultValue": "\"Savings\""
    },
    "bankAccountNumberLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank account number field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-account-number-label",
      "reflect": false,
      "defaultValue": "\"Bank account number\""
    },
    "ibanLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "IBAN field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "iban-label",
      "reflect": false,
      "defaultValue": "\"IBAN\""
    },
    "swiftCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "SWIFT code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "swift-code-label",
      "reflect": false,
      "defaultValue": "\"SWIFT code\""
    },
    "routingCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Routing code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "routing-code-label",
      "reflect": false,
      "defaultValue": "\"{bankCountry, select, AU {BSB number} CA {Routing number} CZ {Bank code} HK {Clearing code} SG {Clearing code} US {ABA routing number} NZ {BSB number} ZA {Bank/Branch number} IN {IFSC} CNY {CNAPS} other {Routing code} }\""
    },
    "bankNameLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank name field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-name-label",
      "reflect": false,
      "defaultValue": "\"Bank Name\""
    },
    "classificationEntityLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Classification entity field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "classification-entity-label",
      "reflect": false,
      "defaultValue": "\"Classification Entity\""
    },
    "businessSelectItemLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Business classification option",
            "name": "uiName"
          }],
        "text": "One of three options listed for the classification field"
      },
      "attribute": "business-select-item-label",
      "reflect": false,
      "defaultValue": "\"Business\""
    },
    "individualSelectItemLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Individual classification option",
            "name": "uiName"
          }],
        "text": "One of three options listed for the classification field"
      },
      "attribute": "individual-select-item-label",
      "reflect": false,
      "defaultValue": "\"Individual\""
    },
    "foreignSelectItemLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Foreign classification option",
            "name": "uiName"
          }],
        "text": "One of three options listed for the classification field"
      },
      "attribute": "foreign-select-item-label",
      "reflect": false,
      "defaultValue": "\"Foreign\""
    },
    "classificationCPFLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Classification CPF field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "classification-c-p-f-label",
      "reflect": false,
      "defaultValue": "\"Classification CPF\""
    },
    "patronymicNameLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Patronymic name field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "patronymic-name-label",
      "reflect": false,
      "defaultValue": "\"Patronymic name\""
    },
    "voCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "VO code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "vo-code-label",
      "reflect": false,
      "defaultValue": "\"VO code\""
    },
    "agencyCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Agency code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "agency-code-label",
      "reflect": false,
      "defaultValue": "\"Agency code\""
    },
    "branchCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Branch code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "branch-code-label",
      "reflect": false,
      "defaultValue": "\"Branch code\""
    },
    "classificationLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Classification field label",
            "name": "uiName"
          }],
        "text": "Label text for the classification input field"
      },
      "attribute": "classification-label",
      "reflect": false,
      "defaultValue": "\"Classification\""
    },
    "taxPayerIdLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Taxpayer ID field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "tax-payer-id-label",
      "reflect": false,
      "defaultValue": "\"{country, select, AR {CUIT/CUIL} KR {Classification ID} other { Beneficiary INN } }\""
    },
    "bankAddressLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank address field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-address-label",
      "reflect": false,
      "defaultValue": "\"Bank address\""
    },
    "bankCityLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank city field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-city-label",
      "reflect": false,
      "defaultValue": "\"Bank city\""
    },
    "bankStateLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank province/state field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-state-label",
      "reflect": false,
      "defaultValue": "\"Bank province/state\""
    },
    "bankPostalCodeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Bank postal code field label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "bank-postal-code-label",
      "reflect": false,
      "defaultValue": "\"Bank postal code\""
    },
    "eftWithdrawalLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "EFT withdrawal payment method",
            "name": "uiName"
          }],
        "text": "Default payment method to the participants\u2019 bank account."
      },
      "attribute": "eft-withdrawal-label",
      "reflect": false,
      "defaultValue": "\"EFT withdrawal (free)\""
    },
    "fxWireProcessingFeeLabel": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "FX Wire Processing fee text",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "fx-wire-processing-fee-label",
      "reflect": false,
      "defaultValue": "\"FX Wire (Processing Fee {currency}{defaultFxFee}.00)\""
    },
    "searchForCountryText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Country field placeholder text",
            "name": "uiName"
          }],
        "text": "Placeholder text displayed in the country search dropdown"
      },
      "attribute": "search-for-country-text",
      "reflect": false,
      "defaultValue": "\"Search for country..\""
    },
    "isPartnerAlertHeader": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Participant is a partner alert title",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page if the participant is already a registered partner on impact.com."
      },
      "attribute": "is-partner-alert-header",
      "reflect": false,
      "defaultValue": "\"An account with this email already exists with our referral program provider, impact.com\""
    },
    "isPartnerAlertDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Participant is a partner alert description",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page if the participant is already a registered partner on impact.com."
      },
      "attribute": "is-partner-alert-description",
      "reflect": false,
      "defaultValue": "\"If you don\u2019t recognize this referral program provider or believe this is a mistake, please contact our {supportLink} or sign up for this referral program with a different email.\""
    },
    "verifyEmailHeaderText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Verify email header",
            "name": "uiName"
          }],
        "text": "Text for verify email dialog"
      },
      "attribute": "verify-email-header-text",
      "reflect": false,
      "defaultValue": "\"Verify your email\""
    },
    "verifyEmailDescriptionText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Verify code widget header text",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "verify-email-description-text",
      "reflect": false,
      "defaultValue": "\"Verify your email to update your payment settings. Enter the code sent to {email} from our referral provider, impact.com.\""
    },
    "generalErrorTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Form submission error message title",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page."
      },
      "attribute": "general-error-title",
      "reflect": false,
      "defaultValue": "\"There was a problem submitting your information\""
    },
    "generalErrorDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Form submission error message description",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page."
      },
      "attribute": "general-error-description",
      "reflect": false,
      "defaultValue": "\"Please review your information and try again. If this problem continues, contact our {supportLink}.\""
    },
    "fieldRequiredError": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Empty form field error message",
            "name": "uiName"
          }],
        "text": "Displayed under a field that is missing required information."
      },
      "attribute": "field-required-error",
      "reflect": false,
      "defaultValue": "\"{fieldName} is required\""
    },
    "fieldInvalidError": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Form field error message",
            "name": "uiName"
          }],
        "text": "Displayed under a field when it has an invalid entry."
      },
      "attribute": "field-invalid-error",
      "reflect": false,
      "defaultValue": "\"{fieldName} is invalid\""
    },
    "supportLink": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Support link text",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "support-link",
      "reflect": false,
      "defaultValue": "\"support team\""
    },
    "continueButton": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Continue button label",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "continue-button",
      "reflect": false,
      "defaultValue": "\"Save\""
    },
    "backButton": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Back button label",
            "name": "uiName"
          }],
        "text": "Text for the back button in the form"
      },
      "attribute": "back-button",
      "reflect": false,
      "defaultValue": "\"Back\""
    },
    "loadingErrorAlertHeader": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Page load error message title",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page."
      },
      "attribute": "loading-error-alert-header",
      "reflect": false,
      "defaultValue": "\"There was a problem loading your form\""
    },
    "loadingErrorAlertDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Page load error message description",
            "name": "uiName"
          }, {
            "text": "textArea",
            "name": "uiWidget"
          }],
        "text": "Part of the alert displayed at the top of the page."
      },
      "attribute": "loading-error-alert-description",
      "reflect": false,
      "defaultValue": "\"Please refresh the page and try again. If this problem continues, contact Support.\""
    },
    "modalTitle": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Information modal title",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "modal-title",
      "reflect": false,
      "defaultValue": "\"Important Note\""
    },
    "modalDescription": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Information modal description text",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "modal-description",
      "reflect": false,
      "defaultValue": "\"Updating payment information places your account and payouts on hold for up to 48 hours while we verify your change. Payments scheduled during the hold period are skipped.\""
    },
    "modalButtonText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "text": "Information modal button text",
            "name": "uiName"
          }],
        "text": ""
      },
      "attribute": "modal-button-text",
      "reflect": false,
      "defaultValue": "\"I understand, update my information\""
    },
    "demoData": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "DemoData<BankingInfoFormViewProps>",
        "resolved": "{ states?: { showVerification: boolean; step?: string; locale?: string; loading: boolean; saveLoading?: boolean; disabled: boolean; saveDisabled: boolean; hideSteps?: boolean; hasPayPal: boolean; hideBanking?: boolean; hidePayPal?: boolean; hideBalanceThreshold?: boolean; hideFixedDay?: boolean; hideBackButton: boolean; feeCap?: string; isPartner: boolean; paymentMethodFeeLabel?: string; loadingError: boolean; formState: BankingInfoFormData & { paymentMethodChecked?: \"toBankAccount\" | \"toPayPalAccount\"; paymentScheduleChecked?: \"BALANCE_THRESHOLD\" | \"FIXED_DAY\"; errors?: { general?: boolean; inputErrors?: { [field: string]: { type: \"required\" | \"invalid\"; }; }; }; }; bitset?: number; currency?: string; thresholds: string[]; countries?: { countryCode: string; displayName: string; }[]; allCountries?: { countryCode: string; displayName: string; }[]; currentPaymentOption?: any; showInputs?: boolean; bankCountry?: string; countrySearch?: string; email?: string; showModal: boolean; }; slots?: { verificationDialogSlot?: VNode; formInputsSlot?: VNode[]; countryInputSlot?: VNode; paymentMethodSlot?: VNode; paymentThresholdSelectSlot?: VNode; paymentFixedDaySelectSlot?: VNode; paypalInputSlot?: VNode; }; refs?: { formRef: any; }; }",
        "references": {
          "DemoData": {
            "location": "import",
            "path": "../../../global/demo"
          },
          "BankingInfoFormViewProps": {
            "location": "import",
            "path": "./sqm-banking-info-form-view"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [{
            "text": undefined,
            "name": "undocumented"
          }, {
            "text": "object",
            "name": "uiType"
          }],
        "text": ""
      }
    }
  }; }
  static get states() { return {
    "ignored": {}
  }; }
}
function useDemoBankingInfoForm(props) {
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
  const defaultPaymentMethodChecked = (_c = (_b = (_a = props.demoData) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.formState) === null || _c === void 0 ? void 0 : _c.paymentMethodChecked;
  const defaultPaymentScheduleChecked = (_f = (_e = (_d = props.demoData) === null || _d === void 0 ? void 0 : _d.states) === null || _e === void 0 ? void 0 : _e.formState) === null || _f === void 0 ? void 0 : _f.paymentScheduleChecked;
  const defaultCurrency = (_h = (_g = props.demoData) === null || _g === void 0 ? void 0 : _g.states) === null || _h === void 0 ? void 0 : _h.currency;
  const defaultCountry = (_l = (_k = (_j = props.demoData) === null || _j === void 0 ? void 0 : _j.states) === null || _k === void 0 ? void 0 : _k.formState) === null || _l === void 0 ? void 0 : _l.bankCountry;
  const setStep = useSetParent(TAX_CONTEXT_NAMESPACE);
  const [paymentMethodChecked, setPaymentMethodChecked] = useState(undefined);
  const [paymentScheduleChecked, setPaymentScheduleChecked] = useState(undefined);
  const [currency, setCurrency] = useState(defaultCurrency);
  const [bankCountry, setBankCountry] = useState(defaultCountry);
  const currentPaymentOption = (_m = mockPaymentOptions[currency]) === null || _m === void 0 ? void 0 : _m.find((paymentOption) => {
    if (paymentOption.countryCode === bankCountry)
      return true;
    return false;
  });
  const bitset = (currentPaymentOption === null || currentPaymentOption === void 0 ? void 0 : currentPaymentOption.withdrawalSettingId) || ((_p = (_o = props.demoData) === null || _o === void 0 ? void 0 : _o.states) === null || _p === void 0 ? void 0 : _p.bitset) ||
    0;
  useEffect(() => {
    if (defaultPaymentMethodChecked !== paymentMethodChecked)
      setPaymentMethodChecked(defaultPaymentMethodChecked);
    if (defaultPaymentScheduleChecked !== paymentScheduleChecked)
      setPaymentScheduleChecked(defaultPaymentScheduleChecked);
    if (defaultCurrency !== currency)
      setCurrency(defaultCurrency);
    if (defaultCountry !== bankCountry)
      setBankCountry(defaultCountry);
  }, [defaultPaymentMethodChecked, defaultCurrency, defaultCountry]);
  const feeCap = paypalFeeMap[currency] || "";
  const paymentMethodFeeMap = {
    ACH: props.eftWithdrawalLabel,
    WIRE: intl.formatMessage({ id: "fxWireText", defaultMessage: props.fxWireProcessingFeeLabel }, {
      currency,
      defaultFxFee: (currentPaymentOption === null || currentPaymentOption === void 0 ? void 0 : currentPaymentOption.defaultFxFee) || "0",
    }),
  };
  const paymentMethodFeeLabel = paymentMethodFeeMap[currentPaymentOption === null || currentPaymentOption === void 0 ? void 0 : currentPaymentOption.defaultFinancePaymentMethodId];
  return deepmerge({
    states: {
      step: "4",
      isPartner: false,
      disabled: false,
      loading: false,
      saveLoading: false,
      hideSteps: false,
      hideBackButton: false,
      feeCap,
      thresholds: [],
      paymentMethodFeeLabel,
      formState: {
        paymentMethodChecked,
        paymentScheduleChecked,
        errors: {
          general: false,
          beneficiaryAccountName: false,
          bankAccountType: false,
          bankAccountNumber: false,
          iban: false,
          swiftCode: false,
          routingCode: false,
          bankName: false,
          beneficiaryClassification: false,
          patronymicName: false,
          voCode: false,
          agencyCode: false,
          bankAddress: false,
          bankCity: false,
          bankState: false,
          bankPostalCode: false,
          branchCode: false,
          paymentThreshold: false,
          paymentDay: false,
        },
      },
      bitset,
      bankCountry,
      currency,
      setCurrency,
      hasPayPal: true,
      showModal: false,
    },
    callbacks: {
      onVerificationHide: () => { },
      onSubmit: async () => {
        setStep("/dashboard");
      },
      setBankCountry,
      setPaymentMethodChecked,
      setPaymentScheduleChecked,
      setCountrySearch: () => { },
      onBack: async () => setStep("/dashboard"),
      onVerification: () => { },
      onModalOpen: () => { },
      onModalClose: () => { },
    },
    text: props.getTextProps(),
    refs: {
      formRef: { current: null },
    },
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
}
