@internetarchive/donation-form 0.5.23-a1 → 0.5.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/donation-form.js +0 -1
- package/dist/src/donation-form.js.map +1 -1
- package/dist/src/form-elements/contact-form/contact-form.js +1 -4
- package/dist/src/form-elements/contact-form/contact-form.js.map +1 -1
- package/package.json +1 -1
- package/src/donation-form.ts +0 -1
- package/src/form-elements/contact-form/contact-form.ts +1 -4
|
@@ -369,7 +369,6 @@ let DonationForm = class DonationForm extends LitElement {
|
|
|
369
369
|
this.paymentSelector.donationInfoValid = this.donationInfoValid;
|
|
370
370
|
}
|
|
371
371
|
if (changedProperties.has('selectedPaymentProvider')) {
|
|
372
|
-
console.log('selectedPaymentProvider ** ', this.selectedPaymentProvider);
|
|
373
372
|
const event = new CustomEvent('paymentProviderSelected', {
|
|
374
373
|
detail: {
|
|
375
374
|
paymentProvider: this.selectedPaymentProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donation-form.js","sourceRoot":"","sources":["../../src/donation-form.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAA6C,MAAM,KAAK,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,OAAO,MAAM,qCAAqC,CAAC;AAE1D,qFAAqF;AACrF,kFAAkF;AAClF,6EAA6E;AAC7E,8EAA8E;AAC9E,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AAOrD,OAAO,EAEL,mBAAmB,EACnB,eAAe,EAEf,YAAY,EACZ,sBAAsB,GACvB,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAEL,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K,EAAE,CAAC;mDAAkD;AAEhD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DACiB;AAEf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAmC;AAElC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAoC;AAEnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAkC;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAmD;AAEhD;IAA7B,KAAK,CAAC,qBAAqB,CAAC;wDAA0C;AAExC;IAA9B,KAAK,CAAC,sBAAsB,CAAC;wDAAyC;AAE5C;IAA1B,KAAK,CAAC,kBAAkB,CAAC;qDAAmC;AA/BlD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAghBxB;SAhhBY,YAAY","sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport { LitElement, html, css, CSSResult, TemplateResult, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\n\nimport lockImg from '@internetarchive/icon-lock/index.js';\n\n// we have to import the registered component independently from the definition below\n// because inside each of these files, we're registering the custom element inside\n// these files and by simply importing the class name, you lose that behavior\n// See https://github.com/microsoft/TypeScript/issues/9191 for more discussion\nimport './form-elements/payment-selector';\nimport './form-elements/header/donation-form-header';\n\nimport { DonationFormHeader } from './form-elements/header/donation-form-header';\nimport { PaymentSelector } from './form-elements/payment-selector';\n\nimport { BraintreeManagerInterface } from './braintree-manager/braintree-interfaces';\n\nimport {\n DonationRequest,\n DonationPaymentInfo,\n PaymentProvider,\n DonorContactInfo,\n DonationType,\n defaultDonationAmounts,\n} from '@internetarchive/donation-form-data-models';\n\nimport { PaymentFlowHandlersInterface } from './payment-flow-handlers/payment-flow-handlers';\n\nimport {\n EditDonationAmountSelectionLayout,\n EditDonationFrequencySelectionMode,\n} from '@internetarchive/donation-form-edit-donation';\n\nimport '@internetarchive/donation-form-section';\nimport {\n DonationFormSection,\n DonationFormSectionBadgeMode,\n} from '@internetarchive/donation-form-section';\nimport { UpsellModalCTAMode } from './modals/upsell-modal-content';\nimport { ContactForm } from './form-elements/contact-form/contact-form';\nimport './form-elements/total-amount';\n\n@customElement('donation-form')\nexport class DonationForm extends LitElement {\n @property({ type: Object }) braintreeManager: BraintreeManagerInterface | undefined;\n\n @property({ type: Object }) paymentFlowHandlers: PaymentFlowHandlersInterface | undefined;\n\n @property({ type: Object }) donationRequest: DonationRequest | undefined;\n\n @property({ type: Object }) donationInfo?: DonationPaymentInfo;\n\n @property({ type: Object }) contactForm?: ContactForm;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String }) amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String }) frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: Boolean }) private creditCardVisible = false;\n\n @property({ type: Boolean }) private contactFormVisible = false;\n\n @property({ type: Boolean }) private donationInfoValid = true;\n\n @property({ type: String }) private selectedPaymentProvider?: PaymentProvider;\n\n @query('#contactFormSection') contactFormSection?: DonationFormSection;\n\n @query('donation-form-header') donationFormHeader!: DonationFormHeader;\n\n @query('payment-selector') paymentSelector!: PaymentSelector;\n\n private paypalButtonNeedsRender = true;\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <donation-form-header\n .amountOptions=${this.amountOptions}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @editDonationError=${this.editDonationError}\n >\n </donation-form-header>\n\n <donation-form-section\n .badgeMode=${DonationFormSectionBadgeMode.HideBadgeLeaveSpacing}\n id=\"total-amount-section\"\n >\n <donation-form-total-amount .donationInfo=${this.donationInfo}>\n </donation-form-total-amount>\n </donation-form-section>\n\n <donation-form-section\n .sectionBadge=${this.paymentSelectorNumberingStart}\n headline=\"Choose a payment method\"\n >\n <payment-selector\n .paymentProviders=${this.braintreeManager?.paymentProviders}\n @firstUpdated=${this.paymentSelectorFirstUpdated}\n @creditCardSelected=${this.creditCardSelected}\n @venmoSelected=${this.venmoSelected}\n @applePaySelected=${this.applePaySelected}\n @googlePaySelected=${this.googlePaySelected}\n @paypalBlockerSelected=${this.paypalBlockerSelected}\n @resetPaymentMethod=${async () => {\n this.selectedPaymentProvider = undefined;\n this.contactFormVisible = false;\n this.requestUpdate();\n }}\n tabindex=\"0\"\n >\n <slot name=\"paypal-button\" slot=\"paypal-button\"></slot>\n </payment-selector>\n </donation-form-section>\n\n <div class=\"contact-form-section ${this.contactFormVisible ? '' : 'hidden'}\">\n ${this.contactFormSectionTemplate}\n </div>\n <slot name=\"recaptcha\"></slot>\n `;\n }\n\n async showConfirmationModalDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: Function;\n confirmDonationCB: Function;\n }): Promise<void> {\n this.paymentFlowHandlers?.showConfirmationStepModal(options);\n }\n\n /**\n * This is a developer convenience method that allows us to show the upsell modal without going\n * through the purchasing flow. If it's showing the PayPal button, it will trigger\n * the PayPal button render\n *\n * @param {{\n * oneTimeAmount: number;\n * ctaMode?: UpsellModalCTAMode;\n * yesSelected?: (amount: number) => void;\n * noSelected?: () => void;\n * amountChanged?: (amount: number) => void;\n * userClosedModalCallback?: () => void;\n * }} options\n * @returns {Promise<void>}\n * @memberof DonationForm\n */\n async showUpsellModalDev(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showUpsellModal(options);\n\n if (options.ctaMode === UpsellModalCTAMode.PayPalUpsellSlot) {\n const handler = await this.braintreeManager?.paymentProviders.paypalHandler.get();\n const donationInfo = new DonationPaymentInfo({\n amount: options.oneTimeAmount,\n donationType: DonationType.OneTime,\n coverFees: false,\n });\n handler?.renderPayPalButton({\n selector: '#paypal-upsell-button',\n style: {\n color: 'blue' as paypal.ButtonColorOption,\n label: 'paypal' as paypal.ButtonLabelOption,\n shape: 'rect' as paypal.ButtonShapeOption,\n size: 'responsive' as paypal.ButtonSizeOption,\n tagline: false,\n },\n donationInfo: donationInfo,\n });\n }\n }\n\n get contactFormSectionTemplate(): TemplateResult {\n const headline = this.selectedPaymentProvider === PaymentProvider.Venmo\n ? 'Help us stay in touch'\n : 'Enter payment information';\n\n return html`\n <donation-form-section\n .sectionBadge=${this.paymentSelectorNumberingStart + 1}\n headline=${headline}\n id=\"contactFormSection\"\n >\n <slot name=\"contact-form\"></slot>\n <div class=\"credit-card-fields\" class=\"${this.creditCardVisible ? '' : 'hidden'}\">\n <slot name=\"braintree-hosted-fields\"></slot>\n </div>\n </donation-form-section>\n\n <donation-form-section .sectionBadge=${this.paymentSelectorNumberingStart + 2}>\n <slot name=\"recaptcha\"></slot>\n <button id=\"donate-button\" @click=${this.donateClicked}>Donate</button>\n\n <div class=\"secure-process-note\">${lockImg} Your payment will be securely processed</div>\n </donation-form-section>\n `;\n }\n\n /**\n * Where to start the numbering of the payment selector\n *\n * - If we show the frequency selector in button mode, it becomes section 1, which makes\n * the amount selection section 2, and the payment selector section 3.\n * - If we show the frequency selector in checkbox mode, it is no longer section 1. The amount\n * selector becomes section 1 and the payment selector becomes section 2.\n *\n * Visually:\n *\n * Button Mode:\n * 1. Frequency selector\n * 2. Amount selector\n * 3. Payment selector\n * 4. Contact info\n * 5. Donate button\n *\n * Checkbox Mode:\n * 1. Amount selector (including the monthly checkbox)\n * 2. Payment selector <-- changes from 3 to 2\n * 3. Contact info <-- changes from 4 to 3\n * 4. Donate button <-- changes from 5 to 4\n *\n * @readonly\n * @private\n * @type {number}\n * @memberof DonationForm\n */\n private get paymentSelectorNumberingStart(): number {\n return this.frequencySelectionMode === EditDonationFrequencySelectionMode.Button ? 3 : 2;\n }\n\n private editDonationError(): void {\n this.donationInfoValid = false;\n }\n\n private paymentSelectorFirstUpdated(): void {\n if (this.paymentFlowHandlers?.paypalHandler) {\n this.renderPayPalButtonIfNeeded();\n }\n }\n\n private applePaySelected(e: CustomEvent): void {\n this.selectedPaymentProvider = PaymentProvider.ApplePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const originalEvent = e.detail.originalEvent;\n this.donationInfo &&\n this.paymentFlowHandlers?.applePayHandler?.paymentInitiated(this.donationInfo, originalEvent);\n this.emitPaymentFlowStartedEvent();\n }\n\n private googlePaySelected(): void {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n } else {\n this.donationInfo &&\n this.paymentFlowHandlers?.googlePayHandler?.paymentInitiated(this.donationInfo);\n this.emitPaymentFlowStartedEvent();\n }\n }\n\n private async creditCardSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.CreditCard;\n this.contactFormVisible = true;\n this.creditCardVisible = true;\n this.focusContactForm();\n }\n\n private async venmoSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.Venmo;\n this.contactFormVisible = true;\n this.creditCardVisible = false;\n this.focusContactForm();\n }\n\n private paypalBlockerSelected(): void {\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n this.showInvalidDonationInfoAlert();\n }\n\n private async focusContactForm(): Promise<void> {\n await this.updateComplete;\n if (this.contactFormSection) {\n this.contactForm?.focus();\n }\n }\n\n private async donateClicked(): Promise<void> {\n if (!this.contactForm) {\n alert('Please enter contact info.');\n return;\n }\n if (!this.donationInfoValid || !this.donationInfo) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const contactInfo = this.contactForm.donorContactInfo;\n\n switch (this.selectedPaymentProvider) {\n case PaymentProvider.CreditCard:\n this.handleCreditCardDonationFlow(contactInfo, this.donationInfo);\n break;\n case PaymentProvider.Venmo:\n this.handleVenmoDonationFlow(contactInfo, this.donationInfo);\n break;\n }\n }\n\n private async handleCreditCardDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const creditCardFlowHandler = this.paymentFlowHandlers?.creditCardHandler;\n const creditCardHandler = await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.hideErrorMessage();\n const valid = this.contactForm?.reportValidity();\n const hostedFieldsResponse = await creditCardFlowHandler?.tokenizeFields();\n\n if (!valid || hostedFieldsResponse === undefined) {\n return;\n }\n\n this.emitPaymentFlowStartedEvent();\n creditCardFlowHandler?.paymentInitiated(hostedFieldsResponse, donationInfo, contactInfo);\n }\n\n private async handleVenmoDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const valid = this.contactForm?.reportValidity();\n if (!valid) {\n return;\n }\n this.paymentFlowHandlers?.venmoHandler?.paymentInitiated(contactInfo, donationInfo);\n }\n\n private emitPaymentFlowStartedEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowStarted', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowConfirmedEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowConfirmed', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowCancelledEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowCancelled', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowErrorEvent(error?: string): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowError', {\n detail: { paymentProvider: this.selectedPaymentProvider, error: error },\n });\n this.dispatchEvent(event);\n }\n\n private showInvalidDonationInfoAlert(): void {\n alert('Please enter a valid donation amount.');\n }\n\n private async renderPayPalButtonIfNeeded(): Promise<void> {\n if (!this.paypalButtonNeedsRender) {\n return;\n }\n this.paypalButtonNeedsRender = false;\n this.donationInfo &&\n (await this.paymentFlowHandlers?.paypalHandler?.renderPayPalButton(this.donationInfo));\n this.paymentSelector.showPaypalButton();\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('donationInfo') && this.donationInfo) {\n // The PayPal button has a standalone datasource since we don't initiate the payment\n // through code so it has to have the donation info ready when the user taps the button.\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(this.donationInfo);\n this.donationFormHeader.donationInfo = this.donationInfo;\n }\n\n if (\n (changedProperties.has('paymentFlowHandlers') || changedProperties.has('donationInfo')) &&\n this.donationInfo &&\n this.paymentFlowHandlers\n ) {\n this.setupFlowHandlers();\n }\n\n if (changedProperties.has('donationInfoValid')) {\n this.paymentSelector.donationInfoValid = this.donationInfoValid;\n }\n\n if (changedProperties.has('selectedPaymentProvider')) {\n console.log('selectedPaymentProvider ** ', this.selectedPaymentProvider);\n const event = new CustomEvent('paymentProviderSelected', {\n detail: {\n paymentProvider: this.selectedPaymentProvider,\n previousPaymentProvider: changedProperties.get('selectedPaymentProvider'),\n },\n });\n this.dispatchEvent(event);\n }\n }\n\n private flowHandlersConfigured = false;\n\n private setupFlowHandlers(): void {\n if (this.flowHandlersConfigured) {\n return;\n }\n this.flowHandlersConfigured = true;\n this.bindFlowListenerEvents();\n this.renderPayPalButtonIfNeeded();\n this.donationInfo &&\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(this.donationInfo);\n }\n\n private flowHandlerListenersBound = false;\n\n private bindFlowListenerEvents(): void {\n if (this.flowHandlerListenersBound) {\n return;\n }\n this.flowHandlerListenersBound = true;\n\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentStarted', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowStartedEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentConfirmed', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowConfirmedEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowCancelledEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentError', (datasource, error) => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowErrorEvent(error);\n });\n\n this.paymentFlowHandlers?.googlePayHandler?.on('paymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.emitPaymentFlowCancelledEvent();\n });\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n const donationInfo: DonationPaymentInfo = e.detail.donationInfo;\n this.donationInfo = new DonationPaymentInfo({\n amount: donationInfo.amount,\n donationType: donationInfo.donationType,\n coverFees: donationInfo.coverFees,\n });\n this.donationInfoValid = true;\n const event = new CustomEvent('donationInfoChanged', { detail: { donationInfo } });\n this.dispatchEvent(event);\n }\n\n /** @inheritdoc */\n static get styles(): CSSResult {\n const donateButtonFontSize = css`var(--donateButtonFontSize, 2.6rem)`;\n const donateButtonHeight = css`var(--donateButtonHeight, 4rem)`;\n const donateButtonColor = css`var(--donateButtonColor, rgba(49, 164, 129, 1))`;\n const donateButtonTextColor = css`var(--donateButtonTextColor, #fff)`;\n const donateButtonHoverColor = css`var(--donateButtonHoverColor, rgba(39, 131, 103, 1))`;\n const totalAmountTopMargin = css`var(--donateTotalAmountTopMargin, 1.5rem)`;\n const totalAmountBottomMargin = css`var(--donateTotalAmountBottomMargin, 1.2rem)`;\n\n return css`\n h1 {\n margin: 0;\n padding: 0;\n }\n\n .hidden {\n display: none;\n }\n\n .secure-process-note {\n margin-top: 0.5em;\n font-size: 0.75em;\n text-align: center;\n }\n\n .secure-process-note svg {\n width: 1.2rem;\n height: 1.5rem;\n vertical-align: bottom;\n }\n\n #donate-button {\n width: 100%;\n appearance: none;\n -webkit-appearance: none;\n font-size: ${donateButtonFontSize};\n font-weight: bold;\n text-align: center;\n color: ${donateButtonTextColor};\n cursor: pointer;\n border: none;\n border-radius: 5px;\n background-color: ${donateButtonColor};\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n height: ${donateButtonHeight};\n }\n\n #donate-button:hover {\n background-color: ${donateButtonHoverColor};\n }\n\n #total-amount-section {\n display: block;\n margin-top: ${totalAmountTopMargin};\n margin-bottom: ${totalAmountBottomMargin};\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"donation-form.js","sourceRoot":"","sources":["../../src/donation-form.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAA6C,MAAM,KAAK,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,OAAO,MAAM,qCAAqC,CAAC;AAE1D,qFAAqF;AACrF,kFAAkF;AAClF,6EAA6E;AAC7E,8EAA8E;AAC9E,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6CAA6C,CAAC;AAOrD,OAAO,EAEL,mBAAmB,EACnB,eAAe,EAEf,YAAY,EACZ,sBAAsB,GACvB,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAEL,4BAA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AAC;2DACmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DACiB;AAEf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAmC;AAElC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAoC;AAEnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAkC;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAmD;AAEhD;IAA7B,KAAK,CAAC,qBAAqB,CAAC;wDAA0C;AAExC;IAA9B,KAAK,CAAC,sBAAsB,CAAC;wDAAyC;AAE5C;IAA1B,KAAK,CAAC,kBAAkB,CAAC;qDAAmC;AA/BlD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA+gBxB;SA/gBY,YAAY","sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport { LitElement, html, css, CSSResult, TemplateResult, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\n\nimport lockImg from '@internetarchive/icon-lock/index.js';\n\n// we have to import the registered component independently from the definition below\n// because inside each of these files, we're registering the custom element inside\n// these files and by simply importing the class name, you lose that behavior\n// See https://github.com/microsoft/TypeScript/issues/9191 for more discussion\nimport './form-elements/payment-selector';\nimport './form-elements/header/donation-form-header';\n\nimport { DonationFormHeader } from './form-elements/header/donation-form-header';\nimport { PaymentSelector } from './form-elements/payment-selector';\n\nimport { BraintreeManagerInterface } from './braintree-manager/braintree-interfaces';\n\nimport {\n DonationRequest,\n DonationPaymentInfo,\n PaymentProvider,\n DonorContactInfo,\n DonationType,\n defaultDonationAmounts,\n} from '@internetarchive/donation-form-data-models';\n\nimport { PaymentFlowHandlersInterface } from './payment-flow-handlers/payment-flow-handlers';\n\nimport {\n EditDonationAmountSelectionLayout,\n EditDonationFrequencySelectionMode,\n} from '@internetarchive/donation-form-edit-donation';\n\nimport '@internetarchive/donation-form-section';\nimport {\n DonationFormSection,\n DonationFormSectionBadgeMode,\n} from '@internetarchive/donation-form-section';\nimport { UpsellModalCTAMode } from './modals/upsell-modal-content';\nimport { ContactForm } from './form-elements/contact-form/contact-form';\nimport './form-elements/total-amount';\n\n@customElement('donation-form')\nexport class DonationForm extends LitElement {\n @property({ type: Object }) braintreeManager: BraintreeManagerInterface | undefined;\n\n @property({ type: Object }) paymentFlowHandlers: PaymentFlowHandlersInterface | undefined;\n\n @property({ type: Object }) donationRequest: DonationRequest | undefined;\n\n @property({ type: Object }) donationInfo?: DonationPaymentInfo;\n\n @property({ type: Object }) contactForm?: ContactForm;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String }) amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String }) frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: Boolean }) private creditCardVisible = false;\n\n @property({ type: Boolean }) private contactFormVisible = false;\n\n @property({ type: Boolean }) private donationInfoValid = true;\n\n @property({ type: String }) private selectedPaymentProvider?: PaymentProvider;\n\n @query('#contactFormSection') contactFormSection?: DonationFormSection;\n\n @query('donation-form-header') donationFormHeader!: DonationFormHeader;\n\n @query('payment-selector') paymentSelector!: PaymentSelector;\n\n private paypalButtonNeedsRender = true;\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <donation-form-header\n .amountOptions=${this.amountOptions}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @editDonationError=${this.editDonationError}\n >\n </donation-form-header>\n\n <donation-form-section\n .badgeMode=${DonationFormSectionBadgeMode.HideBadgeLeaveSpacing}\n id=\"total-amount-section\"\n >\n <donation-form-total-amount .donationInfo=${this.donationInfo}>\n </donation-form-total-amount>\n </donation-form-section>\n\n <donation-form-section\n .sectionBadge=${this.paymentSelectorNumberingStart}\n headline=\"Choose a payment method\"\n >\n <payment-selector\n .paymentProviders=${this.braintreeManager?.paymentProviders}\n @firstUpdated=${this.paymentSelectorFirstUpdated}\n @creditCardSelected=${this.creditCardSelected}\n @venmoSelected=${this.venmoSelected}\n @applePaySelected=${this.applePaySelected}\n @googlePaySelected=${this.googlePaySelected}\n @paypalBlockerSelected=${this.paypalBlockerSelected}\n @resetPaymentMethod=${async () => {\n this.selectedPaymentProvider = undefined;\n this.contactFormVisible = false;\n this.requestUpdate();\n }}\n tabindex=\"0\"\n >\n <slot name=\"paypal-button\" slot=\"paypal-button\"></slot>\n </payment-selector>\n </donation-form-section>\n\n <div class=\"contact-form-section ${this.contactFormVisible ? '' : 'hidden'}\">\n ${this.contactFormSectionTemplate}\n </div>\n <slot name=\"recaptcha\"></slot>\n `;\n }\n\n async showConfirmationModalDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: Function;\n confirmDonationCB: Function;\n }): Promise<void> {\n this.paymentFlowHandlers?.showConfirmationStepModal(options);\n }\n\n /**\n * This is a developer convenience method that allows us to show the upsell modal without going\n * through the purchasing flow. If it's showing the PayPal button, it will trigger\n * the PayPal button render\n *\n * @param {{\n * oneTimeAmount: number;\n * ctaMode?: UpsellModalCTAMode;\n * yesSelected?: (amount: number) => void;\n * noSelected?: () => void;\n * amountChanged?: (amount: number) => void;\n * userClosedModalCallback?: () => void;\n * }} options\n * @returns {Promise<void>}\n * @memberof DonationForm\n */\n async showUpsellModalDev(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showUpsellModal(options);\n\n if (options.ctaMode === UpsellModalCTAMode.PayPalUpsellSlot) {\n const handler = await this.braintreeManager?.paymentProviders.paypalHandler.get();\n const donationInfo = new DonationPaymentInfo({\n amount: options.oneTimeAmount,\n donationType: DonationType.OneTime,\n coverFees: false,\n });\n handler?.renderPayPalButton({\n selector: '#paypal-upsell-button',\n style: {\n color: 'blue' as paypal.ButtonColorOption,\n label: 'paypal' as paypal.ButtonLabelOption,\n shape: 'rect' as paypal.ButtonShapeOption,\n size: 'responsive' as paypal.ButtonSizeOption,\n tagline: false,\n },\n donationInfo: donationInfo,\n });\n }\n }\n\n get contactFormSectionTemplate(): TemplateResult {\n const headline = this.selectedPaymentProvider === PaymentProvider.Venmo\n ? 'Help us stay in touch'\n : 'Enter payment information';\n\n return html`\n <donation-form-section\n .sectionBadge=${this.paymentSelectorNumberingStart + 1}\n headline=${headline}\n id=\"contactFormSection\"\n >\n <slot name=\"contact-form\"></slot>\n <div class=\"credit-card-fields\" class=\"${this.creditCardVisible ? '' : 'hidden'}\">\n <slot name=\"braintree-hosted-fields\"></slot>\n </div>\n </donation-form-section>\n\n <donation-form-section .sectionBadge=${this.paymentSelectorNumberingStart + 2}>\n <slot name=\"recaptcha\"></slot>\n <button id=\"donate-button\" @click=${this.donateClicked}>Donate</button>\n\n <div class=\"secure-process-note\">${lockImg} Your payment will be securely processed</div>\n </donation-form-section>\n `;\n }\n\n /**\n * Where to start the numbering of the payment selector\n *\n * - If we show the frequency selector in button mode, it becomes section 1, which makes\n * the amount selection section 2, and the payment selector section 3.\n * - If we show the frequency selector in checkbox mode, it is no longer section 1. The amount\n * selector becomes section 1 and the payment selector becomes section 2.\n *\n * Visually:\n *\n * Button Mode:\n * 1. Frequency selector\n * 2. Amount selector\n * 3. Payment selector\n * 4. Contact info\n * 5. Donate button\n *\n * Checkbox Mode:\n * 1. Amount selector (including the monthly checkbox)\n * 2. Payment selector <-- changes from 3 to 2\n * 3. Contact info <-- changes from 4 to 3\n * 4. Donate button <-- changes from 5 to 4\n *\n * @readonly\n * @private\n * @type {number}\n * @memberof DonationForm\n */\n private get paymentSelectorNumberingStart(): number {\n return this.frequencySelectionMode === EditDonationFrequencySelectionMode.Button ? 3 : 2;\n }\n\n private editDonationError(): void {\n this.donationInfoValid = false;\n }\n\n private paymentSelectorFirstUpdated(): void {\n if (this.paymentFlowHandlers?.paypalHandler) {\n this.renderPayPalButtonIfNeeded();\n }\n }\n\n private applePaySelected(e: CustomEvent): void {\n this.selectedPaymentProvider = PaymentProvider.ApplePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const originalEvent = e.detail.originalEvent;\n this.donationInfo &&\n this.paymentFlowHandlers?.applePayHandler?.paymentInitiated(this.donationInfo, originalEvent);\n this.emitPaymentFlowStartedEvent();\n }\n\n private googlePaySelected(): void {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n } else {\n this.donationInfo &&\n this.paymentFlowHandlers?.googlePayHandler?.paymentInitiated(this.donationInfo);\n this.emitPaymentFlowStartedEvent();\n }\n }\n\n private async creditCardSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.CreditCard;\n this.contactFormVisible = true;\n this.creditCardVisible = true;\n this.focusContactForm();\n }\n\n private async venmoSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.Venmo;\n this.contactFormVisible = true;\n this.creditCardVisible = false;\n this.focusContactForm();\n }\n\n private paypalBlockerSelected(): void {\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n this.showInvalidDonationInfoAlert();\n }\n\n private async focusContactForm(): Promise<void> {\n await this.updateComplete;\n if (this.contactFormSection) {\n this.contactForm?.focus();\n }\n }\n\n private async donateClicked(): Promise<void> {\n if (!this.contactForm) {\n alert('Please enter contact info.');\n return;\n }\n if (!this.donationInfoValid || !this.donationInfo) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const contactInfo = this.contactForm.donorContactInfo;\n\n switch (this.selectedPaymentProvider) {\n case PaymentProvider.CreditCard:\n this.handleCreditCardDonationFlow(contactInfo, this.donationInfo);\n break;\n case PaymentProvider.Venmo:\n this.handleVenmoDonationFlow(contactInfo, this.donationInfo);\n break;\n }\n }\n\n private async handleCreditCardDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const creditCardFlowHandler = this.paymentFlowHandlers?.creditCardHandler;\n const creditCardHandler = await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.hideErrorMessage();\n const valid = this.contactForm?.reportValidity();\n const hostedFieldsResponse = await creditCardFlowHandler?.tokenizeFields();\n\n if (!valid || hostedFieldsResponse === undefined) {\n return;\n }\n\n this.emitPaymentFlowStartedEvent();\n creditCardFlowHandler?.paymentInitiated(hostedFieldsResponse, donationInfo, contactInfo);\n }\n\n private async handleVenmoDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const valid = this.contactForm?.reportValidity();\n if (!valid) {\n return;\n }\n this.paymentFlowHandlers?.venmoHandler?.paymentInitiated(contactInfo, donationInfo);\n }\n\n private emitPaymentFlowStartedEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowStarted', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowConfirmedEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowConfirmed', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowCancelledEvent(): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowCancelled', {\n detail: { paymentProvider: this.selectedPaymentProvider },\n });\n this.dispatchEvent(event);\n }\n\n private emitPaymentFlowErrorEvent(error?: string): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n const event = new CustomEvent('paymentFlowError', {\n detail: { paymentProvider: this.selectedPaymentProvider, error: error },\n });\n this.dispatchEvent(event);\n }\n\n private showInvalidDonationInfoAlert(): void {\n alert('Please enter a valid donation amount.');\n }\n\n private async renderPayPalButtonIfNeeded(): Promise<void> {\n if (!this.paypalButtonNeedsRender) {\n return;\n }\n this.paypalButtonNeedsRender = false;\n this.donationInfo &&\n (await this.paymentFlowHandlers?.paypalHandler?.renderPayPalButton(this.donationInfo));\n this.paymentSelector.showPaypalButton();\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('donationInfo') && this.donationInfo) {\n // The PayPal button has a standalone datasource since we don't initiate the payment\n // through code so it has to have the donation info ready when the user taps the button.\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(this.donationInfo);\n this.donationFormHeader.donationInfo = this.donationInfo;\n }\n\n if (\n (changedProperties.has('paymentFlowHandlers') || changedProperties.has('donationInfo')) &&\n this.donationInfo &&\n this.paymentFlowHandlers\n ) {\n this.setupFlowHandlers();\n }\n\n if (changedProperties.has('donationInfoValid')) {\n this.paymentSelector.donationInfoValid = this.donationInfoValid;\n }\n\n if (changedProperties.has('selectedPaymentProvider')) {\n const event = new CustomEvent('paymentProviderSelected', {\n detail: {\n paymentProvider: this.selectedPaymentProvider,\n previousPaymentProvider: changedProperties.get('selectedPaymentProvider'),\n },\n });\n this.dispatchEvent(event);\n }\n }\n\n private flowHandlersConfigured = false;\n\n private setupFlowHandlers(): void {\n if (this.flowHandlersConfigured) {\n return;\n }\n this.flowHandlersConfigured = true;\n this.bindFlowListenerEvents();\n this.renderPayPalButtonIfNeeded();\n this.donationInfo &&\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(this.donationInfo);\n }\n\n private flowHandlerListenersBound = false;\n\n private bindFlowListenerEvents(): void {\n if (this.flowHandlerListenersBound) {\n return;\n }\n this.flowHandlerListenersBound = true;\n\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentStarted', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowStartedEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentConfirmed', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowConfirmedEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowCancelledEvent();\n });\n this.paymentFlowHandlers?.paypalHandler?.on('payPalPaymentError', (datasource, error) => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowErrorEvent(error);\n });\n\n this.paymentFlowHandlers?.googlePayHandler?.on('paymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.emitPaymentFlowCancelledEvent();\n });\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n const donationInfo: DonationPaymentInfo = e.detail.donationInfo;\n this.donationInfo = new DonationPaymentInfo({\n amount: donationInfo.amount,\n donationType: donationInfo.donationType,\n coverFees: donationInfo.coverFees,\n });\n this.donationInfoValid = true;\n const event = new CustomEvent('donationInfoChanged', { detail: { donationInfo } });\n this.dispatchEvent(event);\n }\n\n /** @inheritdoc */\n static get styles(): CSSResult {\n const donateButtonFontSize = css`var(--donateButtonFontSize, 2.6rem)`;\n const donateButtonHeight = css`var(--donateButtonHeight, 4rem)`;\n const donateButtonColor = css`var(--donateButtonColor, rgba(49, 164, 129, 1))`;\n const donateButtonTextColor = css`var(--donateButtonTextColor, #fff)`;\n const donateButtonHoverColor = css`var(--donateButtonHoverColor, rgba(39, 131, 103, 1))`;\n const totalAmountTopMargin = css`var(--donateTotalAmountTopMargin, 1.5rem)`;\n const totalAmountBottomMargin = css`var(--donateTotalAmountBottomMargin, 1.2rem)`;\n\n return css`\n h1 {\n margin: 0;\n padding: 0;\n }\n\n .hidden {\n display: none;\n }\n\n .secure-process-note {\n margin-top: 0.5em;\n font-size: 0.75em;\n text-align: center;\n }\n\n .secure-process-note svg {\n width: 1.2rem;\n height: 1.5rem;\n vertical-align: bottom;\n }\n\n #donate-button {\n width: 100%;\n appearance: none;\n -webkit-appearance: none;\n font-size: ${donateButtonFontSize};\n font-weight: bold;\n text-align: center;\n color: ${donateButtonTextColor};\n cursor: pointer;\n border: none;\n border-radius: 5px;\n background-color: ${donateButtonColor};\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n height: ${donateButtonHeight};\n }\n\n #donate-button:hover {\n background-color: ${donateButtonHoverColor};\n }\n\n #total-amount-section {\n display: block;\n margin-top: ${totalAmountTopMargin};\n margin-bottom: ${totalAmountBottomMargin};\n }\n `;\n }\n}\n"]}
|
|
@@ -348,7 +348,7 @@ let ContactForm = class ContactForm extends LitElement {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
contact-form #donation-contact-form-countryCodeAlpha2 {
|
|
351
|
-
width:
|
|
351
|
+
width: calc(100%);
|
|
352
352
|
height: 100%;
|
|
353
353
|
box-sizing: border-box;
|
|
354
354
|
font-weight: bold;
|
|
@@ -356,9 +356,6 @@ let ContactForm = class ContactForm extends LitElement {
|
|
|
356
356
|
font-family: ${fieldFontFamily};
|
|
357
357
|
border: 0;
|
|
358
358
|
background: #fff;
|
|
359
|
-
-webkit-appearance: none;
|
|
360
|
-
-moz-appearance: none;
|
|
361
|
-
appearance: none;
|
|
362
359
|
}
|
|
363
360
|
</style>
|
|
364
361
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-form.js","sourceRoot":"","sources":["../../../../src/form-elements/contact-form/contact-form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB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,0CAA0C,CAAC;qDAAgC;AAC3C;IAAtC,KAAK,CAAC,8BAA8B,CAAC;+CAA+B;AAEb;IAAvD,KAAK,CAAC,+CAA+C,CAAC;yDAAoC;AAC/C;IAA3C,KAAK,CAAC,mCAAmC,CAAC;mDAAmC;AAEvB;IAAtD,KAAK,CAAC,8CAA8C,CAAC;wDAAmC;AAC9C;IAA1C,KAAK,CAAC,kCAAkC,CAAC;kDAAkC;AAEnB;IAAxD,KAAK,CAAC,gDAAgD,CAAC;sDAAiC;AAC5C;IAA5C,KAAK,CAAC,oCAAoC,CAAC;oDAAoC;AAGhF;IADC,KAAK,CAAC,mDAAmD,CAAC;6DACpB;AACS;IAA/C,KAAK,CAAC,uCAAuC,CAAC;uDAAuC;AAGtF;IADC,KAAK,CAAC,qDAAqD,CAAC;+DACpB;AACS;IAAjD,KAAK,CAAC,yCAAyC,CAAC;yDAAyC;AAEpC;IAArD,KAAK,CAAC,6CAA6C,CAAC;wDAAmC;AAC9C;IAAzC,KAAK,CAAC,iCAAiC,CAAC;kDAAkC;AAEvB;IAAnD,KAAK,CAAC,2CAA2C,CAAC;sDAAiC;AAC5C;IAAvC,KAAK,CAAC,+BAA+B,CAAC;gDAAgC;AAEpB;IAAlD,KAAK,CAAC,0CAA0C,CAAC;2DAA4C;AAE/C;IAA9C,KAAK,CAAC,sCAAsC,CAAC;iDAA+B;AAC9D;IAAd,KAAK,CAAC,MAAM,CAAC;yCAAwB;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAwB;AAjCxC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAuZvB;SAvZY,WAAW","sourcesContent":["import { LitElement, html, css, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport {\n BillingInfo,\n CustomerInfo,\n DonorContactInfo,\n} from '@internetarchive/donation-form-data-models';\nimport { AutoCompleteFieldOptions } from './autocomplete-field-options';\nimport { SpacerOption } from '../badged-input';\nimport { BadgedInput } from '../badged-input';\nimport '../badged-input';\n\nimport emailImg from '@internetarchive/icon-email/index.js';\nimport localePinImg from '@internetarchive/icon-locale-pin/index.js';\nimport userIcon from '@internetarchive/icon-user/index.js';\n\nimport { countries } from './countries';\n\n@customElement('contact-form')\nexport class ContactForm extends LitElement {\n @query('badged-input.donation-contact-form-email') emailBadgedInput!: BadgedInput;\n @query('#donation-contact-form-email') emailField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-first-name') firstNameBadgedInput!: BadgedInput;\n @query('#donation-contact-form-first-name') firstNameField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-last-name') lastNameBadgedInput!: BadgedInput;\n @query('#donation-contact-form-last-name') lastNameField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-postal-code') postalBadgedInput!: BadgedInput;\n @query('#donation-contact-form-postal-code') postalCodeField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-street-address')\n streetAddressBadgedInput!: BadgedInput;\n @query('#donation-contact-form-street-address') streetAddressField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-extended-address')\n extendedAddressBadgedInput!: BadgedInput;\n @query('#donation-contact-form-extended-address') extendedAddressField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-locality') localityBadgedInput!: BadgedInput;\n @query('#donation-contact-form-locality') localityField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-region') regionBadgedInput!: BadgedInput;\n @query('#donation-contact-form-region') regionField!: HTMLInputElement;\n\n @query('#donation-contact-form-countryCodeAlpha2') countryCodeAlpha2Field!: HTMLSelectElement;\n\n @query('#donation-contact-form-error-message') errorMessage!: HTMLDivElement;\n @query('form') form!: HTMLFormElement;\n\n /** @keyof countries */\n @property({ type: String }) selectedCountry = 'US';\n\n reportValidity(): boolean {\n const fieldBadgedInputs: Array<[HTMLInputElement, BadgedInput]> = [\n [this.emailField, this.emailBadgedInput],\n [this.firstNameField, this.firstNameBadgedInput],\n [this.lastNameField, this.lastNameBadgedInput],\n [this.regionField, this.regionBadgedInput],\n [this.localityField, this.localityBadgedInput],\n [this.streetAddressField, this.streetAddressBadgedInput],\n [this.postalCodeField, this.postalBadgedInput],\n ];\n\n let isValid = true;\n fieldBadgedInputs.forEach(([inputElement, badgedInput]) => {\n const fieldValid = inputElement.checkValidity();\n isValid = isValid && fieldValid;\n if (!fieldValid) {\n badgedInput.error = true;\n }\n });\n\n if (!isValid) {\n this.errorMessage.innerText = 'Please enter any missing contact information below';\n } else {\n this.errorMessage.innerText = '';\n }\n\n return isValid;\n }\n\n focus(): void {\n this.emailField.focus();\n }\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <div id=\"donation-contact-form-error-message\"></div>\n <form>\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-email',\n placeholder: 'Email',\n required: true,\n fieldType: 'email',\n name: 'email',\n autocomplete: 'email',\n maxlength: 255,\n icon: emailImg,\n })}\n </div>\n </fieldset>\n\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-first-name',\n placeholder: 'First name',\n name: 'fname',\n required: true,\n maxlength: 255,\n autocomplete: 'given-name',\n icon: userIcon,\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-last-name',\n placeholder: 'Last name',\n name: 'lname',\n autocomplete: 'family-name',\n required: true,\n maxlength: 255,\n })}\n </div>\n </fieldset>\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-street-address',\n placeholder: 'Address Line 1',\n required: true,\n autocomplete: 'address-line1',\n icon: localePinImg,\n name: 'street-address',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-extended-address',\n placeholder: 'Address Line 2 (optional)',\n autocomplete: 'address-line2',\n required: false,\n name: 'extended-address',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-locality',\n placeholder: 'City',\n autocomplete: 'address-level2',\n required: true,\n name: 'locality',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-region',\n placeholder: 'State / Province',\n autocomplete: 'address-level1',\n required: true,\n name: 'region',\n })}\n ${this.generateInput({\n id: 'donation-contact-form-postal-code',\n placeholder: 'Zip / Postal',\n autocomplete: 'postal-code',\n required: true,\n name: 'postal',\n maxlength: 9,\n // must start with a character, then may contain spaces\n validationPattern: '[a-zA-Z\\\\-\\\\d]+[a-zA-Z\\\\-\\\\d\\\\s]*',\n iconSpaceOption: SpacerOption.CompressSpace,\n })}\n </div>\n <div class=\"row\">${this.countrySelectorTemplate}</div>\n </fieldset>\n </form>\n ${this.getStyles}\n `;\n }\n\n private get countrySelectorTemplate(): TemplateResult {\n return html`\n <badged-input>\n <select\n id=\"donation-contact-form-countryCodeAlpha2\"\n @change=${(e: Event) => {\n const currCountry = this.selectedCountry;\n this.selectedCountry = (e.target as HTMLInputElement)?.value\n ? ((e.target as HTMLInputElement)?.value as string)\n : currCountry;\n // update required visual cue on region/state/province & postal code fields\n if (this.selectedCountry === 'US') {\n this.postalBadgedInput?.setAttribute('required', '');\n this.postalCodeField?.setAttribute('required', '');\n this.regionBadgedInput?.setAttribute('required', '');\n this.regionField?.setAttribute('required', '');\n } else {\n this.postalBadgedInput?.removeAttribute('required');\n this.postalCodeField?.removeAttribute('required');\n this.regionBadgedInput?.removeAttribute('required');\n this.regionField?.removeAttribute('required');\n }\n }}\n >\n ${Object.keys(countries).map(key => {\n const name = countries[key];\n return html`\n <option value=${key} ?selected=${key === this.selectedCountry}>${name}</option>\n `;\n })}\n </select>\n </badged-input>\n `;\n }\n\n /** @inheritdoc */\n createRenderRoot(): this {\n // Render template without shadow DOM. Note that shadow DOM features like\n // encapsulated CSS and slots are unavailable.\n // Form autofill does not work properly in the shadow DOM\n // so we need our form fields in the light DOM\n return this;\n }\n\n // reset the error state when the user focuses the input\n private inputFocused(e: KeyboardEvent): void {\n this.errorMessage.innerText = '';\n const input = e.target as HTMLInputElement;\n const inputIdentifier = input.id;\n const badgedInput = this.querySelector(`badged-input.${inputIdentifier}`) as BadgedInput;\n badgedInput.error = false;\n }\n\n private generateInput(options: {\n id: string;\n placeholder: string;\n required?: boolean;\n fieldType?: 'text' | 'email';\n autocomplete?: AutoCompleteFieldOptions;\n maxlength?: number;\n name: string;\n icon?: TemplateResult;\n iconSpaceOption?: SpacerOption;\n validationPattern?: string;\n }): TemplateResult {\n const required = options.required ?? true;\n const fieldType = options.fieldType ?? 'text';\n const iconOption = options.iconSpaceOption ?? SpacerOption.LeaveSpace;\n\n return html`\n <badged-input\n class=${options.id}\n .icon=${options.icon}\n .iconSpaceOption=${iconOption}\n ?required=${options.required}\n >\n <label for=${options.id}>${options.placeholder}</label>\n <input\n type=${fieldType}\n id=${options.id}\n class=\"donation-contact-form-input\"\n name=${options.name}\n aria-label=${options.placeholder}\n placeholder=${options.placeholder}\n maxlength=${ifDefined(options.maxlength)}\n autocomplete=${options.autocomplete ?? 'on'}\n pattern=${ifDefined(options.validationPattern)}\n @focus=${this.inputFocused}\n ?required=${required}\n />\n </badged-input>\n `;\n }\n\n get donorContactInfo(): DonorContactInfo {\n return new DonorContactInfo({\n billing: this.billingInfo,\n customer: this.contactInfo,\n });\n }\n\n get billingInfo(): BillingInfo {\n const billingInfo = new BillingInfo({\n streetAddress: this.streetAddressField.value,\n extendedAddress: this.extendedAddressField.value,\n locality: this.localityField.value,\n region: this.regionField.value,\n postalCode: this.postalCodeField.value,\n countryCodeAlpha2: this.countryCodeAlpha2Field.value,\n });\n return billingInfo;\n }\n\n get contactInfo(): CustomerInfo {\n return new CustomerInfo({\n email: this.emailField.value,\n firstName: this.firstNameField.value,\n lastName: this.lastNameField.value,\n });\n }\n\n /**\n * This is not the normal LitElement styles block.\n *\n * This element uses the clear DOM instead of the shadow DOM so it can't use\n * the shadowRoot's isolated styling. This is a bit of a workaround to keep all of\n * the styling local by writing out our own <style> tag and just be careful about\n * the selectors since they will leak outside of this component.\n *\n * @readonly\n * @private\n * @type {TemplateResult}\n * @memberof ContactForm\n */\n private get getStyles(): TemplateResult {\n const noIconSpacerWidth = css`var(--badgedInputNoIconSpacerWidth, 3rem)`;\n const iconSpacerWidth = css`var(--badgedInputIconSpacerWidth, 5rem)`;\n\n const fieldSetSpacing = css`var(--fieldSetSpacing, 1rem)`;\n const fieldFontFamily = css`var(--fontFamily, \"Helvetica Neue\", Helvetica, Arial, sans-serif)`;\n const fieldFontSize = css`var(--contactFieldFontSize, 1.6rem)`;\n const fieldFontColor = css`var(--inputFieldFontColor, #333)`;\n\n const iconFieldWidth = css`calc(100% - ${iconSpacerWidth})`;\n const noIconFieldWidth = css`calc(100% - ${noIconSpacerWidth})`;\n\n return html`\n <style>\n /*\n **NOTE**\n This element is in the lightDOM so be sure to prefix all styles\n with \"contact-form\" so styles don't leak.\n */\n contact-form fieldset {\n border: 0;\n padding: 0;\n margin: 0;\n margin-bottom: ${fieldSetSpacing};\n background-color: white;\n }\n\n /* These 1px and 0 margins in the next few selectors are to account for the\n double outlines caused by the fields being right next to each other */\n contact-form .row {\n display: flex;\n margin: -1px 0 0 0;\n }\n\n contact-form fieldset .row:first-child {\n margin-top: 0;\n }\n\n contact-form badged-input.donation-contact-form-region {\n width: 60%;\n }\n\n contact-form badged-input.donation-contact-form-postal-code {\n width: 40%;\n }\n\n contact-form #donation-contact-form-region {\n width: ${iconFieldWidth};\n }\n\n contact-form #donation-contact-form-postal-code {\n width: ${noIconFieldWidth};\n }\n\n contact-form #donation-contact-form-error-message {\n color: red;\n font-size: 1.4rem;\n margin-bottom: 0.6rem;\n }\n\n contact-form #donation-contact-form-last-name {\n width: ${noIconFieldWidth};\n }\n\n /* only show for screen readers */\n contact-form label {\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n }\n\n contact-form .donation-contact-form-input {\n width: ${iconFieldWidth};\n border: 0;\n outline: 0;\n background: transparent;\n font-weight: bold;\n color: ${fieldFontColor};\n font-size: ${fieldFontSize};\n padding: 0;\n font-family: ${fieldFontFamily};\n }\n\n contact-form .donation-contact-form-input::placeholder {\n color: revert;\n }\n\n contact-form #donation-contact-form-countryCodeAlpha2 {\n width: ${iconFieldWidth};\n height: 100%;\n box-sizing: border-box;\n font-weight: bold;\n font-size: ${fieldFontSize};\n font-family: ${fieldFontFamily};\n border: 0;\n background: #fff;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n </style>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"contact-form.js","sourceRoot":"","sources":["../../../../src/form-elements/contact-form/contact-form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,GACjB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,iBAAiB,CAAC;AAEzB,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,QAAQ,MAAM,qCAAqC,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGjC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAgCL,uBAAuB;QACK,oBAAe,GAAG,IAAI,CAAC;IAmXrD,CAAC;IAjXC,cAAc;QACZ,MAAM,iBAAiB,GAA2C;YAChE,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC;YACxC,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,oBAAoB,CAAC;YA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,CAAC;sDAAiC;AAC5C;IAAvC,KAAK,CAAC,+BAA+B,CAAC;gDAAgC;AAEpB;IAAlD,KAAK,CAAC,0CAA0C,CAAC;2DAA4C;AAE/C;IAA9C,KAAK,CAAC,sCAAsC,CAAC;iDAA+B;AAC9D;IAAd,KAAK,CAAC,MAAM,CAAC;yCAAwB;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAwB;AAjCxC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAoZvB;SApZY,WAAW","sourcesContent":["import { LitElement, html, css, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport {\n BillingInfo,\n CustomerInfo,\n DonorContactInfo,\n} from '@internetarchive/donation-form-data-models';\nimport { AutoCompleteFieldOptions } from './autocomplete-field-options';\nimport { SpacerOption } from '../badged-input';\nimport { BadgedInput } from '../badged-input';\nimport '../badged-input';\n\nimport emailImg from '@internetarchive/icon-email/index.js';\nimport localePinImg from '@internetarchive/icon-locale-pin/index.js';\nimport userIcon from '@internetarchive/icon-user/index.js';\n\nimport { countries } from './countries';\n\n@customElement('contact-form')\nexport class ContactForm extends LitElement {\n @query('badged-input.donation-contact-form-email') emailBadgedInput!: BadgedInput;\n @query('#donation-contact-form-email') emailField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-first-name') firstNameBadgedInput!: BadgedInput;\n @query('#donation-contact-form-first-name') firstNameField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-last-name') lastNameBadgedInput!: BadgedInput;\n @query('#donation-contact-form-last-name') lastNameField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-postal-code') postalBadgedInput!: BadgedInput;\n @query('#donation-contact-form-postal-code') postalCodeField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-street-address')\n streetAddressBadgedInput!: BadgedInput;\n @query('#donation-contact-form-street-address') streetAddressField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-extended-address')\n extendedAddressBadgedInput!: BadgedInput;\n @query('#donation-contact-form-extended-address') extendedAddressField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-locality') localityBadgedInput!: BadgedInput;\n @query('#donation-contact-form-locality') localityField!: HTMLInputElement;\n\n @query('badged-input.donation-contact-form-region') regionBadgedInput!: BadgedInput;\n @query('#donation-contact-form-region') regionField!: HTMLInputElement;\n\n @query('#donation-contact-form-countryCodeAlpha2') countryCodeAlpha2Field!: HTMLSelectElement;\n\n @query('#donation-contact-form-error-message') errorMessage!: HTMLDivElement;\n @query('form') form!: HTMLFormElement;\n\n /** @keyof countries */\n @property({ type: String }) selectedCountry = 'US';\n\n reportValidity(): boolean {\n const fieldBadgedInputs: Array<[HTMLInputElement, BadgedInput]> = [\n [this.emailField, this.emailBadgedInput],\n [this.firstNameField, this.firstNameBadgedInput],\n [this.lastNameField, this.lastNameBadgedInput],\n [this.regionField, this.regionBadgedInput],\n [this.localityField, this.localityBadgedInput],\n [this.streetAddressField, this.streetAddressBadgedInput],\n [this.postalCodeField, this.postalBadgedInput],\n ];\n\n let isValid = true;\n fieldBadgedInputs.forEach(([inputElement, badgedInput]) => {\n const fieldValid = inputElement.checkValidity();\n isValid = isValid && fieldValid;\n if (!fieldValid) {\n badgedInput.error = true;\n }\n });\n\n if (!isValid) {\n this.errorMessage.innerText = 'Please enter any missing contact information below';\n } else {\n this.errorMessage.innerText = '';\n }\n\n return isValid;\n }\n\n focus(): void {\n this.emailField.focus();\n }\n\n /** @inheritdoc */\n render(): TemplateResult {\n return html`\n <div id=\"donation-contact-form-error-message\"></div>\n <form>\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-email',\n placeholder: 'Email',\n required: true,\n fieldType: 'email',\n name: 'email',\n autocomplete: 'email',\n maxlength: 255,\n icon: emailImg,\n })}\n </div>\n </fieldset>\n\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-first-name',\n placeholder: 'First name',\n name: 'fname',\n required: true,\n maxlength: 255,\n autocomplete: 'given-name',\n icon: userIcon,\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-last-name',\n placeholder: 'Last name',\n name: 'lname',\n autocomplete: 'family-name',\n required: true,\n maxlength: 255,\n })}\n </div>\n </fieldset>\n <fieldset>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-street-address',\n placeholder: 'Address Line 1',\n required: true,\n autocomplete: 'address-line1',\n icon: localePinImg,\n name: 'street-address',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-extended-address',\n placeholder: 'Address Line 2 (optional)',\n autocomplete: 'address-line2',\n required: false,\n name: 'extended-address',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-locality',\n placeholder: 'City',\n autocomplete: 'address-level2',\n required: true,\n name: 'locality',\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-region',\n placeholder: 'State / Province',\n autocomplete: 'address-level1',\n required: true,\n name: 'region',\n })}\n ${this.generateInput({\n id: 'donation-contact-form-postal-code',\n placeholder: 'Zip / Postal',\n autocomplete: 'postal-code',\n required: true,\n name: 'postal',\n maxlength: 9,\n // must start with a character, then may contain spaces\n validationPattern: '[a-zA-Z\\\\-\\\\d]+[a-zA-Z\\\\-\\\\d\\\\s]*',\n iconSpaceOption: SpacerOption.CompressSpace,\n })}\n </div>\n <div class=\"row\">${this.countrySelectorTemplate}</div>\n </fieldset>\n </form>\n ${this.getStyles}\n `;\n }\n\n private get countrySelectorTemplate(): TemplateResult {\n return html`\n <badged-input>\n <select\n id=\"donation-contact-form-countryCodeAlpha2\"\n @change=${(e: Event) => {\n const currCountry = this.selectedCountry;\n this.selectedCountry = (e.target as HTMLInputElement)?.value\n ? ((e.target as HTMLInputElement)?.value as string)\n : currCountry;\n // update required visual cue on region/state/province & postal code fields\n if (this.selectedCountry === 'US') {\n this.postalBadgedInput?.setAttribute('required', '');\n this.postalCodeField?.setAttribute('required', '');\n this.regionBadgedInput?.setAttribute('required', '');\n this.regionField?.setAttribute('required', '');\n } else {\n this.postalBadgedInput?.removeAttribute('required');\n this.postalCodeField?.removeAttribute('required');\n this.regionBadgedInput?.removeAttribute('required');\n this.regionField?.removeAttribute('required');\n }\n }}\n >\n ${Object.keys(countries).map(key => {\n const name = countries[key];\n return html`\n <option value=${key} ?selected=${key === this.selectedCountry}>${name}</option>\n `;\n })}\n </select>\n </badged-input>\n `;\n }\n\n /** @inheritdoc */\n createRenderRoot(): this {\n // Render template without shadow DOM. Note that shadow DOM features like\n // encapsulated CSS and slots are unavailable.\n // Form autofill does not work properly in the shadow DOM\n // so we need our form fields in the light DOM\n return this;\n }\n\n // reset the error state when the user focuses the input\n private inputFocused(e: KeyboardEvent): void {\n this.errorMessage.innerText = '';\n const input = e.target as HTMLInputElement;\n const inputIdentifier = input.id;\n const badgedInput = this.querySelector(`badged-input.${inputIdentifier}`) as BadgedInput;\n badgedInput.error = false;\n }\n\n private generateInput(options: {\n id: string;\n placeholder: string;\n required?: boolean;\n fieldType?: 'text' | 'email';\n autocomplete?: AutoCompleteFieldOptions;\n maxlength?: number;\n name: string;\n icon?: TemplateResult;\n iconSpaceOption?: SpacerOption;\n validationPattern?: string;\n }): TemplateResult {\n const required = options.required ?? true;\n const fieldType = options.fieldType ?? 'text';\n const iconOption = options.iconSpaceOption ?? SpacerOption.LeaveSpace;\n\n return html`\n <badged-input\n class=${options.id}\n .icon=${options.icon}\n .iconSpaceOption=${iconOption}\n ?required=${options.required}\n >\n <label for=${options.id}>${options.placeholder}</label>\n <input\n type=${fieldType}\n id=${options.id}\n class=\"donation-contact-form-input\"\n name=${options.name}\n aria-label=${options.placeholder}\n placeholder=${options.placeholder}\n maxlength=${ifDefined(options.maxlength)}\n autocomplete=${options.autocomplete ?? 'on'}\n pattern=${ifDefined(options.validationPattern)}\n @focus=${this.inputFocused}\n ?required=${required}\n />\n </badged-input>\n `;\n }\n\n get donorContactInfo(): DonorContactInfo {\n return new DonorContactInfo({\n billing: this.billingInfo,\n customer: this.contactInfo,\n });\n }\n\n get billingInfo(): BillingInfo {\n const billingInfo = new BillingInfo({\n streetAddress: this.streetAddressField.value,\n extendedAddress: this.extendedAddressField.value,\n locality: this.localityField.value,\n region: this.regionField.value,\n postalCode: this.postalCodeField.value,\n countryCodeAlpha2: this.countryCodeAlpha2Field.value,\n });\n return billingInfo;\n }\n\n get contactInfo(): CustomerInfo {\n return new CustomerInfo({\n email: this.emailField.value,\n firstName: this.firstNameField.value,\n lastName: this.lastNameField.value,\n });\n }\n\n /**\n * This is not the normal LitElement styles block.\n *\n * This element uses the clear DOM instead of the shadow DOM so it can't use\n * the shadowRoot's isolated styling. This is a bit of a workaround to keep all of\n * the styling local by writing out our own <style> tag and just be careful about\n * the selectors since they will leak outside of this component.\n *\n * @readonly\n * @private\n * @type {TemplateResult}\n * @memberof ContactForm\n */\n private get getStyles(): TemplateResult {\n const noIconSpacerWidth = css`var(--badgedInputNoIconSpacerWidth, 3rem)`;\n const iconSpacerWidth = css`var(--badgedInputIconSpacerWidth, 5rem)`;\n\n const fieldSetSpacing = css`var(--fieldSetSpacing, 1rem)`;\n const fieldFontFamily = css`var(--fontFamily, \"Helvetica Neue\", Helvetica, Arial, sans-serif)`;\n const fieldFontSize = css`var(--contactFieldFontSize, 1.6rem)`;\n const fieldFontColor = css`var(--inputFieldFontColor, #333)`;\n\n const iconFieldWidth = css`calc(100% - ${iconSpacerWidth})`;\n const noIconFieldWidth = css`calc(100% - ${noIconSpacerWidth})`;\n\n return html`\n <style>\n /*\n **NOTE**\n This element is in the lightDOM so be sure to prefix all styles\n with \"contact-form\" so styles don't leak.\n */\n contact-form fieldset {\n border: 0;\n padding: 0;\n margin: 0;\n margin-bottom: ${fieldSetSpacing};\n background-color: white;\n }\n\n /* These 1px and 0 margins in the next few selectors are to account for the\n double outlines caused by the fields being right next to each other */\n contact-form .row {\n display: flex;\n margin: -1px 0 0 0;\n }\n\n contact-form fieldset .row:first-child {\n margin-top: 0;\n }\n\n contact-form badged-input.donation-contact-form-region {\n width: 60%;\n }\n\n contact-form badged-input.donation-contact-form-postal-code {\n width: 40%;\n }\n\n contact-form #donation-contact-form-region {\n width: ${iconFieldWidth};\n }\n\n contact-form #donation-contact-form-postal-code {\n width: ${noIconFieldWidth};\n }\n\n contact-form #donation-contact-form-error-message {\n color: red;\n font-size: 1.4rem;\n margin-bottom: 0.6rem;\n }\n\n contact-form #donation-contact-form-last-name {\n width: ${noIconFieldWidth};\n }\n\n /* only show for screen readers */\n contact-form label {\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n }\n\n contact-form .donation-contact-form-input {\n width: ${iconFieldWidth};\n border: 0;\n outline: 0;\n background: transparent;\n font-weight: bold;\n color: ${fieldFontColor};\n font-size: ${fieldFontSize};\n padding: 0;\n font-family: ${fieldFontFamily};\n }\n\n contact-form .donation-contact-form-input::placeholder {\n color: revert;\n }\n\n contact-form #donation-contact-form-countryCodeAlpha2 {\n width: calc(100%);\n height: 100%;\n box-sizing: border-box;\n font-weight: bold;\n font-size: ${fieldFontSize};\n font-family: ${fieldFontFamily};\n border: 0;\n background: #fff;\n }\n </style>\n `;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/donation-form.ts
CHANGED
|
@@ -443,7 +443,6 @@ export class DonationForm extends LitElement {
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
if (changedProperties.has('selectedPaymentProvider')) {
|
|
446
|
-
console.log('selectedPaymentProvider ** ', this.selectedPaymentProvider);
|
|
447
446
|
const event = new CustomEvent('paymentProviderSelected', {
|
|
448
447
|
detail: {
|
|
449
448
|
paymentProvider: this.selectedPaymentProvider,
|
|
@@ -411,7 +411,7 @@ export class ContactForm extends LitElement {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
contact-form #donation-contact-form-countryCodeAlpha2 {
|
|
414
|
-
width:
|
|
414
|
+
width: calc(100%);
|
|
415
415
|
height: 100%;
|
|
416
416
|
box-sizing: border-box;
|
|
417
417
|
font-weight: bold;
|
|
@@ -419,9 +419,6 @@ export class ContactForm extends LitElement {
|
|
|
419
419
|
font-family: ${fieldFontFamily};
|
|
420
420
|
border: 0;
|
|
421
421
|
background: #fff;
|
|
422
|
-
-webkit-appearance: none;
|
|
423
|
-
-moz-appearance: none;
|
|
424
|
-
appearance: none;
|
|
425
422
|
}
|
|
426
423
|
</style>
|
|
427
424
|
`;
|