import { ScopedElementsMap } from '@open-wc/scoped-elements'; import '@vaadin/vaadin-button'; import '@vaadin/vaadin-text-field/vaadin-text-area'; import { PropertyDeclarations } from 'lit-element'; import { TemplateResult } from 'lit-html'; import { Translatable } from '../../../mixins/translatable'; import { DonationChangeEvent } from './DonationChangeEvent'; import { DonationSubmitEvent } from './DonationSubmitEvent'; declare global { interface Window { FC?: { settings?: { session_name: string; session_id: string; }; }; } } interface DonationEventsMap { change: typeof DonationChangeEvent; submit: typeof DonationSubmitEvent; } /** * A custom element providing customizable donation forms. * * @fires Donation#change - Instance of `Donation.events.change`. Emitted after user input triggers a change in the form data. * @fires Donation#submit - Instance of `Donation.events.submit`. Emitted when the form is submitted. Cancelling this event will stop the submission. * * @slot amount - Space below the amount selector, if it's visible. * @slot designation - Space below the designation selector, if it's visible. * @slot comment - Space below the comment field, if it's visible. * * @element foxy-donation * @since 0.3.0 */ export declare class Donation extends Translatable { /** @readonly */ static get scopedElements(): ScopedElementsMap; /** @readonly */ static get properties(): PropertyDeclarations; /** @readonly */ static get events(): DonationEventsMap; /** * **Required** 3-letter lowercase currency code. * * **Example:** `"usd"` */ currency: null | string; /** * **Required** donation amount in specified currency. When more than one amount option * is available, this field will contain the selected amount. This value is deliberately not * limited to the predefined options: whatever you set it to will show up in the cart. * * **Example:** `25` */ amount: null | number; /** * **Required** store domain. This is usually the part after before `.foxycart.com` * and after `https://`, e.g. the `foxy-demo` bit of `https://foxy-demo.foxycart.com`. * Custom domains like `my.domain.example.com` are also supported since v1.6.1. * * **Example:** `"foxy-demo"` */ store: null | string; /** * **Required** product name for this donation. This will show up in the cart when this form is submitted. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"One-time donation"` */ name: null | string; /** * Optional parts of the form including a custom ("other") option. * Adding `amount` to this array will enable custom amount. * * **Example:** `["amount"]` */ custom: null | 'amount'[]; /** * Optional donation amount variants. If this property is set, the form will render * the amount selection interface. If this array includes the value of the `amount` property, * it will be pre-selected in the form. * * **Example:** `[25, 50, 75]` */ amounts: null | number[]; /** * Optional donation frequency string encoded as count (integer) + units (one * of: `d` for days, `w` for weeks, `m` for months, `y` for years). A special * value for twice a month is also supported: `.5m`. If set, the form will * create a subscription with the specified frequency in the cart. This value is deliberately not * limited to the predefined options: whatever you set it to will show up in the cart. * * **Example:** `"1m"` */ frequency: null | string; /** * Optional donation frequency variants in the same format as `frequency`. If this property is set, * the form will render the frequency selection interface. If this array includes * the value of the `frequency` property, it will be pre-selected in the form. * * **Example:** `["7d", ".5m", "1y"]` */ frequencies: null | string[]; /** * Optional donation designation(s). The form will serialize and pass this value to the cart * on submission. This value is deliberately not limited to the predefined options: * whatever you set it to will show up in the cart. * * **Example:** `"Medical Care"` * **Example:** `["Medical Care", "Daily Meals"]` */ designation: null | string; /** * Optional donation designation(s) variants. If this property is set, * the form will render the designation selection interface: multiple choice * if `designation` is an array and a single choice otherwise. All values overlapping * with the `designation` property will be pre-selected in the form. * * **Example:** `["Medical Care", "Daily Meals", "Area of Greatest Need"]` */ designations: null | string[]; /** * Optional comment accompanying the donation. If set (even to an empty string), * the form will render a comment field. The value of this property will be updated * as the customer enters their message and will be added to the order as a custom field in the end. * * **Example:** `""` */ comment: null | string; /** * Optional switch controlling visibility of the anonymity checkbox. If set to `true`, the form * will render the checkbox. All changes in the value are reflected to the attribute. * * **Example:** `true` */ anonymity: boolean; /** * Optional switch marking this donation as anonymous via a custom field when set to `true`. When * the anonymity checkbox is rendered, also checks or unchecks it depending on the value. * All changes in the value are reflected to the attribute. * * **Example:** `true` */ anonymous: boolean; /** * Optional product image URL (absolute path). This property affects cart UI only. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"https://picsum.photos/320"` */ image: null | string; /** * Optional product code for this donation. This property affects cart UI only. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"ISBN 978-0-12-345678-9"` */ code: null | string; /** * Optional product URL for this donation. Accepts a full URL to the product page, starting * with `http://` or `https://`, or a relative path to the produt from the store's * domain (as configured in the store settings). This property affects cart UI only. * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details. * * **Example:** `"https://example.com/my-product"` */ url: null | string; /** * Optional cart * If set to 'add' will add items to the cart and, on submit, user is redirected to the cart. * If set to 'checkout', the default, on submit user is redirected to checkout directly */ cart: string; /** * Optional empty * If set to 'true' clears the contents of the cart prior to adding the donation to the cart * If set to 'reset' clears the contents of the cart and cookies prior to adding the donation to the cart */ empty?: string; /** * Optional target to display the form response. */ target: string; private __fcSessionPollInterval; constructor(); /** Submits the form, emitting a cancelable `submit` event. */ submit(): void; render(): TemplateResult; connectedCallback(): void; disconnectedCallback(): void; updated(): void; private get __data(); private get __form(); private __translateFrequency; private __translateAmount; } export {};