@internetarchive/elements 1.9.2 → 1.10.0
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/elements/ia-donation-form/form-elements/ia-donation-edit-donation.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js +6 -2
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js.map +1 -1
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js +3 -2
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js.map +1 -1
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js +2 -1
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js.map +1 -1
- package/dist/src/elements/ia-donation-form/parse-amount.d.ts +12 -0
- package/dist/src/elements/ia-donation-form/parse-amount.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/parse-amount.js +39 -0
- package/dist/src/elements/ia-donation-form/parse-amount.js.map +1 -0
- package/dist/src/elements/ia-topnav/data/menus.d.ts +2 -1
- package/dist/src/elements/ia-topnav/data/menus.d.ts.map +1 -1
- package/dist/src/elements/ia-topnav/data/menus.js +4 -2
- package/dist/src/elements/ia-topnav/data/menus.js.map +1 -1
- package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.d.ts +1 -0
- package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.d.ts.map +1 -1
- package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.js +5 -1
- package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.js.map +1 -1
- package/dist/src/elements/ia-topnav/ia-topnav.d.ts +5 -0
- package/dist/src/elements/ia-topnav/ia-topnav.d.ts.map +1 -1
- package/dist/src/elements/ia-topnav/ia-topnav.js +11 -1
- package/dist/src/elements/ia-topnav/ia-topnav.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-edit-donation.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-edit-donation.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAUb,OAAO,EACL,mBAAmB,EAGpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,uBAAuB,CAAC;AAE/B,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC;AAE/E,2CAA2C;AAC3C,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC;AAE/E,kFAAkF;AAClF,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE,sDAAsD;AACtD,eAAO,MAAM,kCAAkC;;;;CAIrC,CAAC;AAEX,MAAM,MAAM,kCAAkC,GAC5C,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,OAAO,kCAAkC,CAAC,CAAC;AAE/F,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BhC;IAED,OAAO,CAAC,cAAc;IAqCtB,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,KAAK,wBAAwB,GAMnC;IAED,OAAO,KAAK,oBAAoB,GA6B/B;IAED,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,mBAAmB;IAM3B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,wBAAwB;IA0BhC,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,qBAAqB;IAgB7B,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAmB1B,MAAM,KAAK,MAAM,IAAI,cAAc,CAsNlC;CACF"}
|
|
@@ -7,6 +7,7 @@ import currency from 'currency.js';
|
|
|
7
7
|
import { formatUsd } from '../localized-format.js';
|
|
8
8
|
import themeStyles from '../../../themes/theme-styles.js';
|
|
9
9
|
import { CurrencyValidator } from '../currency-validator.js';
|
|
10
|
+
import { parseAmount } from '../parse-amount.js';
|
|
10
11
|
import { DonationPaymentInfo, defaultDonationAmounts, defaultSelectedDonationInfo, } from '../models/donation-payment-info.js';
|
|
11
12
|
import { DonationType } from '../models/donation-type.js';
|
|
12
13
|
import { DonationSectionBadgeMode } from './ia-donation-section.js';
|
|
@@ -352,7 +353,10 @@ let IADonationEditDonation = class IADonationEditDonation extends LitElement {
|
|
|
352
353
|
get customAmountDisplayValue() {
|
|
353
354
|
if (!this.isCustomAmount)
|
|
354
355
|
return '';
|
|
355
|
-
return currency(this.donationInfo.amount, {
|
|
356
|
+
return currency(this.donationInfo.amount, {
|
|
357
|
+
symbol: '',
|
|
358
|
+
separator: '',
|
|
359
|
+
}).format();
|
|
356
360
|
}
|
|
357
361
|
get customAmountTemplate() {
|
|
358
362
|
return html `
|
|
@@ -410,7 +414,7 @@ let IADonationEditDonation = class IADonationEditDonation extends LitElement {
|
|
|
410
414
|
this.handleCustomAmountInput(target.value);
|
|
411
415
|
}
|
|
412
416
|
handleCustomAmountInput(value) {
|
|
413
|
-
const amount =
|
|
417
|
+
const amount = parseAmount(value);
|
|
414
418
|
if (isNaN(amount)) {
|
|
415
419
|
this.dispatchEditDonationError(EditDonationInfoStatus.InvalidDonationAmount);
|
|
416
420
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-edit-donation.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAIR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,uBAAuB,CAAC;AAE/B,6DAA6D;AAC7D,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;CAClB,CAAC;AA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sBAAsB;IAFlC,aAAa,CAAC,2BAA2B,CAAC;IAC1C,SAAS,EAAE;GACC,sBAAsB,CA6wBlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { localized, msg, str } from '@lit/localize';\nimport currency from 'currency.js';\nimport { formatUsd } from '../localized-format';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\nimport { DonationSectionBadgeMode } from './ia-donation-section';\nimport './ia-donation-section';\n\n/** Whether the numbered step badges show on the sections. */\nexport const EditDonationStepNumberMode = {\n HideNumbers: 'hidenumbers',\n ShowNumbers: 'shownumbers',\n} as const;\n\nexport type EditDonationStepNumberMode =\n (typeof EditDonationStepNumberMode)[keyof typeof EditDonationStepNumberMode];\n\n/** The radio button groups in the form. */\nexport const EditDonationSelectionGroup = {\n DonationType: 'donationType',\n Amount: 'amount',\n} as const;\n\nexport type EditDonationSelectionGroup =\n (typeof EditDonationSelectionGroup)[keyof typeof EditDonationSelectionGroup];\n\n/** The outcome of validating an amount. Sent in the `editDonationError` event. */\nexport const EditDonationInfoStatus = {\n ValidDonationAmount: 'valid_donation_amount',\n InvalidDonationAmount: 'invalid_donation_amount',\n DonationTooHigh: 'donation_too_high',\n DonationTooLow: 'donation_too_low',\n} as const;\n\nexport type EditDonationInfoStatus =\n (typeof EditDonationInfoStatus)[keyof typeof EditDonationInfoStatus];\n\n/** How the one-time / monthly choice is presented. */\nexport const EditDonationFrequencySelectionMode = {\n Button: 'button',\n Checkbox: 'checkbox',\n Hide: 'hide',\n} as const;\n\nexport type EditDonationFrequencySelectionMode =\n (typeof EditDonationFrequencySelectionMode)[keyof typeof EditDonationFrequencySelectionMode];\n\n/** Whether the amount buttons wrap onto several lines or stay on one. */\nexport const EditDonationAmountSelectionLayout = {\n SingleLine: 'single-line',\n MultiLine: 'multi-line',\n} as const;\n\nexport type EditDonationAmountSelectionLayout =\n (typeof EditDonationAmountSelectionLayout)[keyof typeof EditDonationAmountSelectionLayout];\n\n/**\n * The part of the donation form where the donor picks a frequency, an amount\n * (preset or custom) and whether to cover the processing fee. Fires\n * `donationInfoChanged` with the new `DonationPaymentInfo` on every change\n * and `editDonationError` when a custom amount is out of range.\n *\n * The petabox donation banner uses this on its own, without the rest of the\n * form.\n */\n@customElement('ia-donation-edit-donation')\n@localized()\nexport class IADonationEditDonation extends LitElement {\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n @property({ type: String })\n stepNumberMode: EditDonationStepNumberMode =\n EditDonationStepNumberMode.ShowNumbers;\n\n /**\n * A convenience for setting the selected amount from plain HTML. When\n * present it wins over `donationInfo`.\n */\n @property({ type: Number }) defaultSelectedAmount?: number;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String, reflect: true })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String, reflect: true }) customAmountMode:\n | 'display'\n | 'hide' = 'display';\n\n @property({ type: String, reflect: true }) coverFeesCheckboxMode:\n | 'display'\n | 'hide' = 'display';\n\n /** `slot` renders the `edit-donation-amount-title` slot in place of the default headline. */\n @property({ type: String, reflect: true }) amountTitleDisplayMode:\n | 'default'\n | 'slot' = 'default';\n\n @state() private error?: TemplateResult;\n\n @state() private customAmountSelected = false;\n\n @query('#custom-amount-button') private customAmountButton!: HTMLInputElement;\n\n @query('#custom-amount-input') private customAmountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n const amountTitle =\n this.amountTitleDisplayMode === 'default'\n ? msg('Choose an amount (USD)')\n : '';\n return html`\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? this.frequencyButtonsTemplate\n : nothing}\n\n <ia-donation-section\n sectionBadge=\"${this.amountSelectionSectionNumber}\"\n headline=${amountTitle}\n badgeMode=${this.formSectionNumberMode}\n >\n ${this.amountTitleDisplayMode === 'slot'\n ? html`<slot name=\"edit-donation-amount-title\"></slot>`\n : nothing}\n <ul class=\"amount-selector\">\n ${this.presetAmountsTemplate}\n ${this.customAmountMode === 'display'\n ? html`<li class=\"custom-amount\">${this.customAmountTemplate}</li>`\n : nothing}\n </ul>\n\n <div class=\"errors\" id=\"amount-errors\" aria-live=\"polite\">\n ${this.error}\n </div>\n\n ${this.coverFeesCheckboxMode === 'display'\n ? html`<div class=\"checkbox-options\">\n ${this.coverFeesCheckboxTemplate}\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Checkbox\n ? this.frequencyCheckboxTemplate\n : nothing}\n </div>`\n : nothing}\n </ia-donation-section>\n `;\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('customAmountSelected')) {\n if (this.customAmountButton) {\n this.customAmountButton.checked = this.customAmountSelected;\n }\n }\n if (changedProperties.has('amountOptions')) {\n this.customAmountSelected = false;\n this.updateSelectedDonationInfo();\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('amountSelectionLayout')) {\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('donationInfo')) {\n this.updateSelectedDonationInfo();\n }\n if (\n changedProperties.has('defaultSelectedAmount') &&\n this.defaultSelectedAmount !== undefined\n ) {\n this.customAmountSelected = false;\n this.donationInfo = new DonationPaymentInfo({\n donationType: this.donationInfo.donationType,\n amount: this.defaultSelectedAmount,\n coverFees: this.donationInfo.coverFees,\n });\n }\n }\n\n private get frequencyButtonsTemplate(): TemplateResult {\n return html`\n <ia-donation-section\n sectionBadge=\"1\"\n headline=${msg('Choose a frequency')}\n badgeMode=${this.formSectionNumberMode}\n >\n <ul class=\"frequency-selector\">\n ${this.frequencyTemplate}\n </ul>\n </ia-donation-section>\n `;\n }\n\n private get frequencyCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"make-this-monthly\"\n @input=${this.monthlyCheckboxChecked}\n .checked=${this.donationInfo.donationType === DonationType.Monthly}\n tabindex=\"0\"\n />\n <label for=\"make-this-monthly\">${msg('Make this monthly')}</label>\n </div>\n `;\n }\n\n private get coverFeesCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"cover-fees\"\n @input=${this.coverFeesChecked}\n .checked=${this.donationInfo.coverFees}\n tabindex=\"0\"\n />\n <label for=\"cover-fees\">${this.coverFeesText}</label>\n </div>\n `;\n }\n\n /** The amount step is 2 when the frequency buttons come first, otherwise 1. */\n private get amountSelectionSectionNumber(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 2\n : 1;\n }\n\n private get formSectionNumberMode(): DonationSectionBadgeMode {\n switch (this.stepNumberMode) {\n case EditDonationStepNumberMode.ShowNumbers:\n return DonationSectionBadgeMode.ShowBadge;\n case EditDonationStepNumberMode.HideNumbers:\n return DonationSectionBadgeMode.HideBadge;\n }\n }\n\n /**\n * Picks the amount grid's column count, and how many columns the custom\n * amount field spans, from how many preset amounts there are.\n */\n private setupAmountColumnsLayoutConfig(): void {\n const minimalView =\n this.customAmountMode === 'hide' &&\n this.coverFeesCheckboxMode === 'hide' &&\n this.frequencySelectionMode === EditDonationFrequencySelectionMode.Hide;\n const amountCount = this.amountOptions.length;\n let columnCount = 5;\n let customAmountSpan = 3;\n switch (amountCount) {\n case 7:\n columnCount = 5;\n customAmountSpan = 3;\n break;\n case 6:\n columnCount = 4;\n customAmountSpan = 2;\n break;\n case 5:\n columnCount = 4;\n customAmountSpan = 3;\n break;\n case 4:\n if (minimalView) {\n columnCount = 4;\n customAmountSpan = 0;\n break;\n }\n columnCount = 3;\n customAmountSpan = 2;\n break;\n case 3:\n columnCount = 2;\n customAmountSpan = 1;\n break;\n }\n\n if (\n this.amountSelectionLayout ===\n EditDonationAmountSelectionLayout.SingleLine\n ) {\n columnCount = amountCount + 3;\n customAmountSpan = 3;\n }\n\n this.style.setProperty(\n '--ia-donation-edit-amount-column-count',\n `${columnCount}`,\n );\n this.style.setProperty(\n '--ia-donation-edit-custom-amount-col-span',\n `${customAmountSpan}`,\n );\n }\n\n /**\n * Syncs the radios and the custom field with `donationInfo`. A preset\n * amount checks its radio and clears the custom field; anything else\n * selects the custom field and formats the amount into it.\n */\n private updateSelectedDonationInfo(): void {\n // Keep the custom amount selected while the donor is typing in it, even\n // if the value matches a preset, so the selection doesn't jump to the\n // preset radio mid-keystroke.\n // With the custom field hidden both sides would be null, so guard on it\n // existing first.\n const typingInCustomAmount =\n !!this.customAmountInput &&\n this.shadowRoot?.activeElement === this.customAmountInput;\n if (\n !this.isCustomAmount &&\n !(this.customAmountSelected && typingInCustomAmount)\n ) {\n const radioButton = this.shadowRoot?.querySelector<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${EditDonationSelectionGroup.Amount}\"][value=\"${this.donationInfo.amount}\"]`,\n );\n if (radioButton) radioButton.checked = true;\n this.customAmountSelected = false;\n this.error = undefined;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n } else {\n this.customAmountSelected = true;\n // Leave the field alone while it has focus, the donor may be typing\n if (!typingInCustomAmount && this.customAmountInput) {\n this.customAmountInput.value = this.customAmountDisplayValue;\n const donationInfoStatus = this.getDonationInfoStatus(\n this.donationInfo.amount,\n );\n this.handleDonationInfoStatus(donationInfoStatus);\n }\n }\n }\n\n private get coverFeesText(): string {\n const feeAmountString = formatUsd(this.donationInfo.fee);\n\n return msg(str`I'll generously add ${feeAmountString} to cover fees.`);\n }\n\n /**\n * Formats a dollar amount without cents when it's a whole number and with\n * them when it isn't: `$5` and `$5.50`.\n */\n private formatShortenedAmount(dollars: number): string {\n const precision = dollars % 1 === 0 ? 0 : 2;\n return formatUsd(dollars, precision);\n }\n\n private get frequencyTemplate(): TemplateResult {\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.OneTime,\n displayText: msg('One time'),\n checked: this.donationInfo.donationType === DonationType.OneTime,\n })}\n </li>\n\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.Monthly,\n displayText: msg('Monthly'),\n checked: this.donationInfo.donationType === DonationType.Monthly,\n })}\n </li>\n `;\n }\n\n private get presetAmountsTemplate(): TemplateResult {\n return html`\n ${this.amountOptions.map((amount) => {\n const checked =\n !this.customAmountSelected && amount === this.donationInfo.amount;\n\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.Amount,\n value: `${amount}`,\n displayText: this.formatShortenedAmount(amount),\n checked,\n })}\n </li>\n `;\n })}\n `;\n }\n\n private getRadioButton(options: {\n group: EditDonationSelectionGroup;\n value: string;\n displayText: string;\n checked: boolean;\n }): TemplateResult {\n const radioId = `${options.group}-${options.value}-option`;\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${options.group}\n value=${options.value}\n id=${radioId}\n tabindex=\"0\"\n .checked=${options.checked}\n @change=${this.radioSelected}\n @click=${(e: Event): void => {\n // `change` doesn't fire when the checked radio is clicked again,\n // so re-selecting the current amount is caught here. It matters\n // after a custom amount, which unchecks the presets visually.\n const isAmountSelection =\n options.group === EditDonationSelectionGroup.Amount;\n if (isAmountSelection) {\n const isSameValue =\n parseFloat(options.value) === this.donationInfo.amount;\n if (isSameValue) {\n this.radioSelected(e);\n }\n }\n }}\n />\n <label for=${radioId}>${options.displayText}</label>\n </div>\n `;\n }\n\n private get isCustomAmount(): boolean {\n return !this.amountOptions.includes(this.donationInfo.amount);\n }\n\n private get customAmountDisplayValue(): string {\n if (!this.isCustomAmount) return '';\n return currency(this.donationInfo.amount, { symbol: '' }).format();\n }\n\n private get customAmountTemplate(): TemplateResult {\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${EditDonationSelectionGroup.Amount}\n value=\"custom\"\n id=\"custom-amount-button\"\n tabindex=\"0\"\n @change=${this.customRadioSelected}\n />\n\n <label for=\"custom-amount-button\">\n <span class=\"custom-amount-text\">${msg('Custom: $')}</span\n ><input\n type=\"text\"\n id=\"custom-amount-input\"\n tabindex=\"-1\"\n aria-label=${msg('Custom amount in dollars')}\n aria-describedby=\"amount-errors\"\n value=${this.customAmountDisplayValue}\n @input=${this.customAmountChanged}\n @keydown=${this.currencyValidator.keydown}\n @focus=${this.customAmountFocused}\n @blur=${this.customAmountBlurred}\n />\n </label>\n </div>\n `;\n }\n\n private customRadioSelected(): void {\n this.customAmountInput.focus();\n }\n\n private customAmountFocused(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n /**\n * Once focus leaves the custom field the mid-keystroke protection is over,\n * so the UI re-syncs with `donationInfo`: a typed amount equal to a preset\n * moves to that preset, anything else gets re-formatted in place.\n */\n private customAmountBlurred(): void {\n this.updateSelectedDonationInfo();\n }\n\n private coverFeesChecked(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.updateDonationInfo({ coverFees: target.checked });\n }\n\n private customAmountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseFloat(value);\n if (isNaN(amount)) {\n this.dispatchEditDonationError(\n EditDonationInfoStatus.InvalidDonationAmount,\n );\n } else {\n this.amountChanged(amount);\n }\n }\n\n private handleDonationInfoStatus(status: EditDonationInfoStatus): void {\n switch (status) {\n case EditDonationInfoStatus.ValidDonationAmount:\n this.error = undefined;\n break;\n case EditDonationInfoStatus.DonationTooHigh:\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.DonationTooLow:\n if (this.customAmountInput.value.length > 0) {\n this.error = html`${msg('Please select an amount (minimum $1)')}`;\n }\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.InvalidDonationAmount:\n this.error = html`${msg('Please enter a valid donation amount')}`;\n this.dispatchEditDonationError(status);\n break;\n }\n }\n\n private amountChanged(amount: number): void {\n const donationInfoStatus = this.getDonationInfoStatus(amount);\n this.handleDonationInfoStatus(donationInfoStatus);\n\n // Only a valid amount makes it into the donation info\n if (donationInfoStatus === EditDonationInfoStatus.ValidDonationAmount) {\n this.updateDonationInfo({ amount });\n }\n }\n\n private getDonationInfoStatus(amount: number): EditDonationInfoStatus {\n if (isNaN(amount)) {\n return EditDonationInfoStatus.InvalidDonationAmount;\n }\n\n if (amount >= 10000) {\n return EditDonationInfoStatus.DonationTooHigh;\n }\n\n if (amount < 1) {\n return EditDonationInfoStatus.DonationTooLow;\n }\n\n return EditDonationInfoStatus.ValidDonationAmount;\n }\n\n private radioSelected(e: Event): void {\n const radioButton = e.target as HTMLInputElement;\n const group = radioButton.name as EditDonationSelectionGroup;\n const { value } = radioButton;\n\n switch (group) {\n case EditDonationSelectionGroup.Amount:\n this.presetAmountChanged(parseFloat(value));\n break;\n case EditDonationSelectionGroup.DonationType:\n this.updateDonationInfo({ donationType: value as DonationType });\n break;\n default:\n break;\n }\n }\n\n private monthlyCheckboxChecked(e: Event): void {\n const isChecked = (e.target as HTMLInputElement).checked;\n const donationType = isChecked\n ? DonationType.Monthly\n : DonationType.OneTime;\n this.updateDonationInfo({ donationType });\n }\n\n private dispatchEditDonationError(error: EditDonationInfoStatus): void {\n const event = new CustomEvent('editDonationError', {\n detail: { error },\n });\n this.dispatchEvent(event);\n }\n\n private presetAmountChanged(amount: number): void {\n this.error = undefined;\n this.customAmountSelected = false;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n this.updateDonationInfo({ amount });\n }\n\n private updateDonationInfo(options: {\n donationType?: DonationType;\n amount?: number;\n coverFees?: boolean;\n }): void {\n const newDonationInfo = new DonationPaymentInfo({\n donationType: options.donationType ?? this.donationInfo.donationType,\n amount: options.amount ?? this.donationInfo.amount,\n coverFees: options.coverFees ?? this.donationInfo.coverFees,\n });\n\n this.donationInfo = newDonationInfo;\n\n const event = new CustomEvent('donationInfoChanged', {\n detail: { donationInfo: newDonationInfo },\n });\n this.dispatchEvent(event);\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps the element self-contained, so it looks the same\n * whatever the page's root size is. Override it to rescale\n * everything, sections included.\n */\n --donation-edit-base-font-size--: var(\n --ia-donation-edit-base-font-size,\n 10px\n );\n\n --donation-edit-button-border-color--: var(\n --ia-donation-edit-button-border-color,\n var(--mid-gray)\n );\n --donation-edit-button-grid-gap--: var(\n --ia-donation-edit-button-grid-gap,\n var(--donation-edit-base-font-size--)\n );\n --donation-edit-button-font-size--: var(\n --ia-donation-edit-button-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.6)\n );\n --donation-edit-button-font-color--: var(\n --ia-donation-edit-button-font-color,\n #000\n );\n --donation-edit-button-selected-font-color--: var(\n --ia-donation-edit-button-selected-font-color,\n #000\n );\n --donation-edit-button-selected-color--: var(\n --ia-donation-edit-button-selected-color,\n #f9bf3b\n );\n --donation-edit-button-focused-outline-color--: var(\n --ia-donation-edit-button-focused-outline-color,\n #7fb3f9\n );\n --donation-edit-button-color--: var(\n --ia-donation-edit-button-color,\n var(--true-white)\n );\n --donation-edit-cover-fees-font-size--: var(\n --ia-donation-edit-cover-fees-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.2)\n );\n --donation-edit-cover-fees-font-weight--: var(\n --ia-donation-edit-cover-fees-font-weight,\n bold\n );\n --donation-edit-custom-amount-width--: var(\n --ia-donation-edit-custom-amount-width,\n calc(var(--donation-edit-base-font-size--) * 4)\n );\n --donation-edit-input-font-color--: var(\n --ia-donation-edit-input-font-color,\n var(--mid-gray)\n );\n --donation-edit-input-border--: var(\n --ia-donation-edit-input-border,\n 1px solid #d9d9d9\n );\n /* These two are set on the host by the element itself, from the number of amounts */\n --donation-edit-amount-column-count--: var(\n --ia-donation-edit-amount-column-count,\n 5\n );\n --donation-edit-custom-amount-col-span--: var(\n --ia-donation-edit-custom-amount-col-span,\n 3\n );\n --donation-edit-error-color--: var(--color-danger);\n\n /* Passed through to the sections */\n --ia-donation-section-base-font-size: var(\n --donation-edit-base-font-size--\n );\n --ia-donation-section-background-color: var(\n --ia-donation-edit-background-color,\n transparent\n );\n --ia-donation-section-badge-background-color: var(\n --ia-donation-edit-badge-background-color,\n var(--mid-gray)\n );\n --ia-donation-section-badge-font-color: var(\n --ia-donation-edit-badge-font-color,\n var(--true-white)\n );\n }\n\n .errors {\n color: var(--donation-edit-error-color--);\n font-size: calc(var(--donation-edit-base-font-size--) * 1.4);\n margin-top: var(--padding-sm);\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-gap: var(--donation-edit-button-grid-gap--);\n }\n\n li {\n margin: 0;\n padding: 0;\n display: inline-block;\n }\n\n .frequency-selector {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .amount-selector {\n grid-template-columns: repeat(\n var(--donation-edit-amount-column-count--),\n 1fr\n );\n }\n\n .custom-amount {\n grid-column: span var(--donation-edit-custom-amount-col-span--);\n }\n\n .selection-button {\n height: calc(var(--donation-edit-base-font-size--) * 3);\n }\n\n .selection-button label {\n padding: 0 calc(var(--donation-edit-base-font-size--) * 0.3);\n display: flex;\n cursor: pointer;\n text-align: center;\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n border: 1px solid var(--donation-edit-button-border-color--);\n border-radius: 5px;\n height: 100%;\n justify-content: center;\n align-items: center;\n }\n\n label[for='custom-amount-button'] {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .custom-amount-text {\n white-space: nowrap;\n margin-right: var(--padding-sm);\n }\n\n input[type='radio'] {\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n }\n\n input[type='radio'] + label {\n color: var(--donation-edit-button-font-color--);\n background-color: var(--donation-edit-button-color--);\n }\n\n input[type='radio']:checked + label {\n color: var(--donation-edit-button-selected-font-color--);\n background-color: var(--donation-edit-button-selected-color--);\n }\n\n input[type='radio']:focus + label {\n outline: 2px solid var(--donation-edit-button-focused-outline-color--);\n }\n\n .checkbox-options {\n margin-top: var(--donation-edit-base-font-size--);\n }\n\n .checkbox-option-container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .checkbox-option-container input {\n width: calc(var(--donation-edit-base-font-size--) * 2);\n }\n\n .checkbox-option-container label {\n font-size: var(--donation-edit-cover-fees-font-size--);\n font-weight: var(--donation-edit-cover-fees-font-weight--);\n flex: 1;\n }\n\n #custom-amount-input {\n width: var(--donation-edit-custom-amount-width--);\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n color: var(--donation-edit-input-font-color--);\n padding: calc(var(--donation-edit-base-font-size--) * 0.1);\n border: var(--donation-edit-input-border--);\n appearance: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-donation-edit-donation.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAIR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,QAAQ,MAAM,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EAEmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sEAEE;AAED;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gEAEnB;AAEoB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qEAEnB;AAGoB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sEAEnB;AAEN;IAAhB,KAAK,EAAE;qDAAgC;AAEvB;IAAhB,KAAK,EAAE;oEAAsC;AAEN;IAAvC,KAAK,CAAC,uBAAuB,CAAC;kEAA+C;AAEvC;IAAtC,KAAK,CAAC,sBAAsB,CAAC;iEAA8C;AA3CjE,sBAAsB;IAFlC,aAAa,CAAC,2BAA2B,CAAC;IAC1C,SAAS,EAAE;GACC,sBAAsB,CAgxBlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { localized, msg, str } from '@lit/localize';\nimport currency from 'currency.js';\nimport { formatUsd } from '../localized-format';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\nimport { parseAmount } from '../parse-amount';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\nimport { DonationSectionBadgeMode } from './ia-donation-section';\nimport './ia-donation-section';\n\n/** Whether the numbered step badges show on the sections. */\nexport const EditDonationStepNumberMode = {\n HideNumbers: 'hidenumbers',\n ShowNumbers: 'shownumbers',\n} as const;\n\nexport type EditDonationStepNumberMode =\n (typeof EditDonationStepNumberMode)[keyof typeof EditDonationStepNumberMode];\n\n/** The radio button groups in the form. */\nexport const EditDonationSelectionGroup = {\n DonationType: 'donationType',\n Amount: 'amount',\n} as const;\n\nexport type EditDonationSelectionGroup =\n (typeof EditDonationSelectionGroup)[keyof typeof EditDonationSelectionGroup];\n\n/** The outcome of validating an amount. Sent in the `editDonationError` event. */\nexport const EditDonationInfoStatus = {\n ValidDonationAmount: 'valid_donation_amount',\n InvalidDonationAmount: 'invalid_donation_amount',\n DonationTooHigh: 'donation_too_high',\n DonationTooLow: 'donation_too_low',\n} as const;\n\nexport type EditDonationInfoStatus =\n (typeof EditDonationInfoStatus)[keyof typeof EditDonationInfoStatus];\n\n/** How the one-time / monthly choice is presented. */\nexport const EditDonationFrequencySelectionMode = {\n Button: 'button',\n Checkbox: 'checkbox',\n Hide: 'hide',\n} as const;\n\nexport type EditDonationFrequencySelectionMode =\n (typeof EditDonationFrequencySelectionMode)[keyof typeof EditDonationFrequencySelectionMode];\n\n/** Whether the amount buttons wrap onto several lines or stay on one. */\nexport const EditDonationAmountSelectionLayout = {\n SingleLine: 'single-line',\n MultiLine: 'multi-line',\n} as const;\n\nexport type EditDonationAmountSelectionLayout =\n (typeof EditDonationAmountSelectionLayout)[keyof typeof EditDonationAmountSelectionLayout];\n\n/**\n * The part of the donation form where the donor picks a frequency, an amount\n * (preset or custom) and whether to cover the processing fee. Fires\n * `donationInfoChanged` with the new `DonationPaymentInfo` on every change\n * and `editDonationError` when a custom amount is out of range.\n *\n * The petabox donation banner uses this on its own, without the rest of the\n * form.\n */\n@customElement('ia-donation-edit-donation')\n@localized()\nexport class IADonationEditDonation extends LitElement {\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n @property({ type: String })\n stepNumberMode: EditDonationStepNumberMode =\n EditDonationStepNumberMode.ShowNumbers;\n\n /**\n * A convenience for setting the selected amount from plain HTML. When\n * present it wins over `donationInfo`.\n */\n @property({ type: Number }) defaultSelectedAmount?: number;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String, reflect: true })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String, reflect: true }) customAmountMode:\n | 'display'\n | 'hide' = 'display';\n\n @property({ type: String, reflect: true }) coverFeesCheckboxMode:\n | 'display'\n | 'hide' = 'display';\n\n /** `slot` renders the `edit-donation-amount-title` slot in place of the default headline. */\n @property({ type: String, reflect: true }) amountTitleDisplayMode:\n | 'default'\n | 'slot' = 'default';\n\n @state() private error?: TemplateResult;\n\n @state() private customAmountSelected = false;\n\n @query('#custom-amount-button') private customAmountButton!: HTMLInputElement;\n\n @query('#custom-amount-input') private customAmountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n const amountTitle =\n this.amountTitleDisplayMode === 'default'\n ? msg('Choose an amount (USD)')\n : '';\n return html`\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? this.frequencyButtonsTemplate\n : nothing}\n\n <ia-donation-section\n sectionBadge=\"${this.amountSelectionSectionNumber}\"\n headline=${amountTitle}\n badgeMode=${this.formSectionNumberMode}\n >\n ${this.amountTitleDisplayMode === 'slot'\n ? html`<slot name=\"edit-donation-amount-title\"></slot>`\n : nothing}\n <ul class=\"amount-selector\">\n ${this.presetAmountsTemplate}\n ${this.customAmountMode === 'display'\n ? html`<li class=\"custom-amount\">${this.customAmountTemplate}</li>`\n : nothing}\n </ul>\n\n <div class=\"errors\" id=\"amount-errors\" aria-live=\"polite\">\n ${this.error}\n </div>\n\n ${this.coverFeesCheckboxMode === 'display'\n ? html`<div class=\"checkbox-options\">\n ${this.coverFeesCheckboxTemplate}\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Checkbox\n ? this.frequencyCheckboxTemplate\n : nothing}\n </div>`\n : nothing}\n </ia-donation-section>\n `;\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('customAmountSelected')) {\n if (this.customAmountButton) {\n this.customAmountButton.checked = this.customAmountSelected;\n }\n }\n if (changedProperties.has('amountOptions')) {\n this.customAmountSelected = false;\n this.updateSelectedDonationInfo();\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('amountSelectionLayout')) {\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('donationInfo')) {\n this.updateSelectedDonationInfo();\n }\n if (\n changedProperties.has('defaultSelectedAmount') &&\n this.defaultSelectedAmount !== undefined\n ) {\n this.customAmountSelected = false;\n this.donationInfo = new DonationPaymentInfo({\n donationType: this.donationInfo.donationType,\n amount: this.defaultSelectedAmount,\n coverFees: this.donationInfo.coverFees,\n });\n }\n }\n\n private get frequencyButtonsTemplate(): TemplateResult {\n return html`\n <ia-donation-section\n sectionBadge=\"1\"\n headline=${msg('Choose a frequency')}\n badgeMode=${this.formSectionNumberMode}\n >\n <ul class=\"frequency-selector\">\n ${this.frequencyTemplate}\n </ul>\n </ia-donation-section>\n `;\n }\n\n private get frequencyCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"make-this-monthly\"\n @input=${this.monthlyCheckboxChecked}\n .checked=${this.donationInfo.donationType === DonationType.Monthly}\n tabindex=\"0\"\n />\n <label for=\"make-this-monthly\">${msg('Make this monthly')}</label>\n </div>\n `;\n }\n\n private get coverFeesCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"cover-fees\"\n @input=${this.coverFeesChecked}\n .checked=${this.donationInfo.coverFees}\n tabindex=\"0\"\n />\n <label for=\"cover-fees\">${this.coverFeesText}</label>\n </div>\n `;\n }\n\n /** The amount step is 2 when the frequency buttons come first, otherwise 1. */\n private get amountSelectionSectionNumber(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 2\n : 1;\n }\n\n private get formSectionNumberMode(): DonationSectionBadgeMode {\n switch (this.stepNumberMode) {\n case EditDonationStepNumberMode.ShowNumbers:\n return DonationSectionBadgeMode.ShowBadge;\n case EditDonationStepNumberMode.HideNumbers:\n return DonationSectionBadgeMode.HideBadge;\n }\n }\n\n /**\n * Picks the amount grid's column count, and how many columns the custom\n * amount field spans, from how many preset amounts there are.\n */\n private setupAmountColumnsLayoutConfig(): void {\n const minimalView =\n this.customAmountMode === 'hide' &&\n this.coverFeesCheckboxMode === 'hide' &&\n this.frequencySelectionMode === EditDonationFrequencySelectionMode.Hide;\n const amountCount = this.amountOptions.length;\n let columnCount = 5;\n let customAmountSpan = 3;\n switch (amountCount) {\n case 7:\n columnCount = 5;\n customAmountSpan = 3;\n break;\n case 6:\n columnCount = 4;\n customAmountSpan = 2;\n break;\n case 5:\n columnCount = 4;\n customAmountSpan = 3;\n break;\n case 4:\n if (minimalView) {\n columnCount = 4;\n customAmountSpan = 0;\n break;\n }\n columnCount = 3;\n customAmountSpan = 2;\n break;\n case 3:\n columnCount = 2;\n customAmountSpan = 1;\n break;\n }\n\n if (\n this.amountSelectionLayout ===\n EditDonationAmountSelectionLayout.SingleLine\n ) {\n columnCount = amountCount + 3;\n customAmountSpan = 3;\n }\n\n this.style.setProperty(\n '--ia-donation-edit-amount-column-count',\n `${columnCount}`,\n );\n this.style.setProperty(\n '--ia-donation-edit-custom-amount-col-span',\n `${customAmountSpan}`,\n );\n }\n\n /**\n * Syncs the radios and the custom field with `donationInfo`. A preset\n * amount checks its radio and clears the custom field; anything else\n * selects the custom field and formats the amount into it.\n */\n private updateSelectedDonationInfo(): void {\n // Keep the custom amount selected while the donor is typing in it, even\n // if the value matches a preset, so the selection doesn't jump to the\n // preset radio mid-keystroke.\n // With the custom field hidden both sides would be null, so guard on it\n // existing first.\n const typingInCustomAmount =\n !!this.customAmountInput &&\n this.shadowRoot?.activeElement === this.customAmountInput;\n if (\n !this.isCustomAmount &&\n !(this.customAmountSelected && typingInCustomAmount)\n ) {\n const radioButton = this.shadowRoot?.querySelector<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${EditDonationSelectionGroup.Amount}\"][value=\"${this.donationInfo.amount}\"]`,\n );\n if (radioButton) radioButton.checked = true;\n this.customAmountSelected = false;\n this.error = undefined;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n } else {\n this.customAmountSelected = true;\n // Leave the field alone while it has focus, the donor may be typing\n if (!typingInCustomAmount && this.customAmountInput) {\n this.customAmountInput.value = this.customAmountDisplayValue;\n const donationInfoStatus = this.getDonationInfoStatus(\n this.donationInfo.amount,\n );\n this.handleDonationInfoStatus(donationInfoStatus);\n }\n }\n }\n\n private get coverFeesText(): string {\n const feeAmountString = formatUsd(this.donationInfo.fee);\n\n return msg(str`I'll generously add ${feeAmountString} to cover fees.`);\n }\n\n /**\n * Formats a dollar amount without cents when it's a whole number and with\n * them when it isn't: `$5` and `$5.50`.\n */\n private formatShortenedAmount(dollars: number): string {\n const precision = dollars % 1 === 0 ? 0 : 2;\n return formatUsd(dollars, precision);\n }\n\n private get frequencyTemplate(): TemplateResult {\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.OneTime,\n displayText: msg('One time'),\n checked: this.donationInfo.donationType === DonationType.OneTime,\n })}\n </li>\n\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.Monthly,\n displayText: msg('Monthly'),\n checked: this.donationInfo.donationType === DonationType.Monthly,\n })}\n </li>\n `;\n }\n\n private get presetAmountsTemplate(): TemplateResult {\n return html`\n ${this.amountOptions.map((amount) => {\n const checked =\n !this.customAmountSelected && amount === this.donationInfo.amount;\n\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.Amount,\n value: `${amount}`,\n displayText: this.formatShortenedAmount(amount),\n checked,\n })}\n </li>\n `;\n })}\n `;\n }\n\n private getRadioButton(options: {\n group: EditDonationSelectionGroup;\n value: string;\n displayText: string;\n checked: boolean;\n }): TemplateResult {\n const radioId = `${options.group}-${options.value}-option`;\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${options.group}\n value=${options.value}\n id=${radioId}\n tabindex=\"0\"\n .checked=${options.checked}\n @change=${this.radioSelected}\n @click=${(e: Event): void => {\n // `change` doesn't fire when the checked radio is clicked again,\n // so re-selecting the current amount is caught here. It matters\n // after a custom amount, which unchecks the presets visually.\n const isAmountSelection =\n options.group === EditDonationSelectionGroup.Amount;\n if (isAmountSelection) {\n const isSameValue =\n parseFloat(options.value) === this.donationInfo.amount;\n if (isSameValue) {\n this.radioSelected(e);\n }\n }\n }}\n />\n <label for=${radioId}>${options.displayText}</label>\n </div>\n `;\n }\n\n private get isCustomAmount(): boolean {\n return !this.amountOptions.includes(this.donationInfo.amount);\n }\n\n private get customAmountDisplayValue(): string {\n if (!this.isCustomAmount) return '';\n return currency(this.donationInfo.amount, {\n symbol: '',\n separator: '',\n }).format();\n }\n\n private get customAmountTemplate(): TemplateResult {\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${EditDonationSelectionGroup.Amount}\n value=\"custom\"\n id=\"custom-amount-button\"\n tabindex=\"0\"\n @change=${this.customRadioSelected}\n />\n\n <label for=\"custom-amount-button\">\n <span class=\"custom-amount-text\">${msg('Custom: $')}</span\n ><input\n type=\"text\"\n id=\"custom-amount-input\"\n tabindex=\"-1\"\n aria-label=${msg('Custom amount in dollars')}\n aria-describedby=\"amount-errors\"\n value=${this.customAmountDisplayValue}\n @input=${this.customAmountChanged}\n @keydown=${this.currencyValidator.keydown}\n @focus=${this.customAmountFocused}\n @blur=${this.customAmountBlurred}\n />\n </label>\n </div>\n `;\n }\n\n private customRadioSelected(): void {\n this.customAmountInput.focus();\n }\n\n private customAmountFocused(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n /**\n * Once focus leaves the custom field the mid-keystroke protection is over,\n * so the UI re-syncs with `donationInfo`: a typed amount equal to a preset\n * moves to that preset, anything else gets re-formatted in place.\n */\n private customAmountBlurred(): void {\n this.updateSelectedDonationInfo();\n }\n\n private coverFeesChecked(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.updateDonationInfo({ coverFees: target.checked });\n }\n\n private customAmountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseAmount(value);\n if (isNaN(amount)) {\n this.dispatchEditDonationError(\n EditDonationInfoStatus.InvalidDonationAmount,\n );\n } else {\n this.amountChanged(amount);\n }\n }\n\n private handleDonationInfoStatus(status: EditDonationInfoStatus): void {\n switch (status) {\n case EditDonationInfoStatus.ValidDonationAmount:\n this.error = undefined;\n break;\n case EditDonationInfoStatus.DonationTooHigh:\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.DonationTooLow:\n if (this.customAmountInput.value.length > 0) {\n this.error = html`${msg('Please select an amount (minimum $1)')}`;\n }\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.InvalidDonationAmount:\n this.error = html`${msg('Please enter a valid donation amount')}`;\n this.dispatchEditDonationError(status);\n break;\n }\n }\n\n private amountChanged(amount: number): void {\n const donationInfoStatus = this.getDonationInfoStatus(amount);\n this.handleDonationInfoStatus(donationInfoStatus);\n\n // Only a valid amount makes it into the donation info\n if (donationInfoStatus === EditDonationInfoStatus.ValidDonationAmount) {\n this.updateDonationInfo({ amount });\n }\n }\n\n private getDonationInfoStatus(amount: number): EditDonationInfoStatus {\n if (isNaN(amount)) {\n return EditDonationInfoStatus.InvalidDonationAmount;\n }\n\n if (amount >= 10000) {\n return EditDonationInfoStatus.DonationTooHigh;\n }\n\n if (amount < 1) {\n return EditDonationInfoStatus.DonationTooLow;\n }\n\n return EditDonationInfoStatus.ValidDonationAmount;\n }\n\n private radioSelected(e: Event): void {\n const radioButton = e.target as HTMLInputElement;\n const group = radioButton.name as EditDonationSelectionGroup;\n const { value } = radioButton;\n\n switch (group) {\n case EditDonationSelectionGroup.Amount:\n this.presetAmountChanged(parseFloat(value));\n break;\n case EditDonationSelectionGroup.DonationType:\n this.updateDonationInfo({ donationType: value as DonationType });\n break;\n default:\n break;\n }\n }\n\n private monthlyCheckboxChecked(e: Event): void {\n const isChecked = (e.target as HTMLInputElement).checked;\n const donationType = isChecked\n ? DonationType.Monthly\n : DonationType.OneTime;\n this.updateDonationInfo({ donationType });\n }\n\n private dispatchEditDonationError(error: EditDonationInfoStatus): void {\n const event = new CustomEvent('editDonationError', {\n detail: { error },\n });\n this.dispatchEvent(event);\n }\n\n private presetAmountChanged(amount: number): void {\n this.error = undefined;\n this.customAmountSelected = false;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n this.updateDonationInfo({ amount });\n }\n\n private updateDonationInfo(options: {\n donationType?: DonationType;\n amount?: number;\n coverFees?: boolean;\n }): void {\n const newDonationInfo = new DonationPaymentInfo({\n donationType: options.donationType ?? this.donationInfo.donationType,\n amount: options.amount ?? this.donationInfo.amount,\n coverFees: options.coverFees ?? this.donationInfo.coverFees,\n });\n\n this.donationInfo = newDonationInfo;\n\n const event = new CustomEvent('donationInfoChanged', {\n detail: { donationInfo: newDonationInfo },\n });\n this.dispatchEvent(event);\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps the element self-contained, so it looks the same\n * whatever the page's root size is. Override it to rescale\n * everything, sections included.\n */\n --donation-edit-base-font-size--: var(\n --ia-donation-edit-base-font-size,\n 10px\n );\n\n --donation-edit-button-border-color--: var(\n --ia-donation-edit-button-border-color,\n var(--mid-gray)\n );\n --donation-edit-button-grid-gap--: var(\n --ia-donation-edit-button-grid-gap,\n var(--donation-edit-base-font-size--)\n );\n --donation-edit-button-font-size--: var(\n --ia-donation-edit-button-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.6)\n );\n --donation-edit-button-font-color--: var(\n --ia-donation-edit-button-font-color,\n #000\n );\n --donation-edit-button-selected-font-color--: var(\n --ia-donation-edit-button-selected-font-color,\n #000\n );\n --donation-edit-button-selected-color--: var(\n --ia-donation-edit-button-selected-color,\n #f9bf3b\n );\n --donation-edit-button-focused-outline-color--: var(\n --ia-donation-edit-button-focused-outline-color,\n #7fb3f9\n );\n --donation-edit-button-color--: var(\n --ia-donation-edit-button-color,\n var(--true-white)\n );\n --donation-edit-cover-fees-font-size--: var(\n --ia-donation-edit-cover-fees-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.2)\n );\n --donation-edit-cover-fees-font-weight--: var(\n --ia-donation-edit-cover-fees-font-weight,\n bold\n );\n --donation-edit-custom-amount-width--: var(\n --ia-donation-edit-custom-amount-width,\n calc(var(--donation-edit-base-font-size--) * 4)\n );\n --donation-edit-input-font-color--: var(\n --ia-donation-edit-input-font-color,\n var(--mid-gray)\n );\n --donation-edit-input-border--: var(\n --ia-donation-edit-input-border,\n 1px solid #d9d9d9\n );\n /* These two are set on the host by the element itself, from the number of amounts */\n --donation-edit-amount-column-count--: var(\n --ia-donation-edit-amount-column-count,\n 5\n );\n --donation-edit-custom-amount-col-span--: var(\n --ia-donation-edit-custom-amount-col-span,\n 3\n );\n --donation-edit-error-color--: var(--color-danger);\n\n /* Passed through to the sections */\n --ia-donation-section-base-font-size: var(\n --donation-edit-base-font-size--\n );\n --ia-donation-section-background-color: var(\n --ia-donation-edit-background-color,\n transparent\n );\n --ia-donation-section-badge-background-color: var(\n --ia-donation-edit-badge-background-color,\n var(--mid-gray)\n );\n --ia-donation-section-badge-font-color: var(\n --ia-donation-edit-badge-font-color,\n var(--true-white)\n );\n }\n\n .errors {\n color: var(--donation-edit-error-color--);\n font-size: calc(var(--donation-edit-base-font-size--) * 1.4);\n margin-top: var(--padding-sm);\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-gap: var(--donation-edit-button-grid-gap--);\n }\n\n li {\n margin: 0;\n padding: 0;\n display: inline-block;\n }\n\n .frequency-selector {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .amount-selector {\n grid-template-columns: repeat(\n var(--donation-edit-amount-column-count--),\n 1fr\n );\n }\n\n .custom-amount {\n grid-column: span var(--donation-edit-custom-amount-col-span--);\n }\n\n .selection-button {\n height: calc(var(--donation-edit-base-font-size--) * 3);\n }\n\n .selection-button label {\n padding: 0 calc(var(--donation-edit-base-font-size--) * 0.3);\n display: flex;\n cursor: pointer;\n text-align: center;\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n border: 1px solid var(--donation-edit-button-border-color--);\n border-radius: 5px;\n height: 100%;\n justify-content: center;\n align-items: center;\n }\n\n label[for='custom-amount-button'] {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .custom-amount-text {\n white-space: nowrap;\n margin-right: var(--padding-sm);\n }\n\n input[type='radio'] {\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n }\n\n input[type='radio'] + label {\n color: var(--donation-edit-button-font-color--);\n background-color: var(--donation-edit-button-color--);\n }\n\n input[type='radio']:checked + label {\n color: var(--donation-edit-button-selected-font-color--);\n background-color: var(--donation-edit-button-selected-color--);\n }\n\n input[type='radio']:focus + label {\n outline: 2px solid var(--donation-edit-button-focused-outline-color--);\n }\n\n .checkbox-options {\n margin-top: var(--donation-edit-base-font-size--);\n }\n\n .checkbox-option-container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .checkbox-option-container input {\n width: calc(var(--donation-edit-base-font-size--) * 2);\n }\n\n .checkbox-option-container label {\n font-size: var(--donation-edit-cover-fees-font-size--);\n font-weight: var(--donation-edit-cover-fees-font-weight--);\n flex: 1;\n }\n\n #custom-amount-input {\n width: var(--donation-edit-custom-amount-width--);\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n color: var(--donation-edit-input-font-color--);\n padding: calc(var(--donation-edit-base-font-size--) * 0.1);\n border: var(--donation-edit-input-border--);\n appearance: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-form-controller.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAIb,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EACV,iCAAiC,EACjC,yBAAyB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,mBAAmB,EAGpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,uDAAuD,CAAC;AAC/D,OAAO,gDAAgD,CAAC;AACxD,OAAO,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AACH,qBACa,wB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AY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;QAC7B,iBAAiB,EAAE,MAAM,IAAI,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjB,sEAAsE;IAChE,kBAAkB,CAAC,OAAO,EAAE;QAChC,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,kBAAkB,CAAC;QAC7B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;QACxB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;KACtC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjB,OAAO,CAAC,qBAAqB;IA6C7B,OAAO,CAAC,qBAAqB,CAAS;YAExB,qBAAqB;IAgBnC,YAAY,IAAI,IAAI;IAKpB;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;
|
|
1
|
+
{"version":3,"file":"ia-donation-form-controller.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAIb,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EACV,iCAAiC,EACjC,yBAAyB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAC;AAErC,OA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B,IAAI,IAAI;IAIxB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,uBAAuB;IAoB/B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,YAAY;IAIpB,8CAA8C;IAC9C,OAAO,CAAC,QAAQ;IAShB,wDAAwD;IACxD,OAAO,CAAC,oBAAoB;IAS5B;;;;;;;OAOG;IACH,OAAO,KAAK,SAAS,GAyEpB;CACF"}
|
|
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html, LitElement, } from 'lit';
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../utils/custom-element.js';
|
|
5
|
-
import
|
|
5
|
+
import { parseAmount } from './parse-amount.js';
|
|
6
6
|
import { LazyLoaderService, } from '@internetarchive/lazy-loader-service';
|
|
7
7
|
import { BraintreeManager } from './braintree/braintree-manager.js';
|
|
8
8
|
import { PaymentClients, } from './braintree/payment-clients.js';
|
|
@@ -160,7 +160,8 @@ let IADonationFormController = class IADonationFormController extends LitElement
|
|
|
160
160
|
let amount = this.donationInfo.amount;
|
|
161
161
|
const amountParam = urlParams.get('amt');
|
|
162
162
|
if (amountParam) {
|
|
163
|
-
|
|
163
|
+
// Links like ?amt=$10 or ?amt=10 USD have always worked
|
|
164
|
+
const parsedAmount = parseAmount(amountParam.replace(/usd|\$/gi, '').trim());
|
|
164
165
|
if (parsedAmount > 0) {
|
|
165
166
|
amount = parsedAmount;
|
|
166
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-form-controller.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form-controller.ts"],"names":[],"mappings":";AACA,OAAO,EACL,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,E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EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAuB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAiB;AAEhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAyB;AAGpD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEACyB;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAA8C;AAE7C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAsC;AAGrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAAgC;AAE/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAA8C;AAE7C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAA8C;AAGzE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEACwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA0C;AAMrE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAC6C;AAErC;IAAlC,KAAK,CAAC,kBAAkB,CAAC;8DAAuC;AAGzD;IADP,KAAK,CAAC,gCAAgC,CAAC;yEACqB;AAGrD;IADP,KAAK,CAAC,0BAA0B,CAAC;6DACU;AAjEjC,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CA+jBpC","sourcesContent":["import type * as braintree from 'braintree-web';\nimport {\n html,\n LitElement,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport currency from 'currency.js';\nimport {\n LazyLoaderService,\n type LazyLoaderServiceInterface,\n} from '@internetarchive/lazy-loader-service';\nimport type { ModalManagerInterface } from '@src/elements/modal-manager/models';\nimport type {\n AnalyticsEvent,\n AnalyticsManagerInterface,\n} from '@internetarchive/analytics-manager';\n\nimport { BraintreeManager } from './braintree/braintree-manager';\nimport type {\n BraintreeEndpointManagerInterface,\n BraintreeManagerInterface,\n} from './braintree/braintree-manager-interface';\nimport type { HostingEnvironment } from './braintree/hosting-environment';\nimport {\n PaymentClients,\n type PaymentClientsInterface,\n} from './braintree/payment-clients';\nimport { HostedFieldConfiguration } from './braintree/payment-providers/credit-card/hosted-field-configuration';\nimport {\n PaymentFlowHandlers,\n type PaymentFlowHandlersInterface,\n} from './flow-handlers/payment-flow-handlers';\nimport type { IADonationContactForm } from './form-elements/contact-form/ia-donation-contact-form';\nimport {\n EditDonationAmountSelectionLayout,\n EditDonationFrequencySelectionMode,\n} from './form-elements/ia-donation-edit-donation';\nimport type { IADonationCreditCardFields } from './form-elements/ia-donation-credit-card-fields';\nimport type { IADonationForm } from './ia-donation-form';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from './models/donation-payment-info';\nimport { DonationType } from './models/donation-type';\nimport type { PaymentProvider } from './models/payment-provider';\nimport type { UpsellModalCTAMode } from './modals/ia-donation-upsell-modal-content';\nimport {\n RecaptchaManager,\n type RecaptchaManagerInterface,\n} from './recaptcha-manager';\nimport './form-elements/contact-form/ia-donation-contact-form';\nimport './form-elements/ia-donation-credit-card-fields';\nimport './ia-donation-form';\n\n/**\n * Wires the donation form to everything around it: Braintree and the payment\n * libraries, the modal manager, recaptcha, and analytics. Give it the\n * environment, tokens and an endpoint manager and it builds the rest.\n *\n * It renders into the light DOM, because Braintree's hosted fields, the\n * PayPal button and recaptcha all refuse to work inside a shadow root. Those\n * are rendered here and slotted into `<ia-donation-form>`.\n */\n@customElement('ia-donation-form-controller')\nexport class IADonationFormController extends LitElement {\n @property({ type: String }) environment?: HostingEnvironment;\n\n @property({ type: String }) braintreeAuthToken?: string;\n\n @property({ type: String }) recaptchaSiteKey?: string;\n\n @property({ type: String }) venmoProfileId?: string;\n\n @property({ type: String }) googlePayMerchantId?: string;\n\n @property({ type: String }) analyticsCategory = 'DonationForm';\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: Object }) donationInfo: DonationPaymentInfo =\n defaultSelectedDonationInfo;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String }) referrer?: string;\n\n @property({ type: String }) loggedInUser?: string;\n\n @property({ type: String }) origin?: string;\n\n @property({ type: String }) donorEmail: string = '';\n\n @property({ type: Object })\n endpointManager?: BraintreeEndpointManagerInterface;\n\n @property({ type: Object }) analyticsHandler?: AnalyticsManagerInterface;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /** The element recaptcha renders its (invisible) widget into. Must be in the light DOM. */\n @property({ type: Object }) recaptchaElement?: HTMLElement;\n\n @property({ type: Object }) braintreeManager?: BraintreeManagerInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n @property({ type: Object })\n paymentFlowHandlers?: PaymentFlowHandlersInterface;\n\n @property({ type: Object }) paymentClients?: PaymentClientsInterface;\n\n /** The clients this element built itself, so it knows when it may rebuild them */\n private defaultPaymentClients?: PaymentClientsInterface;\n\n @property({ type: Object })\n lazyLoaderService: LazyLoaderServiceInterface = new LazyLoaderService();\n\n @query('ia-donation-form') private donationForm!: IADonationForm;\n\n @query('ia-donation-credit-card-fields')\n private creditCardFieldsElement!: IADonationCreditCardFields;\n\n @query('ia-donation-contact-form')\n private contactForm?: IADonationContactForm;\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('referrer') && this.referrer) {\n this.braintreeManager?.setReferrer(this.referrer);\n this.logDonationFlowEvent('referrer', this.referrer);\n }\n\n if (changedProperties.has('loggedInUser') && this.loggedInUser) {\n this.braintreeManager?.setLoggedInUser(this.loggedInUser);\n }\n\n if (changedProperties.has('origin') && this.origin) {\n this.braintreeManager?.setOrigin(this.origin);\n this.logDonationFlowEvent('origin', this.origin);\n }\n\n if (\n changedProperties.has('paymentClients') ||\n changedProperties.has('braintreeAuthToken') ||\n changedProperties.has('endpointManager') ||\n changedProperties.has('environment')\n ) {\n this.setupBraintreeManager();\n this.setupRecaptchaManager();\n }\n\n if (changedProperties.has('recaptchaSiteKey')) {\n this.setupRecaptchaManager();\n }\n\n if (\n changedProperties.has('braintreeManager') ||\n changedProperties.has('recaptchaManager') ||\n changedProperties.has('modalManager') ||\n changedProperties.has('recaptchaElement')\n ) {\n this.setupPaymentFlowHandlers();\n }\n\n // Build the default clients for the environment, unless the consumer\n // supplied their own\n if (\n (changedProperties.has('environment') ||\n changedProperties.has('lazyLoaderService')) &&\n this.environment &&\n (this.paymentClients === undefined ||\n this.paymentClients === this.defaultPaymentClients)\n ) {\n this.defaultPaymentClients = new PaymentClients(\n this.lazyLoaderService,\n this.environment,\n );\n this.paymentClients = this.defaultPaymentClients;\n }\n }\n\n /** Developer convenience: show the confirmation step without a payment. */\n async showConfirmationStepDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: () => void;\n confirmDonationCB: () => void;\n }): Promise<void> {\n this.donationForm.showConfirmationModalDev(options);\n }\n\n /** Developer convenience: show the upsell modal without a payment. */\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.donationForm.showUpsellModalDev(options);\n }\n\n private setupBraintreeManager(): void {\n if (\n this.braintreeManager === undefined &&\n this.braintreeAuthToken &&\n this.endpointManager &&\n this.paymentClients &&\n this.environment\n ) {\n this.braintreeManager = new BraintreeManager({\n paymentClients: this.paymentClients,\n endpointManager: this.endpointManager,\n authorizationToken: this.braintreeAuthToken,\n venmoProfileId: this.venmoProfileId,\n googlePayMerchantId: this.googlePayMerchantId,\n hostedFieldConfig: this.hostedFieldConfig,\n hostingEnvironment: this.environment,\n referrer: this.referrer,\n loggedInUser: this.loggedInUser,\n origin: this.origin,\n });\n\n this.braintreeManager.on(\n 'paymentProvidersHostedFieldsRetry',\n (retryNumber: number) => {\n this.dispatchEvent(\n new CustomEvent('paymentProvidersHostedFieldsRetry', {\n detail: { retryNumber },\n }),\n );\n },\n );\n\n this.braintreeManager.on(\n 'paymentProvidersHostedFieldsFailed',\n (error: unknown) => {\n this.dispatchEvent(\n new CustomEvent('paymentProvidersHostedFieldsFailed', {\n detail: { error },\n }),\n );\n },\n );\n }\n }\n\n private recaptchaManagerSetup = false;\n\n private async setupRecaptchaManager(): Promise<void> {\n if (\n !this.recaptchaSiteKey ||\n !this.paymentClients ||\n this.recaptchaManagerSetup\n ) {\n return;\n }\n this.recaptchaManagerSetup = true;\n const grecaptchaLibrary = await this.paymentClients.recaptchaLibrary.get();\n this.recaptchaManager = new RecaptchaManager({\n grecaptchaLibrary,\n siteKey: this.recaptchaSiteKey,\n });\n }\n\n firstUpdated(): void {\n this.configureFromQueryParams();\n this.trackViewedEvent();\n }\n\n /**\n * The donate page links carry the starting configuration in the query\n * string: `amt`, `contrib_type`, `coverFees`, `dollarAmounts`,\n * `amountLayout` and `frequencyMode`.\n */\n private configureFromQueryParams(): void {\n const urlParams = new URLSearchParams(window.location.search);\n\n let amountOptions = this.amountOptions;\n const amountOptionsParam = urlParams.get('dollarAmounts');\n if (amountOptionsParam) {\n // e.g. `[5,10,25]`\n const stripBrackets = amountOptionsParam.slice(1, -1);\n amountOptions = stripBrackets\n .split(',')\n .map((value) => parseFloat(value))\n .filter((value) => !isNaN(value));\n }\n\n let coverFees = this.donationInfo.coverFees;\n const coverFeesParam = urlParams.get('coverFees');\n if (coverFeesParam) {\n coverFees = coverFeesParam === 'true';\n }\n\n let frequency = this.donationInfo.donationType;\n const frequencyParam = urlParams.get('contrib_type');\n if (frequencyParam === 'monthly') {\n frequency = DonationType.Monthly;\n }\n\n let amount = this.donationInfo.amount;\n const amountParam = urlParams.get('amt');\n if (amountParam) {\n const parsedAmount = currency(amountParam).value;\n if (parsedAmount > 0) {\n amount = parsedAmount;\n }\n }\n\n const amountLayoutParam = urlParams.get('amountLayout');\n if (amountLayoutParam) {\n const amountLayout =\n amountLayoutParam as EditDonationAmountSelectionLayout;\n if (\n Object.values(EditDonationAmountSelectionLayout).includes(amountLayout)\n ) {\n this.amountSelectionLayout = amountLayout;\n }\n }\n\n const frequencyModeParam = urlParams.get('frequencyMode');\n if (frequencyModeParam) {\n const frequencyMode =\n frequencyModeParam as EditDonationFrequencySelectionMode;\n if (\n Object.values(EditDonationFrequencySelectionMode).includes(\n frequencyMode,\n )\n ) {\n this.frequencySelectionMode = frequencyMode;\n }\n }\n\n this.amountOptions = amountOptions;\n this.donationInfo = new DonationPaymentInfo({\n donationType: frequency,\n amount,\n coverFees,\n });\n }\n\n private setupPaymentFlowHandlers(): void {\n if (this.paymentFlowHandlers) {\n return;\n }\n\n if (\n !this.braintreeManager ||\n !this.recaptchaManager ||\n !this.modalManager ||\n !this.recaptchaElement\n ) {\n return;\n }\n\n this.paymentFlowHandlers = new PaymentFlowHandlers({\n braintreeManager: this.braintreeManager,\n modalManager: this.modalManager,\n recaptchaManager: this.recaptchaManager,\n analytics: {\n logEvent: this.logEvent.bind(this),\n logDonationFlowEvent: this.logDonationFlowEvent.bind(this),\n },\n });\n\n this.donationForm.braintreeManager = this.braintreeManager;\n this.donationForm.paymentFlowHandlers = this.paymentFlowHandlers;\n\n this.braintreeManager.startup();\n this.paymentFlowHandlers.startup();\n this.recaptchaManager.setup(this.recaptchaElement, 1, 'light', 'image');\n }\n\n private get hostedFieldConfig(): HostedFieldConfiguration {\n const hostedFieldStyle: Record<string, Record<string, string>> = {\n input: {\n 'font-size': '16px',\n 'font-family': '\"Helvetica Neue\", Helvetica, Arial, sans-serif',\n 'font-weight': '700',\n color: '#333',\n },\n ':focus': {\n color: '#333',\n },\n // The text color stays the same when valid or invalid. The badged\n // input's red border and the error message already show the error\n // state, and red text on top of them is confusing.\n '.valid': {\n color: '#333',\n },\n '.invalid': {\n color: '#333',\n },\n };\n\n // No placeholders. The visible labels above each field are the only text.\n const hostedFieldFieldOptions: braintree.HostedFieldFieldOptions = {\n number: {\n selector: '#braintree-creditcard',\n },\n cvv: {\n selector: '#braintree-cvv',\n },\n expirationDate: {\n selector: '#braintree-expiration',\n },\n };\n\n const hostedFieldContainer =\n this.creditCardFieldsElement.hostedFieldContainer;\n\n return new HostedFieldConfiguration({\n hostedFieldStyle,\n hostedFieldFieldOptions,\n hostedFieldContainer,\n });\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"ia-donation-form-controller-container\">\n <ia-donation-form\n .braintreeManager=${this.braintreeManager}\n .contactForm=${this.contactForm}\n .amountOptions=${this.amountOptions}\n .donationInfo=${this.donationInfo}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @paymentProviderSelected=${this.paymentProviderSelected}\n @paymentFlowStarted=${this.paymentFlowStarted}\n @paymentFlowConfirmed=${this.paymentFlowConfirmed}\n @paymentFlowCancelled=${this.paymentFlowCancelled}\n @paymentFlowError=${this.paymentFlowError}\n >\n <!--\n Braintree's hosted fields, the PayPal button and recaptcha can't\n live in a shadow root, so they render here in the light DOM and\n are slotted into the form. See\n https://github.com/braintree/braintree-web-drop-in/issues/614\n and https://github.com/paypal/paypal-checkout-components/issues/353\n -->\n <div slot=\"braintree-hosted-fields\">\n <ia-donation-credit-card-fields></ia-donation-credit-card-fields>\n </div>\n\n <!-- Autofill doesn't reach into shadow DOM, so the contact form is light DOM too -->\n <div slot=\"contact-form\">\n <ia-donation-contact-form\n .donorEmail=${this.donorEmail}\n ></ia-donation-contact-form>\n </div>\n\n <div slot=\"paypal-button\">\n <div id=\"paypal-button\"></div>\n </div>\n\n <slot name=\"recaptcha\" slot=\"recaptcha\"></slot>\n </ia-donation-form>\n </div>\n\n ${this.getStyles}\n `;\n }\n\n /** Light DOM, for the payment libraries that can't render into a shadow root */\n createRenderRoot(): this {\n return this;\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n this.logEvent('DonationInfoChanged');\n this.donationInfo = e.detail.donationInfo;\n }\n\n private trackViewedEvent(): void {\n this.logEvent('Viewed');\n }\n\n private paymentProviderSelected(e: CustomEvent): void {\n const paymentProvider = e.detail.paymentProvider as\n | PaymentProvider\n | undefined;\n const previousPaymentProvider = e.detail.previousPaymentProvider as\n | PaymentProvider\n | undefined;\n const providerNoSpaces = this.removeSpaces(paymentProvider ?? 'unset');\n let eventName = `ProviderFirstSelected-${providerNoSpaces}`;\n let previousProviderInfo: string | undefined;\n if (previousPaymentProvider !== undefined) {\n eventName = `ProviderChangedTo-${providerNoSpaces}`;\n previousProviderInfo = `ProviderChangedFrom-${this.removeSpaces(\n previousPaymentProvider,\n )}`;\n }\n\n this.logEvent(eventName, previousProviderInfo);\n }\n\n private paymentFlowConfirmed(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowConfirmed',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowStarted(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowStarted',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowCancelled(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowCancelled',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowError(e: CustomEvent): void {\n const providerNoSpaces = this.removeSpaces(e.detail.paymentProvider);\n this.logEvent('PaymentFlowError', `${providerNoSpaces}-${e.detail.error}`);\n }\n\n private removeSpaces(original: string): string {\n return original.replace(/\\s+/g, '');\n }\n\n /** A sampled event in this form's category */\n private logEvent(action: string, label?: string): void {\n const analyticEvent: AnalyticsEvent = {\n action,\n label,\n category: this.analyticsCategory,\n };\n this.analyticsHandler?.sendEvent(analyticEvent);\n }\n\n /** An unsampled event in the `DonationFlow` category */\n private logDonationFlowEvent(action: string, label?: string): void {\n const analyticEvent: AnalyticsEvent = {\n action,\n label,\n category: 'DonationFlow',\n };\n this.analyticsHandler?.sendEventNoSampling(analyticEvent);\n }\n\n /**\n * The element renders into the light DOM, so instead of a `styles` block\n * it writes its own `<style>` tag, scoped to its container class.\n *\n * The `--ia-donation-form-*` variables set here are the consumer-facing\n * theming for the whole form; they fan out to the sections, the amount\n * picker and the payment buttons.\n */\n private get getStyles(): TemplateResult {\n return html`\n <style>\n .ia-donation-form-controller-container {\n --donation-form-controller-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n color: var(--ia-donation-form-text-color, #333);\n background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n\n --ia-donation-section-background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n --ia-donation-edit-background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n\n --ia-donation-section-badge-background-color: var(\n --ia-donation-form-badge-background-color,\n #333\n );\n --ia-donation-edit-badge-background-color: var(\n --ia-donation-form-badge-background-color,\n #333\n );\n\n --ia-donation-section-badge-font-color: var(\n --ia-donation-form-badge-text-color,\n #fff\n );\n --ia-donation-edit-badge-font-color: var(\n --ia-donation-form-badge-text-color,\n #fff\n );\n\n --ia-donation-edit-button-font-color: var(\n --ia-donation-form-payment-option-text-color\n );\n --ia-donation-edit-button-color: var(\n --ia-donation-form-payment-option-background-color\n );\n --ia-donation-edit-button-selected-color: var(\n --ia-donation-form-selected-option-background-color\n );\n --ia-donation-edit-button-selected-font-color: var(\n --ia-donation-form-selected-option-text-color\n );\n }\n\n .ia-donation-form-controller-container ia-donation-form:focus {\n outline: none;\n }\n\n /* The real PayPal button, kept but nearly invisible under the local one */\n .ia-donation-form-controller-container #paypal-button {\n opacity: 0.001;\n width: calc(var(--donation-form-controller-base-font-size--) * 5);\n height: calc(var(--donation-form-controller-base-font-size--) * 3);\n overflow: hidden;\n }\n\n .ia-donation-form-controller-container\n div[slot='braintree-hosted-fields'] {\n background-color: white;\n }\n </style>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-donation-form-controller.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form-controller.ts"],"names":[],"mappings":";AACA,OAAO,EACL,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,iBAAiB,GAElB,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,OAAO,EACL,cAAc,GAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sEAAsE,CAAC;AAChH,OAAO,EACL,mBAAmB,GAEpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EACL,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,uDAAuD,CAAC;AAC/D,OAAO,gDAAgD,CAAC;AACxD,OAAO,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAAjD;;QAWuB,sBAAiB,GAAG,cAAc,CAAC;QAEpC,kBAAa,GAAa,sBAAsB,CAAC;Q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C;IAAlC,KAAK,CAAC,kBAAkB,CAAC;8DAAuC;AAGzD;IADP,KAAK,CAAC,gCAAgC,CAAC;yEACqB;AAGrD;IADP,KAAK,CAAC,0BAA0B,CAAC;6DACU;AAjEjC,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAkkBpC","sourcesContent":["import type * as braintree from 'braintree-web';\nimport {\n html,\n LitElement,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { parseAmount } from './parse-amount';\nimport {\n LazyLoaderService,\n type LazyLoaderServiceInterface,\n} from '@internetarchive/lazy-loader-service';\nimport type { ModalManagerInterface } from '@src/elements/modal-manager/models';\nimport type {\n AnalyticsEvent,\n AnalyticsManagerInterface,\n} from '@internetarchive/analytics-manager';\n\nimport { BraintreeManager } from './braintree/braintree-manager';\nimport type {\n BraintreeEndpointManagerInterface,\n BraintreeManagerInterface,\n} from './braintree/braintree-manager-interface';\nimport type { HostingEnvironment } from './braintree/hosting-environment';\nimport {\n PaymentClients,\n type PaymentClientsInterface,\n} from './braintree/payment-clients';\nimport { HostedFieldConfiguration } from './braintree/payment-providers/credit-card/hosted-field-configuration';\nimport {\n PaymentFlowHandlers,\n type PaymentFlowHandlersInterface,\n} from './flow-handlers/payment-flow-handlers';\nimport type { IADonationContactForm } from './form-elements/contact-form/ia-donation-contact-form';\nimport {\n EditDonationAmountSelectionLayout,\n EditDonationFrequencySelectionMode,\n} from './form-elements/ia-donation-edit-donation';\nimport type { IADonationCreditCardFields } from './form-elements/ia-donation-credit-card-fields';\nimport type { IADonationForm } from './ia-donation-form';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from './models/donation-payment-info';\nimport { DonationType } from './models/donation-type';\nimport type { PaymentProvider } from './models/payment-provider';\nimport type { UpsellModalCTAMode } from './modals/ia-donation-upsell-modal-content';\nimport {\n RecaptchaManager,\n type RecaptchaManagerInterface,\n} from './recaptcha-manager';\nimport './form-elements/contact-form/ia-donation-contact-form';\nimport './form-elements/ia-donation-credit-card-fields';\nimport './ia-donation-form';\n\n/**\n * Wires the donation form to everything around it: Braintree and the payment\n * libraries, the modal manager, recaptcha, and analytics. Give it the\n * environment, tokens and an endpoint manager and it builds the rest.\n *\n * It renders into the light DOM, because Braintree's hosted fields, the\n * PayPal button and recaptcha all refuse to work inside a shadow root. Those\n * are rendered here and slotted into `<ia-donation-form>`.\n */\n@customElement('ia-donation-form-controller')\nexport class IADonationFormController extends LitElement {\n @property({ type: String }) environment?: HostingEnvironment;\n\n @property({ type: String }) braintreeAuthToken?: string;\n\n @property({ type: String }) recaptchaSiteKey?: string;\n\n @property({ type: String }) venmoProfileId?: string;\n\n @property({ type: String }) googlePayMerchantId?: string;\n\n @property({ type: String }) analyticsCategory = 'DonationForm';\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: Object }) donationInfo: DonationPaymentInfo =\n defaultSelectedDonationInfo;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String }) referrer?: string;\n\n @property({ type: String }) loggedInUser?: string;\n\n @property({ type: String }) origin?: string;\n\n @property({ type: String }) donorEmail: string = '';\n\n @property({ type: Object })\n endpointManager?: BraintreeEndpointManagerInterface;\n\n @property({ type: Object }) analyticsHandler?: AnalyticsManagerInterface;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /** The element recaptcha renders its (invisible) widget into. Must be in the light DOM. */\n @property({ type: Object }) recaptchaElement?: HTMLElement;\n\n @property({ type: Object }) braintreeManager?: BraintreeManagerInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n @property({ type: Object })\n paymentFlowHandlers?: PaymentFlowHandlersInterface;\n\n @property({ type: Object }) paymentClients?: PaymentClientsInterface;\n\n /** The clients this element built itself, so it knows when it may rebuild them */\n private defaultPaymentClients?: PaymentClientsInterface;\n\n @property({ type: Object })\n lazyLoaderService: LazyLoaderServiceInterface = new LazyLoaderService();\n\n @query('ia-donation-form') private donationForm!: IADonationForm;\n\n @query('ia-donation-credit-card-fields')\n private creditCardFieldsElement!: IADonationCreditCardFields;\n\n @query('ia-donation-contact-form')\n private contactForm?: IADonationContactForm;\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('referrer') && this.referrer) {\n this.braintreeManager?.setReferrer(this.referrer);\n this.logDonationFlowEvent('referrer', this.referrer);\n }\n\n if (changedProperties.has('loggedInUser') && this.loggedInUser) {\n this.braintreeManager?.setLoggedInUser(this.loggedInUser);\n }\n\n if (changedProperties.has('origin') && this.origin) {\n this.braintreeManager?.setOrigin(this.origin);\n this.logDonationFlowEvent('origin', this.origin);\n }\n\n if (\n changedProperties.has('paymentClients') ||\n changedProperties.has('braintreeAuthToken') ||\n changedProperties.has('endpointManager') ||\n changedProperties.has('environment')\n ) {\n this.setupBraintreeManager();\n this.setupRecaptchaManager();\n }\n\n if (changedProperties.has('recaptchaSiteKey')) {\n this.setupRecaptchaManager();\n }\n\n if (\n changedProperties.has('braintreeManager') ||\n changedProperties.has('recaptchaManager') ||\n changedProperties.has('modalManager') ||\n changedProperties.has('recaptchaElement')\n ) {\n this.setupPaymentFlowHandlers();\n }\n\n // Build the default clients for the environment, unless the consumer\n // supplied their own\n if (\n (changedProperties.has('environment') ||\n changedProperties.has('lazyLoaderService')) &&\n this.environment &&\n (this.paymentClients === undefined ||\n this.paymentClients === this.defaultPaymentClients)\n ) {\n this.defaultPaymentClients = new PaymentClients(\n this.lazyLoaderService,\n this.environment,\n );\n this.paymentClients = this.defaultPaymentClients;\n }\n }\n\n /** Developer convenience: show the confirmation step without a payment. */\n async showConfirmationStepDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: () => void;\n confirmDonationCB: () => void;\n }): Promise<void> {\n this.donationForm.showConfirmationModalDev(options);\n }\n\n /** Developer convenience: show the upsell modal without a payment. */\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.donationForm.showUpsellModalDev(options);\n }\n\n private setupBraintreeManager(): void {\n if (\n this.braintreeManager === undefined &&\n this.braintreeAuthToken &&\n this.endpointManager &&\n this.paymentClients &&\n this.environment\n ) {\n this.braintreeManager = new BraintreeManager({\n paymentClients: this.paymentClients,\n endpointManager: this.endpointManager,\n authorizationToken: this.braintreeAuthToken,\n venmoProfileId: this.venmoProfileId,\n googlePayMerchantId: this.googlePayMerchantId,\n hostedFieldConfig: this.hostedFieldConfig,\n hostingEnvironment: this.environment,\n referrer: this.referrer,\n loggedInUser: this.loggedInUser,\n origin: this.origin,\n });\n\n this.braintreeManager.on(\n 'paymentProvidersHostedFieldsRetry',\n (retryNumber: number) => {\n this.dispatchEvent(\n new CustomEvent('paymentProvidersHostedFieldsRetry', {\n detail: { retryNumber },\n }),\n );\n },\n );\n\n this.braintreeManager.on(\n 'paymentProvidersHostedFieldsFailed',\n (error: unknown) => {\n this.dispatchEvent(\n new CustomEvent('paymentProvidersHostedFieldsFailed', {\n detail: { error },\n }),\n );\n },\n );\n }\n }\n\n private recaptchaManagerSetup = false;\n\n private async setupRecaptchaManager(): Promise<void> {\n if (\n !this.recaptchaSiteKey ||\n !this.paymentClients ||\n this.recaptchaManagerSetup\n ) {\n return;\n }\n this.recaptchaManagerSetup = true;\n const grecaptchaLibrary = await this.paymentClients.recaptchaLibrary.get();\n this.recaptchaManager = new RecaptchaManager({\n grecaptchaLibrary,\n siteKey: this.recaptchaSiteKey,\n });\n }\n\n firstUpdated(): void {\n this.configureFromQueryParams();\n this.trackViewedEvent();\n }\n\n /**\n * The donate page links carry the starting configuration in the query\n * string: `amt`, `contrib_type`, `coverFees`, `dollarAmounts`,\n * `amountLayout` and `frequencyMode`.\n */\n private configureFromQueryParams(): void {\n const urlParams = new URLSearchParams(window.location.search);\n\n let amountOptions = this.amountOptions;\n const amountOptionsParam = urlParams.get('dollarAmounts');\n if (amountOptionsParam) {\n // e.g. `[5,10,25]`\n const stripBrackets = amountOptionsParam.slice(1, -1);\n amountOptions = stripBrackets\n .split(',')\n .map((value) => parseFloat(value))\n .filter((value) => !isNaN(value));\n }\n\n let coverFees = this.donationInfo.coverFees;\n const coverFeesParam = urlParams.get('coverFees');\n if (coverFeesParam) {\n coverFees = coverFeesParam === 'true';\n }\n\n let frequency = this.donationInfo.donationType;\n const frequencyParam = urlParams.get('contrib_type');\n if (frequencyParam === 'monthly') {\n frequency = DonationType.Monthly;\n }\n\n let amount = this.donationInfo.amount;\n const amountParam = urlParams.get('amt');\n if (amountParam) {\n // Links like ?amt=$10 or ?amt=10 USD have always worked\n const parsedAmount = parseAmount(\n amountParam.replace(/usd|\\$/gi, '').trim(),\n );\n if (parsedAmount > 0) {\n amount = parsedAmount;\n }\n }\n\n const amountLayoutParam = urlParams.get('amountLayout');\n if (amountLayoutParam) {\n const amountLayout =\n amountLayoutParam as EditDonationAmountSelectionLayout;\n if (\n Object.values(EditDonationAmountSelectionLayout).includes(amountLayout)\n ) {\n this.amountSelectionLayout = amountLayout;\n }\n }\n\n const frequencyModeParam = urlParams.get('frequencyMode');\n if (frequencyModeParam) {\n const frequencyMode =\n frequencyModeParam as EditDonationFrequencySelectionMode;\n if (\n Object.values(EditDonationFrequencySelectionMode).includes(\n frequencyMode,\n )\n ) {\n this.frequencySelectionMode = frequencyMode;\n }\n }\n\n this.amountOptions = amountOptions;\n this.donationInfo = new DonationPaymentInfo({\n donationType: frequency,\n amount,\n coverFees,\n });\n }\n\n private setupPaymentFlowHandlers(): void {\n if (this.paymentFlowHandlers) {\n return;\n }\n\n if (\n !this.braintreeManager ||\n !this.recaptchaManager ||\n !this.modalManager ||\n !this.recaptchaElement\n ) {\n return;\n }\n\n this.paymentFlowHandlers = new PaymentFlowHandlers({\n braintreeManager: this.braintreeManager,\n modalManager: this.modalManager,\n recaptchaManager: this.recaptchaManager,\n analytics: {\n logEvent: this.logEvent.bind(this),\n logDonationFlowEvent: this.logDonationFlowEvent.bind(this),\n },\n });\n\n this.donationForm.braintreeManager = this.braintreeManager;\n this.donationForm.paymentFlowHandlers = this.paymentFlowHandlers;\n\n this.braintreeManager.startup();\n this.paymentFlowHandlers.startup();\n this.recaptchaManager.setup(this.recaptchaElement, 1, 'light', 'image');\n }\n\n private get hostedFieldConfig(): HostedFieldConfiguration {\n const hostedFieldStyle: Record<string, Record<string, string>> = {\n input: {\n 'font-size': '16px',\n 'font-family': '\"Helvetica Neue\", Helvetica, Arial, sans-serif',\n 'font-weight': '700',\n color: '#333',\n },\n ':focus': {\n color: '#333',\n },\n // The text color stays the same when valid or invalid. The badged\n // input's red border and the error message already show the error\n // state, and red text on top of them is confusing.\n '.valid': {\n color: '#333',\n },\n '.invalid': {\n color: '#333',\n },\n };\n\n // No placeholders. The visible labels above each field are the only text.\n const hostedFieldFieldOptions: braintree.HostedFieldFieldOptions = {\n number: {\n selector: '#braintree-creditcard',\n },\n cvv: {\n selector: '#braintree-cvv',\n },\n expirationDate: {\n selector: '#braintree-expiration',\n },\n };\n\n const hostedFieldContainer =\n this.creditCardFieldsElement.hostedFieldContainer;\n\n return new HostedFieldConfiguration({\n hostedFieldStyle,\n hostedFieldFieldOptions,\n hostedFieldContainer,\n });\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"ia-donation-form-controller-container\">\n <ia-donation-form\n .braintreeManager=${this.braintreeManager}\n .contactForm=${this.contactForm}\n .amountOptions=${this.amountOptions}\n .donationInfo=${this.donationInfo}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @paymentProviderSelected=${this.paymentProviderSelected}\n @paymentFlowStarted=${this.paymentFlowStarted}\n @paymentFlowConfirmed=${this.paymentFlowConfirmed}\n @paymentFlowCancelled=${this.paymentFlowCancelled}\n @paymentFlowError=${this.paymentFlowError}\n >\n <!--\n Braintree's hosted fields, the PayPal button and recaptcha can't\n live in a shadow root, so they render here in the light DOM and\n are slotted into the form. See\n https://github.com/braintree/braintree-web-drop-in/issues/614\n and https://github.com/paypal/paypal-checkout-components/issues/353\n -->\n <div slot=\"braintree-hosted-fields\">\n <ia-donation-credit-card-fields></ia-donation-credit-card-fields>\n </div>\n\n <!-- Autofill doesn't reach into shadow DOM, so the contact form is light DOM too -->\n <div slot=\"contact-form\">\n <ia-donation-contact-form\n .donorEmail=${this.donorEmail}\n ></ia-donation-contact-form>\n </div>\n\n <div slot=\"paypal-button\">\n <div id=\"paypal-button\"></div>\n </div>\n\n <slot name=\"recaptcha\" slot=\"recaptcha\"></slot>\n </ia-donation-form>\n </div>\n\n ${this.getStyles}\n `;\n }\n\n /** Light DOM, for the payment libraries that can't render into a shadow root */\n createRenderRoot(): this {\n return this;\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n this.logEvent('DonationInfoChanged');\n this.donationInfo = e.detail.donationInfo;\n }\n\n private trackViewedEvent(): void {\n this.logEvent('Viewed');\n }\n\n private paymentProviderSelected(e: CustomEvent): void {\n const paymentProvider = e.detail.paymentProvider as\n | PaymentProvider\n | undefined;\n const previousPaymentProvider = e.detail.previousPaymentProvider as\n | PaymentProvider\n | undefined;\n const providerNoSpaces = this.removeSpaces(paymentProvider ?? 'unset');\n let eventName = `ProviderFirstSelected-${providerNoSpaces}`;\n let previousProviderInfo: string | undefined;\n if (previousPaymentProvider !== undefined) {\n eventName = `ProviderChangedTo-${providerNoSpaces}`;\n previousProviderInfo = `ProviderChangedFrom-${this.removeSpaces(\n previousPaymentProvider,\n )}`;\n }\n\n this.logEvent(eventName, previousProviderInfo);\n }\n\n private paymentFlowConfirmed(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowConfirmed',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowStarted(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowStarted',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowCancelled(e: CustomEvent): void {\n this.logEvent(\n 'PaymentFlowCancelled',\n this.removeSpaces(e.detail.paymentProvider),\n );\n }\n\n private paymentFlowError(e: CustomEvent): void {\n const providerNoSpaces = this.removeSpaces(e.detail.paymentProvider);\n this.logEvent('PaymentFlowError', `${providerNoSpaces}-${e.detail.error}`);\n }\n\n private removeSpaces(original: string): string {\n return original.replace(/\\s+/g, '');\n }\n\n /** A sampled event in this form's category */\n private logEvent(action: string, label?: string): void {\n const analyticEvent: AnalyticsEvent = {\n action,\n label,\n category: this.analyticsCategory,\n };\n this.analyticsHandler?.sendEvent(analyticEvent);\n }\n\n /** An unsampled event in the `DonationFlow` category */\n private logDonationFlowEvent(action: string, label?: string): void {\n const analyticEvent: AnalyticsEvent = {\n action,\n label,\n category: 'DonationFlow',\n };\n this.analyticsHandler?.sendEventNoSampling(analyticEvent);\n }\n\n /**\n * The element renders into the light DOM, so instead of a `styles` block\n * it writes its own `<style>` tag, scoped to its container class.\n *\n * The `--ia-donation-form-*` variables set here are the consumer-facing\n * theming for the whole form; they fan out to the sections, the amount\n * picker and the payment buttons.\n */\n private get getStyles(): TemplateResult {\n return html`\n <style>\n .ia-donation-form-controller-container {\n --donation-form-controller-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n color: var(--ia-donation-form-text-color, #333);\n background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n\n --ia-donation-section-background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n --ia-donation-edit-background-color: var(\n --ia-donation-form-background-color,\n transparent\n );\n\n --ia-donation-section-badge-background-color: var(\n --ia-donation-form-badge-background-color,\n #333\n );\n --ia-donation-edit-badge-background-color: var(\n --ia-donation-form-badge-background-color,\n #333\n );\n\n --ia-donation-section-badge-font-color: var(\n --ia-donation-form-badge-text-color,\n #fff\n );\n --ia-donation-edit-badge-font-color: var(\n --ia-donation-form-badge-text-color,\n #fff\n );\n\n --ia-donation-edit-button-font-color: var(\n --ia-donation-form-payment-option-text-color\n );\n --ia-donation-edit-button-color: var(\n --ia-donation-form-payment-option-background-color\n );\n --ia-donation-edit-button-selected-color: var(\n --ia-donation-form-selected-option-background-color\n );\n --ia-donation-edit-button-selected-font-color: var(\n --ia-donation-form-selected-option-text-color\n );\n }\n\n .ia-donation-form-controller-container ia-donation-form:focus {\n outline: none;\n }\n\n /* The real PayPal button, kept but nearly invisible under the local one */\n .ia-donation-form-controller-container #paypal-button {\n opacity: 0.001;\n width: calc(var(--donation-form-controller-base-font-size--) * 5);\n height: calc(var(--donation-form-controller-base-font-size--) * 3);\n overflow: hidden;\n }\n\n .ia-donation-form-controller-container\n div[slot='braintree-hosted-fields'] {\n background-color: white;\n }\n </style>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-upsell-modal-content.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-upsell-modal-content.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AASb,oGAAoG;AACpG,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;;;GAIG;AACH,qBACa,4BAA6B,SAAQ,UAAU;IAC9B,aAAa,EAAE,kBAAkB,CAC9B;IAEH,MAAM,SAAK;IAEX,KAAK,CAAC,EAAE,cAAc,CAAC;IAE3B,WAAW,EAAG,gBAAgB,CAAC;IAEvD,OAAO,CAAC,iBAAiB,CAA8C;IAEvE,MAAM,IAAI,cAAc;IAgCxB,OAAO,KAAK,SAAS,GA6BpB;IAED,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,gBAAgB;IAIxB,MAAM,KAAK,MAAM,IAAI,cAAc,CAiKlC;CACF"}
|
|
@@ -5,6 +5,7 @@ import { customElement } from '../../../utils/custom-element.js';
|
|
|
5
5
|
import { msg } from '@lit/localize';
|
|
6
6
|
import themeStyles from '../../../themes/theme-styles.js';
|
|
7
7
|
import { CurrencyValidator } from '../currency-validator.js';
|
|
8
|
+
import { parseAmount } from '../parse-amount.js';
|
|
8
9
|
/** How the "yes" side of the upsell is offered: our own button, or a slot for the PayPal button. */
|
|
9
10
|
export const UpsellModalCTAMode = {
|
|
10
11
|
YesButton: 'YesButton',
|
|
@@ -92,7 +93,7 @@ let IADonationUpsellModalContent = class IADonationUpsellModalContent extends Li
|
|
|
92
93
|
this.handleCustomAmountInput(amount);
|
|
93
94
|
}
|
|
94
95
|
handleCustomAmountInput(value) {
|
|
95
|
-
const amount =
|
|
96
|
+
const amount = parseAmount(value);
|
|
96
97
|
if (isNaN(amount)) {
|
|
97
98
|
this.error = html `${msg('Please enter a valid amount.')}`;
|
|
98
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-upsell-modal-content.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK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,EAAE,CAAC;2DAAwB;AAE3B;IAAvB,KAAK,CAAC,eAAe,CAAC;iEAAgC;AAR5C,4BAA4B;IADxC,aAAa,CAAC,kCAAkC,CAAC;GACrC,4BAA4B,CAqSxC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\n\n/** How the \"yes\" side of the upsell is offered: our own button, or a slot for the PayPal button. */\nexport const UpsellModalCTAMode = {\n YesButton: 'YesButton',\n PayPalUpsellSlot: 'PayPalUpsellSlot',\n} as const;\n\nexport type UpsellModalCTAMode =\n (typeof UpsellModalCTAMode)[keyof typeof UpsellModalCTAMode];\n\n/**\n * The content of the upsell modal shown after a one-time donation: a thank\n * you, a monthly amount field, and a yes button (or the PayPal button, when\n * the donation came through PayPal).\n */\n@customElement('ia-donation-upsell-modal-content')\nexport class IADonationUpsellModalContent extends LitElement {\n @property({ type: String }) yesButtonMode: UpsellModalCTAMode =\n UpsellModalCTAMode.YesButton;\n\n @property({ type: Number }) amount = 5;\n\n @property({ type: Object }) error?: TemplateResult;\n\n @query('#amount-input') amountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n return html`\n <h3>${msg('Thank you for donating!')}</h3>\n <button @click=${this.noThanksSelected} class=\"cta-button\" id=\"no-button\">\n ${msg('Continue')}\n </button>\n <p class=\"or_separator\"><span>${msg('or')}</span></p>\n <h3>${msg('Join our Monthly Giving Circle')}</h3>\n <p class=\"appeal\">\n ${msg('Monthly support helps us reliably plan for the future.')}\n </p>\n <div class=\"monthly-amount\">\n <h1>${msg('Enter your monthly amount')}</h1>\n <div class=\"amount-input\">\n <span class=\"dollar-symbol\">$</span>\n <input\n id=\"amount-input\"\n type=\"text\"\n tabindex=\"0\"\n aria-label=${msg('Monthly amount in dollars')}\n value=${this.amount}\n @input=${this.amountChanged}\n @keydown=${this.currencyValidator.keydown}\n />\n </div>\n <div class=\"error ${this.error ? '' : 'hidden'}\">${this.error}</div>\n </div>\n\n ${this.yesButton}\n `;\n }\n\n private get yesButton(): TemplateResult | typeof nothing {\n switch (this.yesButtonMode) {\n case UpsellModalCTAMode.YesButton:\n return html`\n <button\n class=\"cta-button\"\n tabindex=\"0\"\n id=\"yes-button\"\n @click=${this.yesSelected}\n .disabled=${this.error !== undefined}\n >\n ${msg(\"YES, I'll donate monthly\")}\n </button>\n `;\n case UpsellModalCTAMode.PayPalUpsellSlot:\n return html`\n <div class=\"paypal-upsell-slot-container\">\n <div\n class=\"paypal-upsell-slot-blocker ${this.error ? '' : 'hidden'}\"\n ></div>\n <button class=\"cta-button\" id=\"paypal-cover-button\">\n ${msg(\"YES, I'll donate monthly\")}\n </button>\n <slot class=\"paypal-upsell-slot\"></slot>\n </div>\n `;\n default:\n return nothing;\n }\n }\n\n private amountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n const amount = target.value;\n if (amount.length === 0) {\n return;\n }\n this.handleCustomAmountInput(amount);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseFloat(value);\n if (isNaN(amount)) {\n this.error = html`${msg('Please enter a valid amount.')}`;\n } else {\n this.processAmount(amount);\n }\n }\n\n private processAmount(amount: number): void {\n if (amount >= 10000) {\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n return;\n }\n\n if (amount < 1) {\n if (this.amountInput && this.amountInput.value.length > 0) {\n this.error = html`${msg('The minimum donation amount is $1.')}`;\n }\n return;\n }\n\n this.error = undefined;\n\n this.amount = amount;\n\n const event = new CustomEvent('amountChanged', {\n detail: { amount: this.amount },\n });\n this.dispatchEvent(event);\n }\n\n private yesSelected(): void {\n const event = new CustomEvent('yesSelected', {\n detail: { amount: this.amount },\n });\n this.dispatchEvent(event);\n }\n\n private noThanksSelected(): void {\n this.dispatchEvent(new Event('noThanksSelected'));\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-upsell-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-upsell-cta-color--: var(\n --ia-donation-upsell-cta-button-color,\n var(--navy-blue)\n );\n --donation-upsell-cta-disabled-color--: var(\n --ia-donation-upsell-cta-button-disabled-color,\n rgba(109, 148, 201, 0.5)\n );\n /* Shifts the amount field left a little so the dollar sign and field read as centred */\n --donation-upsell-amount-input-offset--: var(\n --ia-donation-upsell-amount-input-offset,\n calc(var(--donation-upsell-base-font-size--) * -1)\n );\n --donation-upsell-error-color--: var(--color-danger);\n }\n\n .monthly-amount {\n background-color: var(--true-white);\n padding: var(--padding-sm) 0.625rem;\n border-radius: 5px;\n text-align: center;\n margin-bottom: var(--padding-sm);\n margin-top: 0;\n }\n\n .monthly-amount h1 {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n font-weight: bold;\n text-align: center;\n line-height: 1.2em;\n margin: 0;\n padding: var(--padding-sm) 0 0 0;\n }\n\n .hidden {\n display: none;\n }\n\n h3 {\n text-align: center;\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n margin: 0 var(--donation-upsell-base-font-size--) var(--padding-sm)\n var(--donation-upsell-base-font-size--);\n }\n\n .appeal {\n text-align: center;\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.6);\n margin: var(--padding-sm) var(--donation-upsell-base-font-size--);\n }\n\n .amount-input {\n transform: translate(var(--donation-upsell-amount-input-offset--), 0);\n }\n\n .amount-input .dollar-symbol {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n font-weight: bold;\n }\n\n .amount-input input {\n width: 100px;\n text-align: center;\n border: none;\n border-bottom: 1px solid gray;\n font-weight: bold;\n font-size: calc(var(--donation-upsell-base-font-size--) * 3.4);\n }\n\n .cta-button {\n font-size: calc(var(--donation-upsell-base-font-size--) * 2);\n display: block;\n width: 100%;\n margin-top: var(--padding-sm);\n padding: var(--donation-upsell-base-font-size--)\n calc(var(--donation-upsell-base-font-size--) * 2);\n background-color: var(--donation-upsell-cta-color--);\n color: var(--true-white);\n border-radius: 5px;\n border: 0;\n font-weight: bold;\n line-height: normal;\n outline: none;\n cursor: pointer;\n }\n\n .cta-button:disabled {\n background-color: var(--donation-upsell-cta-disabled-color--);\n cursor: not-allowed;\n }\n\n .paypal-upsell-slot {\n text-align: center;\n }\n\n .paypal-upsell-slot-blocker {\n position: absolute;\n width: 100%;\n height: calc(var(--donation-upsell-base-font-size--) * 4.5);\n bottom: 0;\n z-index: 250;\n cursor: not-allowed;\n background-color: rgba(255, 255, 255, 0.5);\n }\n\n .paypal-upsell-slot-blocker.hidden {\n display: none;\n }\n\n #paypal-cover-button {\n position: absolute;\n width: 100%;\n bottom: 0;\n }\n\n .paypal-upsell-slot-container {\n position: relative;\n }\n\n .error {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.4);\n margin: var(--padding-sm) 0;\n color: var(--donation-upsell-error-color--);\n }\n\n .or_separator {\n position: relative;\n margin: 0 calc(var(--donation-upsell-base-font-size--) * 2);\n font-size: calc(var(--donation-upsell-base-font-size--) * 2.6);\n font-weight: bold;\n text-transform: uppercase;\n text-align: center;\n }\n\n .or_separator:before {\n position: absolute;\n top: calc(50% - 1px);\n right: 0;\n left: 0;\n height: 2px;\n content: '';\n background: var(--mid-gray);\n }\n\n .or_separator span {\n display: inline-block;\n position: relative;\n padding: 0 var(--donation-upsell-base-font-size--);\n background: #f5f5f7;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-donation-upsell-modal-content.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK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Y;AAEX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAwB;AAE3B;IAAvB,KAAK,CAAC,eAAe,CAAC;iEAAgC;AAR5C,4BAA4B;IADxC,aAAa,CAAC,kCAAkC,CAAC;GACrC,4BAA4B,CAqSxC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\nimport { parseAmount } from '../parse-amount';\n\n/** How the \"yes\" side of the upsell is offered: our own button, or a slot for the PayPal button. */\nexport const UpsellModalCTAMode = {\n YesButton: 'YesButton',\n PayPalUpsellSlot: 'PayPalUpsellSlot',\n} as const;\n\nexport type UpsellModalCTAMode =\n (typeof UpsellModalCTAMode)[keyof typeof UpsellModalCTAMode];\n\n/**\n * The content of the upsell modal shown after a one-time donation: a thank\n * you, a monthly amount field, and a yes button (or the PayPal button, when\n * the donation came through PayPal).\n */\n@customElement('ia-donation-upsell-modal-content')\nexport class IADonationUpsellModalContent extends LitElement {\n @property({ type: String }) yesButtonMode: UpsellModalCTAMode =\n UpsellModalCTAMode.YesButton;\n\n @property({ type: Number }) amount = 5;\n\n @property({ type: Object }) error?: TemplateResult;\n\n @query('#amount-input') amountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n return html`\n <h3>${msg('Thank you for donating!')}</h3>\n <button @click=${this.noThanksSelected} class=\"cta-button\" id=\"no-button\">\n ${msg('Continue')}\n </button>\n <p class=\"or_separator\"><span>${msg('or')}</span></p>\n <h3>${msg('Join our Monthly Giving Circle')}</h3>\n <p class=\"appeal\">\n ${msg('Monthly support helps us reliably plan for the future.')}\n </p>\n <div class=\"monthly-amount\">\n <h1>${msg('Enter your monthly amount')}</h1>\n <div class=\"amount-input\">\n <span class=\"dollar-symbol\">$</span>\n <input\n id=\"amount-input\"\n type=\"text\"\n tabindex=\"0\"\n aria-label=${msg('Monthly amount in dollars')}\n value=${this.amount}\n @input=${this.amountChanged}\n @keydown=${this.currencyValidator.keydown}\n />\n </div>\n <div class=\"error ${this.error ? '' : 'hidden'}\">${this.error}</div>\n </div>\n\n ${this.yesButton}\n `;\n }\n\n private get yesButton(): TemplateResult | typeof nothing {\n switch (this.yesButtonMode) {\n case UpsellModalCTAMode.YesButton:\n return html`\n <button\n class=\"cta-button\"\n tabindex=\"0\"\n id=\"yes-button\"\n @click=${this.yesSelected}\n .disabled=${this.error !== undefined}\n >\n ${msg(\"YES, I'll donate monthly\")}\n </button>\n `;\n case UpsellModalCTAMode.PayPalUpsellSlot:\n return html`\n <div class=\"paypal-upsell-slot-container\">\n <div\n class=\"paypal-upsell-slot-blocker ${this.error ? '' : 'hidden'}\"\n ></div>\n <button class=\"cta-button\" id=\"paypal-cover-button\">\n ${msg(\"YES, I'll donate monthly\")}\n </button>\n <slot class=\"paypal-upsell-slot\"></slot>\n </div>\n `;\n default:\n return nothing;\n }\n }\n\n private amountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n const amount = target.value;\n if (amount.length === 0) {\n return;\n }\n this.handleCustomAmountInput(amount);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseAmount(value);\n if (isNaN(amount)) {\n this.error = html`${msg('Please enter a valid amount.')}`;\n } else {\n this.processAmount(amount);\n }\n }\n\n private processAmount(amount: number): void {\n if (amount >= 10000) {\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n return;\n }\n\n if (amount < 1) {\n if (this.amountInput && this.amountInput.value.length > 0) {\n this.error = html`${msg('The minimum donation amount is $1.')}`;\n }\n return;\n }\n\n this.error = undefined;\n\n this.amount = amount;\n\n const event = new CustomEvent('amountChanged', {\n detail: { amount: this.amount },\n });\n this.dispatchEvent(event);\n }\n\n private yesSelected(): void {\n const event = new CustomEvent('yesSelected', {\n detail: { amount: this.amount },\n });\n this.dispatchEvent(event);\n }\n\n private noThanksSelected(): void {\n this.dispatchEvent(new Event('noThanksSelected'));\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-upsell-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-upsell-cta-color--: var(\n --ia-donation-upsell-cta-button-color,\n var(--navy-blue)\n );\n --donation-upsell-cta-disabled-color--: var(\n --ia-donation-upsell-cta-button-disabled-color,\n rgba(109, 148, 201, 0.5)\n );\n /* Shifts the amount field left a little so the dollar sign and field read as centred */\n --donation-upsell-amount-input-offset--: var(\n --ia-donation-upsell-amount-input-offset,\n calc(var(--donation-upsell-base-font-size--) * -1)\n );\n --donation-upsell-error-color--: var(--color-danger);\n }\n\n .monthly-amount {\n background-color: var(--true-white);\n padding: var(--padding-sm) 0.625rem;\n border-radius: 5px;\n text-align: center;\n margin-bottom: var(--padding-sm);\n margin-top: 0;\n }\n\n .monthly-amount h1 {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n font-weight: bold;\n text-align: center;\n line-height: 1.2em;\n margin: 0;\n padding: var(--padding-sm) 0 0 0;\n }\n\n .hidden {\n display: none;\n }\n\n h3 {\n text-align: center;\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n margin: 0 var(--donation-upsell-base-font-size--) var(--padding-sm)\n var(--donation-upsell-base-font-size--);\n }\n\n .appeal {\n text-align: center;\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.6);\n margin: var(--padding-sm) var(--donation-upsell-base-font-size--);\n }\n\n .amount-input {\n transform: translate(var(--donation-upsell-amount-input-offset--), 0);\n }\n\n .amount-input .dollar-symbol {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.8);\n font-weight: bold;\n }\n\n .amount-input input {\n width: 100px;\n text-align: center;\n border: none;\n border-bottom: 1px solid gray;\n font-weight: bold;\n font-size: calc(var(--donation-upsell-base-font-size--) * 3.4);\n }\n\n .cta-button {\n font-size: calc(var(--donation-upsell-base-font-size--) * 2);\n display: block;\n width: 100%;\n margin-top: var(--padding-sm);\n padding: var(--donation-upsell-base-font-size--)\n calc(var(--donation-upsell-base-font-size--) * 2);\n background-color: var(--donation-upsell-cta-color--);\n color: var(--true-white);\n border-radius: 5px;\n border: 0;\n font-weight: bold;\n line-height: normal;\n outline: none;\n cursor: pointer;\n }\n\n .cta-button:disabled {\n background-color: var(--donation-upsell-cta-disabled-color--);\n cursor: not-allowed;\n }\n\n .paypal-upsell-slot {\n text-align: center;\n }\n\n .paypal-upsell-slot-blocker {\n position: absolute;\n width: 100%;\n height: calc(var(--donation-upsell-base-font-size--) * 4.5);\n bottom: 0;\n z-index: 250;\n cursor: not-allowed;\n background-color: rgba(255, 255, 255, 0.5);\n }\n\n .paypal-upsell-slot-blocker.hidden {\n display: none;\n }\n\n #paypal-cover-button {\n position: absolute;\n width: 100%;\n bottom: 0;\n }\n\n .paypal-upsell-slot-container {\n position: relative;\n }\n\n .error {\n font-size: calc(var(--donation-upsell-base-font-size--) * 1.4);\n margin: var(--padding-sm) 0;\n color: var(--donation-upsell-error-color--);\n }\n\n .or_separator {\n position: relative;\n margin: 0 calc(var(--donation-upsell-base-font-size--) * 2);\n font-size: calc(var(--donation-upsell-base-font-size--) * 2.6);\n font-weight: bold;\n text-transform: uppercase;\n text-align: center;\n }\n\n .or_separator:before {\n position: absolute;\n top: calc(50% - 1px);\n right: 0;\n left: 0;\n height: 2px;\n content: '';\n background: var(--mid-gray);\n }\n\n .or_separator span {\n display: inline-block;\n position: relative;\n padding: 0 var(--donation-upsell-base-font-size--);\n background: #f5f5f7;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a typed, pasted or linked amount as a number, whatever the language.
|
|
3
|
+
* A separator (comma or dot) followed by one or two digits at the end is the
|
|
4
|
+
* decimal point, and a comma followed by exactly three digits is a thousands
|
|
5
|
+
* separator: `10,50` and `10.50` are 10.50, `1,000` is 1000, and `1.000,50`
|
|
6
|
+
* and `1,000.50` are 1000.50. A dot followed by exactly three digits, as in
|
|
7
|
+
* `1.000`, can't be told apart from a decimal, so it isn't an amount. A trailing separator, as in `10,`,
|
|
8
|
+
* is a decimal point still being typed. Returns `NaN` for anything else, so a
|
|
9
|
+
* value that can't be read is reported instead of guessed at.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseAmount(value: string): number;
|
|
12
|
+
//# sourceMappingURL=parse-amount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-amount.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/parse-amount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA6BjD"}
|