import { Component, Host, h, Listen, Prop } from '@stencil/core';
import { openWormhole } from 'stencil-wormhole';
export class ScExpressPayment {
  onPaymentRequestLoaded() {
    this.hasPaymentOptions = true;
  }
  renderStripePaymentRequest() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
    if (!((_c = (_b = (_a = this === null || this === void 0 ? void 0 : this.order) === null || _a === void 0 ? void 0 : _a.processor_data) === null || _b === void 0 ? void 0 : _b.stripe) === null || _c === void 0 ? void 0 : _c.publishable_key) || !((_f = (_e = (_d = this === null || this === void 0 ? void 0 : this.order) === null || _d === void 0 ? void 0 : _d.processor_data) === null || _e === void 0 ? void 0 : _e.stripe) === null || _f === void 0 ? void 0 : _f.account_id)) {
      return '';
    }
    return (h("sc-stripe-payment-request", { formId: this.formId, debug: this.debug, order: this.order, stripeAccountId: (_j = (_h = (_g = this === null || this === void 0 ? void 0 : this.order) === null || _g === void 0 ? void 0 : _g.processor_data) === null || _h === void 0 ? void 0 : _h.stripe) === null || _j === void 0 ? void 0 : _j.account_id, publishableKey: (_m = (_l = (_k = this === null || this === void 0 ? void 0 : this.order) === null || _k === void 0 ? void 0 : _k.processor_data) === null || _l === void 0 ? void 0 : _l.stripe) === null || _m === void 0 ? void 0 : _m.publishable_key }));
  }
  render() {
    return (h(Host, { class: { 'is-empty': !this.hasPaymentOptions && !this.debug } },
      this.renderStripePaymentRequest(),
      (this.hasPaymentOptions || this.debug) && h("sc-divider", { style: { '--spacing': 'calc(var(--sc-form-row-spacing)/2)' } }, this.dividerText),
      this.busy && h("sc-block-ui", null)));
  }
  static get is() { return "sc-express-payment"; }
  static get originalStyleUrls() { return {
    "$": ["sc-express-payment.css"]
  }; }
  static get styleUrls() { return {
    "$": ["sc-express-payment.css"]
  }; }
  static get properties() { return {
    "processor": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ProcessorName",
        "resolved": "\"paypal\" | \"paypal-card\" | \"stripe\"",
        "references": {
          "ProcessorName": {
            "location": "import",
            "path": "../../../../types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "processor",
      "reflect": false
    },
    "formId": {
      "type": "any",
      "mutable": false,
      "complexType": {
        "original": "number | string",
        "resolved": "number | string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "form-id",
      "reflect": false
    },
    "busy": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "busy",
      "reflect": false
    },
    "order": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Checkout",
        "resolved": "Checkout",
        "references": {
          "Checkout": {
            "location": "import",
            "path": "../../../../types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "dividerText": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "divider-text",
      "reflect": false
    },
    "debug": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "debug",
      "reflect": false
    },
    "hasPaymentOptions": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "has-payment-options",
      "reflect": false
    }
  }; }
  static get listeners() { return [{
      "name": "scPaymentRequestLoaded",
      "method": "onPaymentRequestLoaded",
      "target": undefined,
      "capture": false,
      "passive": false
    }]; }
}
openWormhole(ScExpressPayment, ['order', 'formId', 'busy'], false);
