@internetarchive/elements 1.7.0 → 1.9.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.
Files changed (225) hide show
  1. package/README.md +25 -1
  2. package/dist/src/elements/ia-audio-element/ia-audio-element.js +1 -1
  3. package/dist/src/elements/ia-audio-element/ia-audio-element.js.map +1 -1
  4. package/dist/src/elements/ia-book-actions/ia-book-actions-collapsible-action-group.js +1 -1
  5. package/dist/src/elements/ia-book-actions/ia-book-actions-collapsible-action-group.js.map +1 -1
  6. package/dist/src/elements/ia-book-actions/ia-book-actions-info-icon.js +1 -1
  7. package/dist/src/elements/ia-book-actions/ia-book-actions-info-icon.js.map +1 -1
  8. package/dist/src/elements/ia-book-actions/ia-book-actions-text-group.js +1 -1
  9. package/dist/src/elements/ia-book-actions/ia-book-actions-text-group.js.map +1 -1
  10. package/dist/src/elements/ia-book-actions/ia-book-actions-timer-countdown.js +1 -1
  11. package/dist/src/elements/ia-book-actions/ia-book-actions-timer-countdown.js.map +1 -1
  12. package/dist/src/elements/ia-book-actions/ia-book-actions-title-bar.js +1 -1
  13. package/dist/src/elements/ia-book-actions/ia-book-actions-title-bar.js.map +1 -1
  14. package/dist/src/elements/ia-book-actions/ia-book-actions.js +1 -1
  15. package/dist/src/elements/ia-book-actions/ia-book-actions.js.map +1 -1
  16. package/dist/src/elements/ia-button/ia-button.js +1 -1
  17. package/dist/src/elements/ia-button/ia-button.js.map +1 -1
  18. package/dist/src/elements/ia-clearable-text-input/ia-clearable-text-input.js +1 -1
  19. package/dist/src/elements/ia-clearable-text-input/ia-clearable-text-input.js.map +1 -1
  20. package/dist/src/elements/ia-combo-box/ia-combo-box.js +1 -1
  21. package/dist/src/elements/ia-combo-box/ia-combo-box.js.map +1 -1
  22. package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js +1 -1
  23. package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js.map +1 -1
  24. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.js +2 -2
  25. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.js.map +1 -1
  26. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.js +1 -1
  27. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.js.map +1 -1
  28. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js +1 -1
  29. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js.map +1 -1
  30. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.js +1 -1
  31. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.js.map +1 -1
  32. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.js +2 -2
  33. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.js.map +1 -1
  34. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-section.js +1 -1
  35. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-section.js.map +1 -1
  36. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js +1 -1
  37. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js.map +1 -1
  38. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js +1 -1
  39. package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js.map +1 -1
  40. package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js +1 -1
  41. package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js.map +1 -1
  42. package/dist/src/elements/ia-donation-form/ia-donation-form.js +2 -2
  43. package/dist/src/elements/ia-donation-form/ia-donation-form.js.map +1 -1
  44. package/dist/src/elements/ia-donation-form/icons.js +1 -1
  45. package/dist/src/elements/ia-donation-form/icons.js.map +1 -1
  46. package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js +1 -1
  47. package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js.map +1 -1
  48. package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.js +1 -1
  49. package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.js.map +1 -1
  50. package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js +1 -1
  51. package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js.map +1 -1
  52. package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.js +1 -1
  53. package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.js.map +1 -1
  54. package/dist/src/elements/ia-dropdown/ia-dropdown.d.ts +7 -2
  55. package/dist/src/elements/ia-dropdown/ia-dropdown.d.ts.map +1 -1
  56. package/dist/src/elements/ia-dropdown/ia-dropdown.js +13 -9
  57. package/dist/src/elements/ia-dropdown/ia-dropdown.js.map +1 -1
  58. package/dist/src/elements/ia-dropdown/ia-icon-label.js +1 -1
  59. package/dist/src/elements/ia-dropdown/ia-icon-label.js.map +1 -1
  60. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts.map +1 -1
  61. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js +2 -1
  62. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js.map +1 -1
  63. package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.js +1 -1
  64. package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.js.map +1 -1
  65. package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.js +1 -1
  66. package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.js.map +1 -1
  67. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-comment.js +1 -1
  68. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-comment.js.map +1 -1
  69. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-extra.js +1 -1
  70. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-extra.js.map +1 -1
  71. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-vote.js +1 -1
  72. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey-vote.js.map +1 -1
  73. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey.js +1 -1
  74. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback-survey.js.map +1 -1
  75. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback.js +1 -1
  76. package/dist/src/elements/ia-feature-feedback/ia-feature-feedback.js.map +1 -1
  77. package/dist/src/elements/ia-histogram-date-range/ia-histogram-date-range.js +1 -1
  78. package/dist/src/elements/ia-histogram-date-range/ia-histogram-date-range.js.map +1 -1
  79. package/dist/src/elements/ia-icon/ia-icon.js +1 -1
  80. package/dist/src/elements/ia-icon/ia-icon.js.map +1 -1
  81. package/dist/src/elements/ia-image-viewer/ia-image-viewer.js +2 -2
  82. package/dist/src/elements/ia-image-viewer/ia-image-viewer.js.map +1 -1
  83. package/dist/src/elements/ia-image-viewer/ia-imgview-controls.js +1 -1
  84. package/dist/src/elements/ia-image-viewer/ia-imgview-controls.js.map +1 -1
  85. package/dist/src/elements/ia-image-viewer/ia-imgview-slide.js +1 -1
  86. package/dist/src/elements/ia-image-viewer/ia-imgview-slide.js.map +1 -1
  87. package/dist/src/elements/ia-image-viewer/image-viewer-gestures.js +1 -1
  88. package/dist/src/elements/ia-image-viewer/image-viewer-gestures.js.map +1 -1
  89. package/dist/src/elements/ia-infinite-scroller/ia-infinite-scroller.js +1 -1
  90. package/dist/src/elements/ia-infinite-scroller/ia-infinite-scroller.js.map +1 -1
  91. package/dist/src/elements/ia-infinite-scroller/story-support/ia-infinite-scroller-demo-tile.js +1 -1
  92. package/dist/src/elements/ia-infinite-scroller/story-support/ia-infinite-scroller-demo-tile.js.map +1 -1
  93. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js +2 -2
  94. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js.map +1 -1
  95. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js +2 -2
  96. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js.map +1 -1
  97. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js +2 -2
  98. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js.map +1 -1
  99. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts.map +1 -1
  100. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js +3 -2
  101. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js.map +1 -1
  102. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js +2 -2
  103. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js.map +1 -1
  104. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js +2 -2
  105. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js.map +1 -1
  106. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js +2 -2
  107. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js.map +1 -1
  108. package/dist/src/elements/ia-otp-form/ia-otp-form.js +1 -1
  109. package/dist/src/elements/ia-otp-form/ia-otp-form.js.map +1 -1
  110. package/dist/src/elements/ia-otp-input/ia-otp-input.js +1 -1
  111. package/dist/src/elements/ia-otp-input/ia-otp-input.js.map +1 -1
  112. package/dist/src/elements/ia-playback-controls/ia-playback-controls.js +1 -1
  113. package/dist/src/elements/ia-playback-controls/ia-playback-controls.js.map +1 -1
  114. package/dist/src/elements/ia-radio-player/ia-radio-player.js +1 -1
  115. package/dist/src/elements/ia-radio-player/ia-radio-player.js.map +1 -1
  116. package/dist/src/elements/ia-radio-player/ia-search-results-switcher.js +1 -1
  117. package/dist/src/elements/ia-radio-player/ia-search-results-switcher.js.map +1 -1
  118. package/dist/src/elements/ia-reviews/ia-review-form.js +1 -1
  119. package/dist/src/elements/ia-reviews/ia-review-form.js.map +1 -1
  120. package/dist/src/elements/ia-reviews/ia-review.js +1 -1
  121. package/dist/src/elements/ia-reviews/ia-review.js.map +1 -1
  122. package/dist/src/elements/ia-reviews/ia-reviews.js +1 -1
  123. package/dist/src/elements/ia-reviews/ia-reviews.js.map +1 -1
  124. package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.js +1 -1
  125. package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.js.map +1 -1
  126. package/dist/src/elements/ia-scrubber-bar/ia-section-marker.js +1 -1
  127. package/dist/src/elements/ia-scrubber-bar/ia-section-marker.js.map +1 -1
  128. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js +1 -1
  129. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js.map +1 -1
  130. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +2 -2
  131. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -1
  132. package/dist/src/elements/ia-topnav/data/menus.d.ts.map +1 -1
  133. package/dist/src/elements/ia-topnav/data/menus.js +5 -1
  134. package/dist/src/elements/ia-topnav/data/menus.js.map +1 -1
  135. package/dist/src/elements/ia-topnav/ia-topnav-desktop-subnav.js +1 -1
  136. package/dist/src/elements/ia-topnav/ia-topnav-desktop-subnav.js.map +1 -1
  137. package/dist/src/elements/ia-topnav/ia-topnav-icon-hamburger.js +1 -1
  138. package/dist/src/elements/ia-topnav/ia-topnav-icon-hamburger.js.map +1 -1
  139. package/dist/src/elements/ia-topnav/ia-topnav-login-button.js +1 -1
  140. package/dist/src/elements/ia-topnav/ia-topnav-login-button.js.map +1 -1
  141. package/dist/src/elements/ia-topnav/ia-topnav-media-button.js +1 -1
  142. package/dist/src/elements/ia-topnav/ia-topnav-media-button.js.map +1 -1
  143. package/dist/src/elements/ia-topnav/ia-topnav-media-menu.js +1 -1
  144. package/dist/src/elements/ia-topnav/ia-topnav-media-menu.js.map +1 -1
  145. package/dist/src/elements/ia-topnav/ia-topnav-media-slider.js +1 -1
  146. package/dist/src/elements/ia-topnav/ia-topnav-media-slider.js.map +1 -1
  147. package/dist/src/elements/ia-topnav/ia-topnav-media-subnav.js +1 -1
  148. package/dist/src/elements/ia-topnav/ia-topnav-media-subnav.js.map +1 -1
  149. package/dist/src/elements/ia-topnav/ia-topnav-more-slider.js +1 -1
  150. package/dist/src/elements/ia-topnav/ia-topnav-more-slider.js.map +1 -1
  151. package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.js +1 -1
  152. package/dist/src/elements/ia-topnav/ia-topnav-primary-nav.js.map +1 -1
  153. package/dist/src/elements/ia-topnav/ia-topnav-save-page-form.js +1 -1
  154. package/dist/src/elements/ia-topnav/ia-topnav-save-page-form.js.map +1 -1
  155. package/dist/src/elements/ia-topnav/ia-topnav-signed-out-dropdown.js +1 -1
  156. package/dist/src/elements/ia-topnav/ia-topnav-signed-out-dropdown.js.map +1 -1
  157. package/dist/src/elements/ia-topnav/ia-topnav-user-menu.js +1 -1
  158. package/dist/src/elements/ia-topnav/ia-topnav-user-menu.js.map +1 -1
  159. package/dist/src/elements/ia-topnav/ia-topnav-wayback-search.js +1 -1
  160. package/dist/src/elements/ia-topnav/ia-topnav-wayback-search.js.map +1 -1
  161. package/dist/src/elements/ia-topnav/ia-topnav-wayback-slider.js +1 -1
  162. package/dist/src/elements/ia-topnav/ia-topnav-wayback-slider.js.map +1 -1
  163. package/dist/src/elements/ia-topnav/ia-topnav.js +1 -1
  164. package/dist/src/elements/ia-topnav/ia-topnav.js.map +1 -1
  165. package/dist/src/elements/ia-transcript-view/ia-transcript-entry.js +1 -1
  166. package/dist/src/elements/ia-transcript-view/ia-transcript-entry.js.map +1 -1
  167. package/dist/src/elements/ia-transcript-view/ia-transcript-view.js +1 -1
  168. package/dist/src/elements/ia-transcript-view/ia-transcript-view.js.map +1 -1
  169. package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.js +1 -1
  170. package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.js.map +1 -1
  171. package/dist/src/elements/ia-wayback-search-form/ia-wayback-search-form.js +1 -1
  172. package/dist/src/elements/ia-wayback-search-form/ia-wayback-search-form.js.map +1 -1
  173. package/dist/src/elements/modal-manager/ia-modal-manager-template.js +1 -1
  174. package/dist/src/elements/modal-manager/ia-modal-manager-template.js.map +1 -1
  175. package/dist/src/elements/modal-manager/modal-manager.js +1 -1
  176. package/dist/src/elements/modal-manager/modal-manager.js.map +1 -1
  177. package/dist/src/labs/ia-snow/ia-snow.js +2 -2
  178. package/dist/src/labs/ia-snow/ia-snow.js.map +1 -1
  179. package/dist/src/locales/es.d.ts +1 -0
  180. package/dist/src/locales/es.d.ts.map +1 -1
  181. package/dist/src/locales/es.js +1 -0
  182. package/dist/src/locales/es.js.map +1 -1
  183. package/dist/src/locales/fr.d.ts +1 -0
  184. package/dist/src/locales/fr.d.ts.map +1 -1
  185. package/dist/src/locales/fr.js +1 -0
  186. package/dist/src/locales/fr.js.map +1 -1
  187. package/dist/src/services/analytics-manager/analytics-helpers.d.ts +1 -1
  188. package/dist/src/services/analytics-manager/analytics-helpers.d.ts.map +1 -1
  189. package/dist/src/services/analytics-manager/analytics-helpers.js +5 -0
  190. package/dist/src/services/analytics-manager/analytics-helpers.js.map +1 -1
  191. package/dist/src/services/analytics-manager/visitor-status.d.ts +12 -0
  192. package/dist/src/services/analytics-manager/visitor-status.d.ts.map +1 -0
  193. package/dist/src/services/analytics-manager/visitor-status.js +30 -0
  194. package/dist/src/services/analytics-manager/visitor-status.js.map +1 -0
  195. package/dist/src/utils/custom-element.d.ts.map +1 -0
  196. package/dist/src/utils/custom-element.js.map +1 -0
  197. package/dist/src/utils/download-url/download-url.d.ts +21 -0
  198. package/dist/src/utils/download-url/download-url.d.ts.map +1 -0
  199. package/dist/src/utils/download-url/download-url.js +30 -0
  200. package/dist/src/utils/download-url/download-url.js.map +1 -0
  201. package/dist/src/utils/icon-box.d.ts.map +1 -0
  202. package/dist/src/utils/icon-box.js.map +1 -0
  203. package/dist/src/utils/lazy-load-template.d.ts.map +1 -0
  204. package/dist/src/utils/lazy-load-template.js.map +1 -0
  205. package/dist/src/utils/prefers-reduced-motion.d.ts.map +1 -0
  206. package/dist/src/utils/prefers-reduced-motion.js.map +1 -0
  207. package/eslint/index.mjs +20 -0
  208. package/eslint/no-hand-built-download-url.mjs +33 -0
  209. package/package.json +5 -1
  210. package/dist/src/util/custom-element.d.ts.map +0 -1
  211. package/dist/src/util/custom-element.js.map +0 -1
  212. package/dist/src/util/icon-box.d.ts.map +0 -1
  213. package/dist/src/util/icon-box.js.map +0 -1
  214. package/dist/src/util/lazy-load-template.d.ts.map +0 -1
  215. package/dist/src/util/lazy-load-template.js.map +0 -1
  216. package/dist/src/util/prefers-reduced-motion.d.ts.map +0 -1
  217. package/dist/src/util/prefers-reduced-motion.js.map +0 -1
  218. /package/dist/src/{util → utils}/custom-element.d.ts +0 -0
  219. /package/dist/src/{util → utils}/custom-element.js +0 -0
  220. /package/dist/src/{util → utils}/icon-box.d.ts +0 -0
  221. /package/dist/src/{util → utils}/icon-box.js +0 -0
  222. /package/dist/src/{util → utils}/lazy-load-template.d.ts +0 -0
  223. /package/dist/src/{util → utils}/lazy-load-template.js +0 -0
  224. /package/dist/src/{util → utils}/prefers-reduced-motion.d.ts +0 -0
  225. /package/dist/src/{util → utils}/prefers-reduced-motion.js +0 -0
@@ -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,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,iBAAiB,GAElB,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,OAAO,EACL,cAAc,G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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/util/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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AE,CAAC;0DAAmB;AAElB;IAA3B,QAAQ,CAAC,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,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
- import { customElement } from '../../util/custom-element.js';
5
- import { iconBoxStyles } from '../../util/icon-box.js';
4
+ import { customElement } from '../../utils/custom-element.js';
5
+ import { iconBoxStyles } from '../../utils/icon-box.js';
6
6
  import { msg } from '@lit/localize';
7
7
  import themeStyles from '../../themes/theme-styles.js';
8
8
  import { EditDonationAmountSelectionLayout, EditDonationFrequencySelectionMode, } from './form-elements/ia-donation-edit-donation.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ia-donation-form.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form.ts"],"names":[],"mappings":";AACA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAIX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAInD,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,wBAAwB,GAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AACnG,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,mB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O;YACL,WAAW;YACX,aAAa;YACb,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+FF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAxjB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA8C;AAGzE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAG9D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDACqC;AAGpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAqC;AAErC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAAkD;AAG5E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAEmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAEiB;AAE3B;IAAhB,KAAK,EAAE;yDAAmC;AAE1B;IAAhB,KAAK,EAAE;0DAAoC;AAE3B;IAAhB,KAAK,EAAE;yDAAkC;AAEzB;IAAhB,KAAK,EAAE;+DAAmD;AAE7B;IAA7B,KAAK,CAAC,qBAAqB,CAAC;0DAAwC;AAExC;IAA5B,KAAK,CAAC,oBAAoB,CAAC;0DAAuC;AAGnE;IADC,KAAK,CAAC,8BAA8B,CAAC;uDACM;AArCjC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyjB1B","sourcesContent":["import type * as paypal from 'paypal-checkout-components';\nimport {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { iconBoxStyles } from '@src/util/icon-box';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport type { BraintreeManagerInterface } from './braintree/braintree-manager-interface';\nimport type { PaymentFlowHandlersInterface } 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 { IADonationHeader } from './form-elements/ia-donation-header';\nimport type { IADonationPaymentSelector } from './form-elements/ia-donation-payment-selector';\nimport {\n DonationSectionBadgeMode,\n type IADonationSection,\n} from './form-elements/ia-donation-section';\nimport { HostedFieldName } from './braintree/payment-providers/credit-card/hosted-field-container';\nimport { lockIcon } from './icons';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from './models/donation-payment-info';\nimport type { DonationRequest } from './models/donation-request';\nimport { DonationType } from './models/donation-type';\nimport type { DonorContactInfo } from './models/donor-contact-info';\nimport { PaymentProvider } from './models/payment-provider';\nimport { UpsellModalCTAMode } from './modals/ia-donation-upsell-modal-content';\nimport './form-elements/ia-donation-header';\nimport './form-elements/ia-donation-payment-selector';\nimport './form-elements/ia-donation-section';\nimport './form-elements/ia-donation-total-amount';\n\n/**\n * The donation form: amount picker, total, payment method buttons, then the\n * contact form and Donate button for the methods that need them. The\n * controller wires it to Braintree, the modals and recaptcha; on its own it\n * renders and emits events.\n */\n@customElement('ia-donation-form')\nexport class IADonationForm extends LitElement {\n @property({ type: Object }) braintreeManager?: BraintreeManagerInterface;\n\n @property({ type: Object })\n paymentFlowHandlers?: PaymentFlowHandlersInterface;\n\n @property({ type: Object }) donationRequest?: DonationRequest;\n\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n /** The contact form lives in the light DOM (for autofill) and is handed in here */\n @property({ type: Object }) contactForm?: IADonationContactForm;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @state() private creditCardVisible = false;\n\n @state() private contactFormVisible = false;\n\n @state() private donationInfoValid = true;\n\n @state() private selectedPaymentProvider?: PaymentProvider;\n\n @query('#contactFormSection') contactFormSection?: IADonationSection;\n\n @query('ia-donation-header') donationFormHeader!: IADonationHeader;\n\n @query('ia-donation-payment-selector')\n paymentSelector!: IADonationPaymentSelector;\n\n private paypalButtonNeedsRender = true;\n\n render(): TemplateResult {\n return html`\n <ia-donation-header\n .amountOptions=${this.amountOptions}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @editDonationError=${this.editDonationError}\n >\n </ia-donation-header>\n\n <ia-donation-section\n .badgeMode=${DonationSectionBadgeMode.HideBadgeLeaveSpacing}\n id=\"total-amount-section\"\n >\n <ia-donation-total-amount .donationInfo=${this.donationInfo}>\n </ia-donation-total-amount>\n </ia-donation-section>\n\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart}`}\n headline=${msg('Choose a payment method')}\n >\n <ia-donation-payment-selector\n .paymentProviders=${this.braintreeManager?.paymentProviders}\n @firstUpdated=${this.paymentSelectorFirstUpdated}\n @creditCardSelected=${this.creditCardSelected}\n @venmoSelected=${this.venmoSelected}\n @applePaySelected=${this.applePaySelected}\n @googlePaySelected=${this.googlePaySelected}\n @paypalBlockerSelected=${this.paypalBlockerSelected}\n @resetPaymentMethod=${() => {\n this.selectedPaymentProvider = undefined;\n this.contactFormVisible = false;\n }}\n >\n <slot name=\"paypal-button\" slot=\"paypal-button\"></slot>\n <div\n class=\"credit-card-fields ${this.creditCardVisible ? '' : 'hidden'}\"\n slot=\"credit-card-fields\"\n >\n <slot name=\"braintree-hosted-fields\"></slot>\n </div>\n </ia-donation-payment-selector>\n </ia-donation-section>\n\n <div\n class=\"contact-form-section ${this.contactFormVisible ? '' : 'hidden'}\"\n >\n ${this.contactFormSectionTemplate}\n </div>\n `;\n }\n\n /** Developer convenience: show the confirmation step without a payment. */\n async showConfirmationModalDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: () => void;\n confirmDonationCB: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showConfirmationStepModal(options);\n }\n\n /**\n * Developer convenience: show the upsell modal without going through a\n * payment. With the PayPal slot mode it also renders the PayPal button.\n */\n async showUpsellModalDev(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showUpsellModal(options);\n\n if (options.ctaMode === UpsellModalCTAMode.PayPalUpsellSlot) {\n const handler =\n await this.braintreeManager?.paymentProviders.paypalHandler.get();\n const donationInfo = new DonationPaymentInfo({\n amount: options.oneTimeAmount,\n donationType: DonationType.OneTime,\n coverFees: false,\n });\n handler?.renderPayPalButton({\n selector: '#paypal-upsell-button',\n style: {\n color: 'blue' as paypal.ButtonColorOption,\n label: 'paypal' as paypal.ButtonLabelOption,\n shape: 'rect' as paypal.ButtonShapeOption,\n size: 'responsive' as paypal.ButtonSizeOption,\n tagline: false,\n },\n donationInfo,\n });\n }\n }\n\n get contactFormSectionTemplate(): TemplateResult {\n const headline =\n this.selectedPaymentProvider === PaymentProvider.Venmo\n ? msg('Help us stay in touch')\n : msg('Enter contact information');\n\n return html`\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart + 1}`}\n headline=${headline}\n id=\"contactFormSection\"\n >\n <slot name=\"contact-form\"></slot>\n </ia-donation-section>\n\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart + 2}`}\n >\n <slot name=\"recaptcha\"></slot>\n <button id=\"donate-button\" @click=${this.donateClicked}>\n ${msg('Donate')}\n </button>\n\n <div class=\"secure-process-note\">\n ${lockIcon} ${msg('Your payment will be securely processed')}\n </div>\n </ia-donation-section>\n `;\n }\n\n /**\n * The step number of the payment selector. With the frequency buttons\n * showing they're step 1 and the amount is 2, so payment is 3. In checkbox\n * mode the amount picker is step 1 and payment is 2.\n */\n private get paymentSelectorNumberingStart(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 3\n : 2;\n }\n\n private editDonationError(): void {\n this.donationInfoValid = false;\n }\n\n private paymentSelectorFirstUpdated(): void {\n if (this.paymentFlowHandlers?.paypalHandler) {\n this.renderPayPalButtonIfNeeded();\n }\n }\n\n private applePaySelected(e: CustomEvent): void {\n this.selectedPaymentProvider = PaymentProvider.ApplePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const originalEvent = e.detail.originalEvent;\n if (this.donationInfo) {\n this.paymentFlowHandlers?.applePayHandler?.paymentInitiated(\n this.donationInfo,\n originalEvent,\n );\n }\n this.emitPaymentFlowStartedEvent();\n }\n\n private googlePaySelected(): void {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n if (this.donationInfo) {\n this.paymentFlowHandlers?.googlePayHandler?.paymentInitiated(\n this.donationInfo,\n );\n }\n this.emitPaymentFlowStartedEvent();\n }\n\n private async creditCardSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.CreditCard;\n this.contactFormVisible = true;\n this.creditCardVisible = true;\n this.focusCreditCardNumberField();\n }\n\n private async venmoSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.Venmo;\n this.contactFormVisible = true;\n this.creditCardVisible = false;\n this.focusContactForm();\n }\n\n private paypalBlockerSelected(): void {\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n this.showInvalidDonationInfoAlert();\n }\n\n private async focusContactForm(): Promise<void> {\n await this.updateComplete;\n if (this.contactFormSection) {\n this.contactForm?.focus();\n }\n }\n\n private async focusCreditCardNumberField(): Promise<void> {\n await this.updateComplete;\n const creditCardHandler =\n await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.focusField(HostedFieldName.Number);\n }\n\n private async donateClicked(): Promise<void> {\n if (!this.contactForm) {\n alert(msg('Please enter contact info.'));\n return;\n }\n if (!this.donationInfoValid || !this.donationInfo) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const contactInfo = this.contactForm.donorContactInfo;\n\n switch (this.selectedPaymentProvider) {\n case PaymentProvider.CreditCard:\n this.handleCreditCardDonationFlow(contactInfo, this.donationInfo);\n break;\n case PaymentProvider.Venmo:\n this.handleVenmoDonationFlow(contactInfo, this.donationInfo);\n break;\n }\n }\n\n private async handleCreditCardDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const creditCardFlowHandler = this.paymentFlowHandlers?.creditCardHandler;\n const creditCardHandler =\n await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.hideErrorMessage();\n const valid = this.contactForm?.reportValidity();\n const hostedFieldsResponse = await creditCardFlowHandler?.tokenizeFields();\n\n if (!valid || hostedFieldsResponse === undefined) {\n return;\n }\n\n this.emitPaymentFlowStartedEvent();\n creditCardFlowHandler?.paymentInitiated(\n hostedFieldsResponse,\n donationInfo,\n contactInfo,\n );\n }\n\n private async handleVenmoDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const valid = this.contactForm?.reportValidity();\n if (!valid) {\n return;\n }\n this.paymentFlowHandlers?.venmoHandler?.paymentInitiated(\n contactInfo,\n donationInfo,\n );\n }\n\n private emitPaymentFlowEvent(name: string, extra: object = {}): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n this.dispatchEvent(\n new CustomEvent(name, {\n detail: { paymentProvider: this.selectedPaymentProvider, ...extra },\n }),\n );\n }\n\n private emitPaymentFlowStartedEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowStarted');\n }\n\n private emitPaymentFlowConfirmedEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowConfirmed');\n }\n\n private emitPaymentFlowCancelledEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowCancelled');\n }\n\n private emitPaymentFlowErrorEvent(error?: string): void {\n this.emitPaymentFlowEvent('paymentFlowError', { error });\n }\n\n private showInvalidDonationInfoAlert(): void {\n alert(msg('Please enter a valid donation amount.'));\n }\n\n private async renderPayPalButtonIfNeeded(): Promise<void> {\n if (!this.paypalButtonNeedsRender) {\n return;\n }\n this.paypalButtonNeedsRender = false;\n if (this.donationInfo) {\n await this.paymentFlowHandlers?.paypalHandler?.renderPayPalButton(\n this.donationInfo,\n );\n }\n this.paymentSelector.showPaypalButton();\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('donationInfo') && this.donationInfo) {\n // The PayPal button holds its own copy of the donation info, since the\n // donor starts that payment from the button rather than from our code\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(\n this.donationInfo,\n );\n this.donationFormHeader.donationInfo = this.donationInfo;\n }\n\n if (\n (changedProperties.has('paymentFlowHandlers') ||\n changedProperties.has('donationInfo')) &&\n this.donationInfo &&\n this.paymentFlowHandlers\n ) {\n this.setupFlowHandlers();\n }\n\n if (changedProperties.has('donationInfoValid')) {\n this.paymentSelector.donationInfoValid = this.donationInfoValid;\n }\n\n if (changedProperties.has('selectedPaymentProvider')) {\n this.dispatchEvent(\n new CustomEvent('paymentProviderSelected', {\n detail: {\n paymentProvider: this.selectedPaymentProvider,\n previousPaymentProvider: changedProperties.get(\n 'selectedPaymentProvider',\n ),\n },\n }),\n );\n }\n }\n\n private flowHandlersConfigured = false;\n\n private setupFlowHandlers(): void {\n if (this.flowHandlersConfigured) {\n return;\n }\n this.flowHandlersConfigured = true;\n this.bindFlowListenerEvents();\n this.renderPayPalButtonIfNeeded();\n if (this.donationInfo) {\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(\n this.donationInfo,\n );\n }\n }\n\n private bindFlowListenerEvents(): void {\n const paypal = this.paymentFlowHandlers?.paypalHandler;\n paypal?.on('payPalPaymentStarted', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowStartedEvent();\n });\n paypal?.on('payPalPaymentConfirmed', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowConfirmedEvent();\n });\n paypal?.on('payPalPaymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowCancelledEvent();\n });\n paypal?.on('payPalPaymentError', (_datasource, error) => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowErrorEvent(error);\n });\n\n this.paymentFlowHandlers?.googlePayHandler?.on('paymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.emitPaymentFlowCancelledEvent();\n });\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n const donationInfo: DonationPaymentInfo = e.detail.donationInfo;\n this.donationInfo = new DonationPaymentInfo({\n amount: donationInfo.amount,\n donationType: donationInfo.donationType,\n coverFees: donationInfo.coverFees,\n });\n this.donationInfoValid = true;\n this.dispatchEvent(\n new CustomEvent('donationInfoChanged', { detail: { donationInfo } }),\n );\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n iconBoxStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps it self-contained, so it looks the same whatever\n * the page's root size is. Every part of the form reads it, and the\n * two parts with their own base variable get it passed through.\n */\n --donation-form-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --ia-donation-section-base-font-size: var(\n --donation-form-base-font-size--\n );\n --ia-donation-edit-base-font-size: var(\n --donation-form-base-font-size--\n );\n\n --donation-form-donate-button-font-size--: var(\n --ia-donation-form-donate-button-font-size,\n calc(var(--donation-form-base-font-size--) * 2.6)\n );\n --donation-form-donate-button-height--: var(\n --ia-donation-form-donate-button-height,\n calc(var(--donation-form-base-font-size--) * 4)\n );\n --donation-form-donate-button-color--: var(\n --ia-donation-form-donate-button-color,\n var(--mint-green)\n );\n --donation-form-donate-button-text-color--: var(\n --ia-donation-form-donate-button-text-color,\n var(--true-white)\n );\n --donation-form-donate-button-hover-color--: var(\n --ia-donation-form-donate-button-hover-color,\n #278367\n );\n --donation-form-total-top-margin--: var(\n --ia-donation-form-total-amount-top-margin,\n calc(var(--donation-form-base-font-size--) * 1.5)\n );\n --donation-form-total-bottom-margin--: var(\n --ia-donation-form-total-amount-bottom-margin,\n calc(var(--donation-form-base-font-size--) * 1.2)\n );\n }\n\n h1 {\n margin: 0;\n padding: 0;\n }\n\n .hidden {\n display: none;\n }\n\n .secure-process-note {\n margin-top: 0.5em;\n font-size: 0.75em;\n text-align: center;\n }\n\n .secure-process-note .ia-icon {\n width: calc(var(--donation-form-base-font-size--) * 1.2);\n height: calc(var(--donation-form-base-font-size--) * 1.5);\n vertical-align: bottom;\n }\n\n #donate-button {\n width: 100%;\n appearance: none;\n font-size: var(--donation-form-donate-button-font-size--);\n font-weight: bold;\n text-align: center;\n color: var(--donation-form-donate-button-text-color--);\n cursor: pointer;\n border: none;\n border-radius: 5px;\n background-color: var(--donation-form-donate-button-color--);\n padding-top: var(--padding-sm);\n padding-bottom: var(--padding-sm);\n height: var(--donation-form-donate-button-height--);\n }\n\n #donate-button:hover {\n background-color: var(--donation-form-donate-button-hover-color--);\n }\n\n #total-amount-section {\n display: block;\n margin-top: var(--donation-form-total-top-margin--);\n margin-bottom: var(--donation-form-total-bottom-margin--);\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"ia-donation-form.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/ia-donation-form.ts"],"names":[],"mappings":";AACA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAIX,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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAInD,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,wBAAwB,GAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AACnG,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,oCAAoC,CAAC;AAC5C,OAAO,8CAA8C,CAAC;AACtD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,0CAA0C,CAAC;AAElD;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QASL,iBAAY,GAAwB,2BAA2B,CAAC;QAKrC,kBAAa,GAAa,sBAAsB,CAAC;QAG5E,0BAAqB,G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A3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAqC;AAErC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAAkD;AAG5E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAEmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAEiB;AAE3B;IAAhB,KAAK,EAAE;yDAAmC;AAE1B;IAAhB,KAAK,EAAE;0DAAoC;AAE3B;IAAhB,KAAK,EAAE;yDAAkC;AAEzB;IAAhB,KAAK,EAAE;+DAAmD;AAE7B;IAA7B,KAAK,CAAC,qBAAqB,CAAC;0DAAwC;AAExC;IAA5B,KAAK,CAAC,oBAAoB,CAAC;0DAAuC;AAGnE;IADC,KAAK,CAAC,8BAA8B,CAAC;uDACM;AArCjC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyjB1B","sourcesContent":["import type * as paypal from 'paypal-checkout-components';\nimport {\n css,\n html,\n LitElement,\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 { iconBoxStyles } from '@src/utils/icon-box';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport type { BraintreeManagerInterface } from './braintree/braintree-manager-interface';\nimport type { PaymentFlowHandlersInterface } 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 { IADonationHeader } from './form-elements/ia-donation-header';\nimport type { IADonationPaymentSelector } from './form-elements/ia-donation-payment-selector';\nimport {\n DonationSectionBadgeMode,\n type IADonationSection,\n} from './form-elements/ia-donation-section';\nimport { HostedFieldName } from './braintree/payment-providers/credit-card/hosted-field-container';\nimport { lockIcon } from './icons';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from './models/donation-payment-info';\nimport type { DonationRequest } from './models/donation-request';\nimport { DonationType } from './models/donation-type';\nimport type { DonorContactInfo } from './models/donor-contact-info';\nimport { PaymentProvider } from './models/payment-provider';\nimport { UpsellModalCTAMode } from './modals/ia-donation-upsell-modal-content';\nimport './form-elements/ia-donation-header';\nimport './form-elements/ia-donation-payment-selector';\nimport './form-elements/ia-donation-section';\nimport './form-elements/ia-donation-total-amount';\n\n/**\n * The donation form: amount picker, total, payment method buttons, then the\n * contact form and Donate button for the methods that need them. The\n * controller wires it to Braintree, the modals and recaptcha; on its own it\n * renders and emits events.\n */\n@customElement('ia-donation-form')\nexport class IADonationForm extends LitElement {\n @property({ type: Object }) braintreeManager?: BraintreeManagerInterface;\n\n @property({ type: Object })\n paymentFlowHandlers?: PaymentFlowHandlersInterface;\n\n @property({ type: Object }) donationRequest?: DonationRequest;\n\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n /** The contact form lives in the light DOM (for autofill) and is handed in here */\n @property({ type: Object }) contactForm?: IADonationContactForm;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @state() private creditCardVisible = false;\n\n @state() private contactFormVisible = false;\n\n @state() private donationInfoValid = true;\n\n @state() private selectedPaymentProvider?: PaymentProvider;\n\n @query('#contactFormSection') contactFormSection?: IADonationSection;\n\n @query('ia-donation-header') donationFormHeader!: IADonationHeader;\n\n @query('ia-donation-payment-selector')\n paymentSelector!: IADonationPaymentSelector;\n\n private paypalButtonNeedsRender = true;\n\n render(): TemplateResult {\n return html`\n <ia-donation-header\n .amountOptions=${this.amountOptions}\n .amountSelectionLayout=${this.amountSelectionLayout}\n .frequencySelectionMode=${this.frequencySelectionMode}\n @donationInfoChanged=${this.donationInfoChanged}\n @editDonationError=${this.editDonationError}\n >\n </ia-donation-header>\n\n <ia-donation-section\n .badgeMode=${DonationSectionBadgeMode.HideBadgeLeaveSpacing}\n id=\"total-amount-section\"\n >\n <ia-donation-total-amount .donationInfo=${this.donationInfo}>\n </ia-donation-total-amount>\n </ia-donation-section>\n\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart}`}\n headline=${msg('Choose a payment method')}\n >\n <ia-donation-payment-selector\n .paymentProviders=${this.braintreeManager?.paymentProviders}\n @firstUpdated=${this.paymentSelectorFirstUpdated}\n @creditCardSelected=${this.creditCardSelected}\n @venmoSelected=${this.venmoSelected}\n @applePaySelected=${this.applePaySelected}\n @googlePaySelected=${this.googlePaySelected}\n @paypalBlockerSelected=${this.paypalBlockerSelected}\n @resetPaymentMethod=${() => {\n this.selectedPaymentProvider = undefined;\n this.contactFormVisible = false;\n }}\n >\n <slot name=\"paypal-button\" slot=\"paypal-button\"></slot>\n <div\n class=\"credit-card-fields ${this.creditCardVisible ? '' : 'hidden'}\"\n slot=\"credit-card-fields\"\n >\n <slot name=\"braintree-hosted-fields\"></slot>\n </div>\n </ia-donation-payment-selector>\n </ia-donation-section>\n\n <div\n class=\"contact-form-section ${this.contactFormVisible ? '' : 'hidden'}\"\n >\n ${this.contactFormSectionTemplate}\n </div>\n `;\n }\n\n /** Developer convenience: show the confirmation step without a payment. */\n async showConfirmationModalDev(options: {\n donationType: DonationType;\n amount: number;\n currencyType: string;\n cancelDonationCB: () => void;\n confirmDonationCB: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showConfirmationStepModal(options);\n }\n\n /**\n * Developer convenience: show the upsell modal without going through a\n * payment. With the PayPal slot mode it also renders the PayPal button.\n */\n async showUpsellModalDev(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.paymentFlowHandlers?.showUpsellModal(options);\n\n if (options.ctaMode === UpsellModalCTAMode.PayPalUpsellSlot) {\n const handler =\n await this.braintreeManager?.paymentProviders.paypalHandler.get();\n const donationInfo = new DonationPaymentInfo({\n amount: options.oneTimeAmount,\n donationType: DonationType.OneTime,\n coverFees: false,\n });\n handler?.renderPayPalButton({\n selector: '#paypal-upsell-button',\n style: {\n color: 'blue' as paypal.ButtonColorOption,\n label: 'paypal' as paypal.ButtonLabelOption,\n shape: 'rect' as paypal.ButtonShapeOption,\n size: 'responsive' as paypal.ButtonSizeOption,\n tagline: false,\n },\n donationInfo,\n });\n }\n }\n\n get contactFormSectionTemplate(): TemplateResult {\n const headline =\n this.selectedPaymentProvider === PaymentProvider.Venmo\n ? msg('Help us stay in touch')\n : msg('Enter contact information');\n\n return html`\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart + 1}`}\n headline=${headline}\n id=\"contactFormSection\"\n >\n <slot name=\"contact-form\"></slot>\n </ia-donation-section>\n\n <ia-donation-section\n .sectionBadge=${`${this.paymentSelectorNumberingStart + 2}`}\n >\n <slot name=\"recaptcha\"></slot>\n <button id=\"donate-button\" @click=${this.donateClicked}>\n ${msg('Donate')}\n </button>\n\n <div class=\"secure-process-note\">\n ${lockIcon} ${msg('Your payment will be securely processed')}\n </div>\n </ia-donation-section>\n `;\n }\n\n /**\n * The step number of the payment selector. With the frequency buttons\n * showing they're step 1 and the amount is 2, so payment is 3. In checkbox\n * mode the amount picker is step 1 and payment is 2.\n */\n private get paymentSelectorNumberingStart(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 3\n : 2;\n }\n\n private editDonationError(): void {\n this.donationInfoValid = false;\n }\n\n private paymentSelectorFirstUpdated(): void {\n if (this.paymentFlowHandlers?.paypalHandler) {\n this.renderPayPalButtonIfNeeded();\n }\n }\n\n private applePaySelected(e: CustomEvent): void {\n this.selectedPaymentProvider = PaymentProvider.ApplePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const originalEvent = e.detail.originalEvent;\n if (this.donationInfo) {\n this.paymentFlowHandlers?.applePayHandler?.paymentInitiated(\n this.donationInfo,\n originalEvent,\n );\n }\n this.emitPaymentFlowStartedEvent();\n }\n\n private googlePaySelected(): void {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n if (this.donationInfo) {\n this.paymentFlowHandlers?.googlePayHandler?.paymentInitiated(\n this.donationInfo,\n );\n }\n this.emitPaymentFlowStartedEvent();\n }\n\n private async creditCardSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.CreditCard;\n this.contactFormVisible = true;\n this.creditCardVisible = true;\n this.focusCreditCardNumberField();\n }\n\n private async venmoSelected(): Promise<void> {\n if (!this.donationInfoValid) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n this.selectedPaymentProvider = PaymentProvider.Venmo;\n this.contactFormVisible = true;\n this.creditCardVisible = false;\n this.focusContactForm();\n }\n\n private paypalBlockerSelected(): void {\n this.contactFormVisible = false;\n this.creditCardVisible = false;\n this.showInvalidDonationInfoAlert();\n }\n\n private async focusContactForm(): Promise<void> {\n await this.updateComplete;\n if (this.contactFormSection) {\n this.contactForm?.focus();\n }\n }\n\n private async focusCreditCardNumberField(): Promise<void> {\n await this.updateComplete;\n const creditCardHandler =\n await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.focusField(HostedFieldName.Number);\n }\n\n private async donateClicked(): Promise<void> {\n if (!this.contactForm) {\n alert(msg('Please enter contact info.'));\n return;\n }\n if (!this.donationInfoValid || !this.donationInfo) {\n this.showInvalidDonationInfoAlert();\n return;\n }\n\n const contactInfo = this.contactForm.donorContactInfo;\n\n switch (this.selectedPaymentProvider) {\n case PaymentProvider.CreditCard:\n this.handleCreditCardDonationFlow(contactInfo, this.donationInfo);\n break;\n case PaymentProvider.Venmo:\n this.handleVenmoDonationFlow(contactInfo, this.donationInfo);\n break;\n }\n }\n\n private async handleCreditCardDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const creditCardFlowHandler = this.paymentFlowHandlers?.creditCardHandler;\n const creditCardHandler =\n await this.braintreeManager?.paymentProviders.creditCardHandler.get();\n creditCardHandler?.hideErrorMessage();\n const valid = this.contactForm?.reportValidity();\n const hostedFieldsResponse = await creditCardFlowHandler?.tokenizeFields();\n\n if (!valid || hostedFieldsResponse === undefined) {\n return;\n }\n\n this.emitPaymentFlowStartedEvent();\n creditCardFlowHandler?.paymentInitiated(\n hostedFieldsResponse,\n donationInfo,\n contactInfo,\n );\n }\n\n private async handleVenmoDonationFlow(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n const valid = this.contactForm?.reportValidity();\n if (!valid) {\n return;\n }\n this.paymentFlowHandlers?.venmoHandler?.paymentInitiated(\n contactInfo,\n donationInfo,\n );\n }\n\n private emitPaymentFlowEvent(name: string, extra: object = {}): void {\n if (!this.selectedPaymentProvider) {\n return;\n }\n this.dispatchEvent(\n new CustomEvent(name, {\n detail: { paymentProvider: this.selectedPaymentProvider, ...extra },\n }),\n );\n }\n\n private emitPaymentFlowStartedEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowStarted');\n }\n\n private emitPaymentFlowConfirmedEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowConfirmed');\n }\n\n private emitPaymentFlowCancelledEvent(): void {\n this.emitPaymentFlowEvent('paymentFlowCancelled');\n }\n\n private emitPaymentFlowErrorEvent(error?: string): void {\n this.emitPaymentFlowEvent('paymentFlowError', { error });\n }\n\n private showInvalidDonationInfoAlert(): void {\n alert(msg('Please enter a valid donation amount.'));\n }\n\n private async renderPayPalButtonIfNeeded(): Promise<void> {\n if (!this.paypalButtonNeedsRender) {\n return;\n }\n this.paypalButtonNeedsRender = false;\n if (this.donationInfo) {\n await this.paymentFlowHandlers?.paypalHandler?.renderPayPalButton(\n this.donationInfo,\n );\n }\n this.paymentSelector.showPaypalButton();\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('donationInfo') && this.donationInfo) {\n // The PayPal button holds its own copy of the donation info, since the\n // donor starts that payment from the button rather than from our code\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(\n this.donationInfo,\n );\n this.donationFormHeader.donationInfo = this.donationInfo;\n }\n\n if (\n (changedProperties.has('paymentFlowHandlers') ||\n changedProperties.has('donationInfo')) &&\n this.donationInfo &&\n this.paymentFlowHandlers\n ) {\n this.setupFlowHandlers();\n }\n\n if (changedProperties.has('donationInfoValid')) {\n this.paymentSelector.donationInfoValid = this.donationInfoValid;\n }\n\n if (changedProperties.has('selectedPaymentProvider')) {\n this.dispatchEvent(\n new CustomEvent('paymentProviderSelected', {\n detail: {\n paymentProvider: this.selectedPaymentProvider,\n previousPaymentProvider: changedProperties.get(\n 'selectedPaymentProvider',\n ),\n },\n }),\n );\n }\n }\n\n private flowHandlersConfigured = false;\n\n private setupFlowHandlers(): void {\n if (this.flowHandlersConfigured) {\n return;\n }\n this.flowHandlersConfigured = true;\n this.bindFlowListenerEvents();\n this.renderPayPalButtonIfNeeded();\n if (this.donationInfo) {\n this.paymentFlowHandlers?.paypalHandler?.updateDonationInfo(\n this.donationInfo,\n );\n }\n }\n\n private bindFlowListenerEvents(): void {\n const paypal = this.paymentFlowHandlers?.paypalHandler;\n paypal?.on('payPalPaymentStarted', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowStartedEvent();\n });\n paypal?.on('payPalPaymentConfirmed', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowConfirmedEvent();\n });\n paypal?.on('payPalPaymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowCancelledEvent();\n });\n paypal?.on('payPalPaymentError', (_datasource, error) => {\n this.selectedPaymentProvider = PaymentProvider.PayPal;\n this.emitPaymentFlowErrorEvent(error);\n });\n\n this.paymentFlowHandlers?.googlePayHandler?.on('paymentCancelled', () => {\n this.selectedPaymentProvider = PaymentProvider.GooglePay;\n this.emitPaymentFlowCancelledEvent();\n });\n }\n\n private donationInfoChanged(e: CustomEvent): void {\n const donationInfo: DonationPaymentInfo = e.detail.donationInfo;\n this.donationInfo = new DonationPaymentInfo({\n amount: donationInfo.amount,\n donationType: donationInfo.donationType,\n coverFees: donationInfo.coverFees,\n });\n this.donationInfoValid = true;\n this.dispatchEvent(\n new CustomEvent('donationInfoChanged', { detail: { donationInfo } }),\n );\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n iconBoxStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps it self-contained, so it looks the same whatever\n * the page's root size is. Every part of the form reads it, and the\n * two parts with their own base variable get it passed through.\n */\n --donation-form-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --ia-donation-section-base-font-size: var(\n --donation-form-base-font-size--\n );\n --ia-donation-edit-base-font-size: var(\n --donation-form-base-font-size--\n );\n\n --donation-form-donate-button-font-size--: var(\n --ia-donation-form-donate-button-font-size,\n calc(var(--donation-form-base-font-size--) * 2.6)\n );\n --donation-form-donate-button-height--: var(\n --ia-donation-form-donate-button-height,\n calc(var(--donation-form-base-font-size--) * 4)\n );\n --donation-form-donate-button-color--: var(\n --ia-donation-form-donate-button-color,\n var(--mint-green)\n );\n --donation-form-donate-button-text-color--: var(\n --ia-donation-form-donate-button-text-color,\n var(--true-white)\n );\n --donation-form-donate-button-hover-color--: var(\n --ia-donation-form-donate-button-hover-color,\n #278367\n );\n --donation-form-total-top-margin--: var(\n --ia-donation-form-total-amount-top-margin,\n calc(var(--donation-form-base-font-size--) * 1.5)\n );\n --donation-form-total-bottom-margin--: var(\n --ia-donation-form-total-amount-bottom-margin,\n calc(var(--donation-form-base-font-size--) * 1.2)\n );\n }\n\n h1 {\n margin: 0;\n padding: 0;\n }\n\n .hidden {\n display: none;\n }\n\n .secure-process-note {\n margin-top: 0.5em;\n font-size: 0.75em;\n text-align: center;\n }\n\n .secure-process-note .ia-icon {\n width: calc(var(--donation-form-base-font-size--) * 1.2);\n height: calc(var(--donation-form-base-font-size--) * 1.5);\n vertical-align: bottom;\n }\n\n #donate-button {\n width: 100%;\n appearance: none;\n font-size: var(--donation-form-donate-button-font-size--);\n font-weight: bold;\n text-align: center;\n color: var(--donation-form-donate-button-text-color--);\n cursor: pointer;\n border: none;\n border-radius: 5px;\n background-color: var(--donation-form-donate-button-color--);\n padding-top: var(--padding-sm);\n padding-bottom: var(--padding-sm);\n height: var(--donation-form-donate-button-height--);\n }\n\n #donate-button:hover {\n background-color: var(--donation-form-donate-button-hover-color--);\n }\n\n #total-amount-section {\n display: block;\n margin-top: var(--donation-form-total-top-margin--);\n margin-bottom: var(--donation-form-total-bottom-margin--);\n }\n `,\n ];\n }\n}\n"]}
@@ -5,7 +5,7 @@ import googlePay from '../../icons/googlepay.js';
5
5
  import lock from '../../icons/lock.js';
6
6
  import paypal from '../../icons/paypal.js';
7
7
  import venmo from '../../icons/venmo.js';
8
- import { iconBox } from '../../util/icon-box.js';
8
+ import { iconBox } from '../../utils/icon-box.js';
9
9
  /**
10
10
  * The form's icons, wrapped in a box the host sizes (see `iconBoxStyles`).
11
11
  * The field glyphs take their colour from the host's `color`. The payment
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/icons.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import applePay from '@src/icons/applepay';\nimport calendar from '@src/icons/calendar';\nimport creditCard from '@src/icons/credit-card';\nimport googlePay from '@src/icons/googlepay';\nimport lock from '@src/icons/lock';\nimport paypal from '@src/icons/paypal';\nimport venmo from '@src/icons/venmo';\nimport { iconBox } from '@src/util/icon-box';\n\n/**\n * The form's icons, wrapped in a box the host sizes (see `iconBoxStyles`).\n * The field glyphs take their colour from the host's `color`. The payment\n * brand logos keep their own colours.\n */\nexport const applePayLogo = iconBox(applePay);\nexport const googlePayLogo = iconBox(googlePay);\nexport const paypalLogo = iconBox(paypal);\nexport const venmoLogo = iconBox(venmo);\n\nexport const calendarIcon = iconBox(calendar);\nexport const creditCardIcon = iconBox(creditCard);\nexport const lockIcon = iconBox(lock);\n"]}
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../src/elements/ia-donation-form/icons.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import applePay from '@src/icons/applepay';\nimport calendar from '@src/icons/calendar';\nimport creditCard from '@src/icons/credit-card';\nimport googlePay from '@src/icons/googlepay';\nimport lock from '@src/icons/lock';\nimport paypal from '@src/icons/paypal';\nimport venmo from '@src/icons/venmo';\nimport { iconBox } from '@src/utils/icon-box';\n\n/**\n * The form's icons, wrapped in a box the host sizes (see `iconBoxStyles`).\n * The field glyphs take their colour from the host's `color`. The payment\n * brand logos keep their own colours.\n */\nexport const applePayLogo = iconBox(applePay);\nexport const googlePayLogo = iconBox(googlePay);\nexport const paypalLogo = iconBox(paypal);\nexport const venmoLogo = iconBox(venmo);\n\nexport const calendarIcon = iconBox(calendar);\nexport const creditCardIcon = iconBox(creditCard);\nexport const lockIcon = iconBox(lock);\n"]}
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
- import { customElement } from '../../../util/custom-element.js';
4
+ import { customElement } from '../../../utils/custom-element.js';
5
5
  import { msg } from '@lit/localize';
6
6
  import currency from 'currency.js';
7
7
  import themeStyles from '../../../themes/theme-styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ia-donation-confirm-modal.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-confirm-modal.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU;IAA/C;;QACuB,WAAM,GAAG,CAAC,CAAC;QAEvC,iFAAiF;QACrD,iBAAY,GAAG,KAAK,CAAC;QAErB,iBAAY,GAAiB,YAAY,CAAC,OAAO,CAAC;QAE9C,oBAAe,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;QAEvC,mBAAc,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAgKxE,CAAC;IA9JC,IAAY,eAAe;QACzB,OAAO,QAAQ,CAAC,IAA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CAAC;8DAAuC;AAV3D,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA0KlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { msg } from '@lit/localize';\nimport currency from 'currency.js';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { DonationType } from '../models/donation-type';\n\n/**\n * The confirmation step shown before a PayPal donation goes through: what the\n * donor is about to give, with Complete and Cancel buttons.\n */\n@customElement('ia-donation-confirm-modal')\nexport class IADonationConfirmModal extends LitElement {\n @property({ type: Number }) amount = 5;\n\n /** An ISO currency code, e.g. `USD`. Drives the symbol shown with the amount. */\n @property({ type: String }) currencyType = 'USD';\n\n @property({ type: String }) donationType: DonationType = DonationType.OneTime;\n\n @property({ attribute: false }) confirmDonation: () => void = () => {};\n\n @property({ attribute: false }) cancelDonation: () => void = () => {};\n\n private get formattedAmount(): string {\n return currency(this.amount, { symbol: this.currencySymbol }).format();\n }\n\n get confirmationText(): TemplateResult {\n return msg(html`\n <p>\n You are about to make a <b>${this.donationType}</b> donation of\n <b>${this.formattedAmount} ${this.currencyType}</b> to the Internet\n Archive.\n </p>\n `);\n }\n\n get confirmUpsellText(): TemplateResult {\n return msg(html`\n <p>\n You are about to begin making <b>monthly</b> donations of\n <b>${this.formattedAmount} ${this.currencyType}</b> to the Internet\n Archive. (Your first recurring contribution will be next month.)\n </p>\n `);\n }\n\n get confirmCTA(): string {\n return this.donationType === DonationType.Upsell\n ? msg('Start monthly donation')\n : msg('Complete donation');\n }\n\n render(): TemplateResult {\n return html`\n ${this.donationType === DonationType.Upsell\n ? this.confirmUpsellText\n : this.confirmationText}\n\n <div class=\"cta-group\">\n <button id=\"confirm\" @click=${() => this.confirmDonation()}>\n ${this.confirmCTA}\n </button>\n <button id=\"cancel\" @click=${() => this.cancelDonation()}>\n ${msg('Cancel')}\n </button>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-confirm-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-confirm-cta-color--: var(\n --ia-donation-upsell-cta-button-color,\n var(--navy-blue)\n );\n --donation-confirm-cta-disabled-color--: var(\n --ia-donation-upsell-cta-button-disabled-color,\n rgba(109, 148, 201, 0.5)\n );\n\n display: block;\n }\n\n button {\n outline: none;\n cursor: pointer;\n }\n\n button#confirm {\n font-size: calc(var(--donation-confirm-base-font-size--) * 2);\n display: block;\n width: 100%;\n margin-top: var(--padding-sm);\n padding: var(--donation-confirm-base-font-size--)\n calc(var(--donation-confirm-base-font-size--) * 2);\n background-color: var(--donation-confirm-cta-color--);\n color: var(--true-white);\n border-radius: 5px;\n border: 0;\n font-weight: bold;\n line-height: normal;\n }\n\n button#cancel {\n margin-top: var(--donation-confirm-base-font-size--);\n border: 0;\n text-decoration: underline;\n background-color: transparent;\n }\n\n button:disabled {\n background-color: var(--donation-confirm-cta-disabled-color--);\n cursor: not-allowed;\n }\n `,\n ];\n }\n\n /**\n * The symbol for a PayPal-supported currency code. Dollars for anything\n * unlisted, which covers USD and NZD.\n * https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/\n */\n get currencySymbol(): string {\n switch (this.currencyType) {\n case 'AUD':\n return 'AU$';\n case 'BRL':\n return 'R$';\n case 'CAD':\n return 'CA$';\n case 'CHF':\n return 'Fr';\n case 'CNY':\n return '¥';\n case 'CZK':\n return 'Kč';\n case 'DKK':\n return 'Kr';\n case 'EUR':\n return '€';\n case 'GBP':\n return '£';\n case 'HKD':\n return 'HK$';\n case 'HUF':\n return 'Ft';\n case 'ILS':\n return '₪';\n case 'JPY':\n return '¥';\n case 'MXN':\n return 'MX$';\n case 'MYR':\n return 'RM';\n case 'NOK':\n return 'kr';\n case 'PLN':\n return 'zł';\n case 'RUB':\n return '₽';\n case 'SEK':\n return 'kr';\n case 'SGD':\n return 'S$';\n case 'THB':\n return '฿';\n case 'TWD':\n return 'NT$';\n default:\n return '$';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ia-donation-confirm-modal.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-confirm-modal.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU;IAA/C;;QACuB,WAAM,GAAG,CAAC,CAAC;QAEvC,iFAAiF;QACrD,iBAAY,GAAG,KAAK,CAAC;QAErB,iBAAY,GAAiB,YAAY,CAAC,OAAO,CAAC;QAE9C,oBAAe,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;QAEvC,mBAAc,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAgKxE,CAAC;IA9JC,IAAY,eAAe;QACzB,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IACzE,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,GAAG,CAAC,IAAI,CAAA;;qCAEkB,IAAI,CAAC,YAAY;aACzC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY;;;KAGjD,CAAC,CAAC;IACL,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,GAAG,CAAC,IAAI,CAAA;;;aAGN,IAAI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ACf,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC;YACb,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC;YACb,KAAK,KAAK;gBACR,OAAO,KAAK,CAAC;YACf,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC;YACb,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC;YACd,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC;YACb,KAAK,KAAK;gBACR,OAAO,KAAK,CAAC;YACf;gBACE,OAAO,GAAG,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAzK6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAY;AAGX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAmD;AAE9C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+DAAwC;AAEvC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8DAAuC;AAV3D,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA0KlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { msg } from '@lit/localize';\nimport currency from 'currency.js';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { DonationType } from '../models/donation-type';\n\n/**\n * The confirmation step shown before a PayPal donation goes through: what the\n * donor is about to give, with Complete and Cancel buttons.\n */\n@customElement('ia-donation-confirm-modal')\nexport class IADonationConfirmModal extends LitElement {\n @property({ type: Number }) amount = 5;\n\n /** An ISO currency code, e.g. `USD`. Drives the symbol shown with the amount. */\n @property({ type: String }) currencyType = 'USD';\n\n @property({ type: String }) donationType: DonationType = DonationType.OneTime;\n\n @property({ attribute: false }) confirmDonation: () => void = () => {};\n\n @property({ attribute: false }) cancelDonation: () => void = () => {};\n\n private get formattedAmount(): string {\n return currency(this.amount, { symbol: this.currencySymbol }).format();\n }\n\n get confirmationText(): TemplateResult {\n return msg(html`\n <p>\n You are about to make a <b>${this.donationType}</b> donation of\n <b>${this.formattedAmount} ${this.currencyType}</b> to the Internet\n Archive.\n </p>\n `);\n }\n\n get confirmUpsellText(): TemplateResult {\n return msg(html`\n <p>\n You are about to begin making <b>monthly</b> donations of\n <b>${this.formattedAmount} ${this.currencyType}</b> to the Internet\n Archive. (Your first recurring contribution will be next month.)\n </p>\n `);\n }\n\n get confirmCTA(): string {\n return this.donationType === DonationType.Upsell\n ? msg('Start monthly donation')\n : msg('Complete donation');\n }\n\n render(): TemplateResult {\n return html`\n ${this.donationType === DonationType.Upsell\n ? this.confirmUpsellText\n : this.confirmationText}\n\n <div class=\"cta-group\">\n <button id=\"confirm\" @click=${() => this.confirmDonation()}>\n ${this.confirmCTA}\n </button>\n <button id=\"cancel\" @click=${() => this.cancelDonation()}>\n ${msg('Cancel')}\n </button>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-confirm-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-confirm-cta-color--: var(\n --ia-donation-upsell-cta-button-color,\n var(--navy-blue)\n );\n --donation-confirm-cta-disabled-color--: var(\n --ia-donation-upsell-cta-button-disabled-color,\n rgba(109, 148, 201, 0.5)\n );\n\n display: block;\n }\n\n button {\n outline: none;\n cursor: pointer;\n }\n\n button#confirm {\n font-size: calc(var(--donation-confirm-base-font-size--) * 2);\n display: block;\n width: 100%;\n margin-top: var(--padding-sm);\n padding: var(--donation-confirm-base-font-size--)\n calc(var(--donation-confirm-base-font-size--) * 2);\n background-color: var(--donation-confirm-cta-color--);\n color: var(--true-white);\n border-radius: 5px;\n border: 0;\n font-weight: bold;\n line-height: normal;\n }\n\n button#cancel {\n margin-top: var(--donation-confirm-base-font-size--);\n border: 0;\n text-decoration: underline;\n background-color: transparent;\n }\n\n button:disabled {\n background-color: var(--donation-confirm-cta-disabled-color--);\n cursor: not-allowed;\n }\n `,\n ];\n }\n\n /**\n * The symbol for a PayPal-supported currency code. Dollars for anything\n * unlisted, which covers USD and NZD.\n * https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/\n */\n get currencySymbol(): string {\n switch (this.currencyType) {\n case 'AUD':\n return 'AU$';\n case 'BRL':\n return 'R$';\n case 'CAD':\n return 'CA$';\n case 'CHF':\n return 'Fr';\n case 'CNY':\n return '¥';\n case 'CZK':\n return 'Kč';\n case 'DKK':\n return 'Kr';\n case 'EUR':\n return '€';\n case 'GBP':\n return '£';\n case 'HKD':\n return 'HK$';\n case 'HUF':\n return 'Ft';\n case 'ILS':\n return '₪';\n case 'JPY':\n return '¥';\n case 'MXN':\n return 'MX$';\n case 'MYR':\n return 'RM';\n case 'NOK':\n return 'kr';\n case 'PLN':\n return 'zł';\n case 'RUB':\n return '₽';\n case 'SEK':\n return 'kr';\n case 'SGD':\n return 'S$';\n case 'THB':\n return '฿';\n case 'TWD':\n return 'NT$';\n default:\n return '$';\n }\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, } from 'lit';
3
- import { customElement } from '../../../util/custom-element.js';
3
+ import { customElement } from '../../../utils/custom-element.js';
4
4
  import { msg } from '@lit/localize';
5
5
  import themeStyles from '../../../themes/theme-styles.js';
6
6
  /** The footer of the error modal: a link to the help article on failed donations. */
@@ -1 +1 @@
1
- {"version":3,"file":"ia-donation-error-modal-content.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-error-modal-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,qFAAqF;AAE9E,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,UAAU;IACzD,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;YAOH,GAAG,CAAC,YAAY,CAAC;;;KAGxB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AApDY,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CAoDvC","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { customElement } from '@src/util/custom-element';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/** The footer of the error modal: a link to the help article on failed donations. */\n@customElement('ia-donation-error-modal-content')\nexport class IADonationErrorModalContent extends LitElement {\n render(): TemplateResult {\n return html`\n <div class=\"container\">\n <a\n href=\"https://help.archive.org/help/why-is-there-a-problem-processing-my-donation/\"\n rel=\"noopener\"\n target=\"_blank\"\n >\n ${msg('Questions?')}\n </a>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-error-modal-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-error-modal-link-top-margin--: var(\n --ia-donation-error-modal-link-top-margin,\n var(--donation-error-modal-base-font-size--)\n );\n --donation-error-modal-link-color--: var(\n --ia-donation-error-modal-link-color,\n var(--mid-gray)\n );\n --donation-error-modal-link-font-size--: var(\n --ia-donation-error-modal-link-font-size,\n calc(var(--donation-error-modal-base-font-size--) * 1.4)\n );\n }\n\n .container {\n margin-top: var(--donation-error-modal-link-top-margin--);\n text-align: center;\n }\n\n a,\n a:link,\n a:visited {\n color: var(--donation-error-modal-link-color--);\n font-size: var(--donation-error-modal-link-font-size--);\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"ia-donation-error-modal-content.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/modals/ia-donation-error-modal-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,qFAAqF;AAE9E,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,UAAU;IACzD,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;YAOH,GAAG,CAAC,YAAY,CAAC;;;KAGxB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AApDY,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CAoDvC","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { customElement } from '@src/utils/custom-element';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/** The footer of the error modal: a link to the help article on failed donations. */\n@customElement('ia-donation-error-modal-content')\nexport class IADonationErrorModalContent extends LitElement {\n render(): TemplateResult {\n return html`\n <div class=\"container\">\n <a\n href=\"https://help.archive.org/help/why-is-there-a-problem-processing-my-donation/\"\n rel=\"noopener\"\n target=\"_blank\"\n >\n ${msg('Questions?')}\n </a>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-error-modal-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-error-modal-link-top-margin--: var(\n --ia-donation-error-modal-link-top-margin,\n var(--donation-error-modal-base-font-size--)\n );\n --donation-error-modal-link-color--: var(\n --ia-donation-error-modal-link-color,\n var(--mid-gray)\n );\n --donation-error-modal-link-font-size--: var(\n --ia-donation-error-modal-link-font-size,\n calc(var(--donation-error-modal-base-font-size--) * 1.4)\n );\n }\n\n .container {\n margin-top: var(--donation-error-modal-link-top-margin--);\n text-align: center;\n }\n\n a,\n a:link,\n a:visited {\n color: var(--donation-error-modal-link-color--);\n font-size: var(--donation-error-modal-link-font-size--);\n }\n `,\n ];\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, nothing, } from 'lit';
3
3
  import { property, query } from 'lit/decorators.js';
4
- import { customElement } from '../../../util/custom-element.js';
4
+ 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';
@@ -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,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO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AqSxC","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/util/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,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,G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ourcesContent":["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,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, nothing, } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
- import { customElement } from '../../util/custom-element.js';
4
+ import { customElement } from '../../utils/custom-element.js';
5
5
  import { msg, str } from '@lit/localize';
6
6
  import themeStyles from '../../themes/theme-styles.js';
7
7
  /**