@internetarchive/donation-form 1.0.3-alpha-webdev7960.0 → 1.0.3-webdev-8122.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 (210) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +115 -115
  3. package/dist/demo/braintree-endpoint-manager.js.map +1 -1
  4. package/dist/demo/demo-analytics-handler.js.map +1 -1
  5. package/dist/demo/submit-form-with.js.map +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/src/braintree-manager/braintree-interfaces.js.map +1 -1
  8. package/dist/src/braintree-manager/braintree-manager.js.map +1 -1
  9. package/dist/src/braintree-manager/payment-clients.js.map +1 -1
  10. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.js.map +1 -1
  11. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.js.map +1 -1
  12. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.js.map +1 -1
  13. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.js.map +1 -1
  14. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.js.map +1 -1
  15. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay.js.map +1 -1
  16. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card-interface.js.map +1 -1
  17. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card.js.map +1 -1
  18. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.js.map +1 -1
  19. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-container.js.map +1 -1
  20. package/dist/src/braintree-manager/payment-providers/google-pay-interface.js.map +1 -1
  21. package/dist/src/braintree-manager/payment-providers/google-pay.js.map +1 -1
  22. package/dist/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.js.map +1 -1
  23. package/dist/src/braintree-manager/payment-providers/paypal/paypal-interface.js.map +1 -1
  24. package/dist/src/braintree-manager/payment-providers/paypal/paypal.js.map +1 -1
  25. package/dist/src/braintree-manager/payment-providers/venmo-interface.js.map +1 -1
  26. package/dist/src/braintree-manager/payment-providers/venmo.js.map +1 -1
  27. package/dist/src/braintree-manager/payment-providers-interface.js.map +1 -1
  28. package/dist/src/braintree-manager/payment-providers.js.map +1 -1
  29. package/dist/src/donation-form-controller.js +123 -123
  30. package/dist/src/donation-form-controller.js.map +1 -1
  31. package/dist/src/donation-form-error.js.map +1 -1
  32. package/dist/src/donation-form.js +107 -107
  33. package/dist/src/donation-form.js.map +1 -1
  34. package/dist/src/form-elements/badged-input.js +47 -47
  35. package/dist/src/form-elements/badged-input.js.map +1 -1
  36. package/dist/src/form-elements/contact-form/autocomplete-field-options.js.map +1 -1
  37. package/dist/src/form-elements/contact-form/contact-form.js +159 -157
  38. package/dist/src/form-elements/contact-form/contact-form.js.map +1 -1
  39. package/dist/src/form-elements/contact-form/countries.js.map +1 -1
  40. package/dist/src/form-elements/header/donation-form-header.js +14 -14
  41. package/dist/src/form-elements/header/donation-form-header.js.map +1 -1
  42. package/dist/src/form-elements/header/donation-summary.js +15 -15
  43. package/dist/src/form-elements/header/donation-summary.js.map +1 -1
  44. package/dist/src/form-elements/payment-selector.js +164 -164
  45. package/dist/src/form-elements/payment-selector.js.map +1 -1
  46. package/dist/src/form-elements/total-amount.js +16 -16
  47. package/dist/src/form-elements/total-amount.js.map +1 -1
  48. package/dist/src/modals/confirm-donation-modal-content.js +51 -51
  49. package/dist/src/modals/confirm-donation-modal-content.js.map +1 -1
  50. package/dist/src/modals/error-modal-content.js +22 -22
  51. package/dist/src/modals/error-modal-content.js.map +1 -1
  52. package/dist/src/modals/upsell-modal-content.js +182 -182
  53. package/dist/src/modals/upsell-modal-content.js.map +1 -1
  54. package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js +20 -20
  55. package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js.map +1 -1
  56. package/dist/src/payment-flow-handlers/handlers/applepay-flow-handler.js.map +1 -1
  57. package/dist/src/payment-flow-handlers/handlers/creditcard-flow-handler.js.map +1 -1
  58. package/dist/src/payment-flow-handlers/handlers/googlepay-flow-handler.js +2 -0
  59. package/dist/src/payment-flow-handlers/handlers/googlepay-flow-handler.js.map +1 -1
  60. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js +2 -0
  61. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js.map +1 -1
  62. package/dist/src/payment-flow-handlers/handlers/venmo-flow-handler.js.map +1 -1
  63. package/dist/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.js.map +1 -1
  64. package/dist/src/payment-flow-handlers/payment-flow-handlers.js.map +1 -1
  65. package/dist/src/recaptcha-manager/recaptcha-manager.js.map +1 -1
  66. package/dist/src/util/promisedSleep.js.map +1 -1
  67. package/dist/test/helpers/fillInContactForm.js.map +1 -1
  68. package/dist/test/mocks/flow-handlers/individual-handlers/mock-applepay-flow-handler.js.map +1 -1
  69. package/dist/test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.js.map +1 -1
  70. package/dist/test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.js.map +1 -1
  71. package/dist/test/mocks/flow-handlers/individual-handlers/mock-paypal-flow-handler.js.map +1 -1
  72. package/dist/test/mocks/flow-handlers/individual-handlers/mock-venmo-flow-handler.js.map +1 -1
  73. package/dist/test/mocks/flow-handlers/mock-payment-flow-handlers.js.map +1 -1
  74. package/dist/test/mocks/mock-braintree-manager.js.map +1 -1
  75. package/dist/test/mocks/mock-donation-info.js.map +1 -1
  76. package/dist/test/mocks/mock-endpoint-manager.js.map +1 -1
  77. package/dist/test/mocks/mock-hosted-fields-config.js.map +1 -1
  78. package/dist/test/mocks/mock-hosted-fields-container.js.map +1 -1
  79. package/dist/test/mocks/mock-lazy-loader.js.map +1 -1
  80. package/dist/test/mocks/mock-modal-manager.js.map +1 -1
  81. package/dist/test/mocks/mock-payment-clients.js.map +1 -1
  82. package/dist/test/mocks/mock-paypal-button-renderer.js.map +1 -1
  83. package/dist/test/mocks/mock-recaptcha-manager.js.map +1 -1
  84. package/dist/test/mocks/models/mock-billing-info.js +2 -0
  85. package/dist/test/mocks/models/mock-billing-info.js.map +1 -1
  86. package/dist/test/mocks/models/mock-custom-fields.js.map +1 -1
  87. package/dist/test/mocks/models/mock-customer-info.js.map +1 -1
  88. package/dist/test/mocks/models/mock-donation-request.js.map +1 -1
  89. package/dist/test/mocks/models/mock-success-response.js.map +1 -1
  90. package/dist/test/mocks/payment-clients/mock-applepay-client.js.map +1 -1
  91. package/dist/test/mocks/payment-clients/mock-applepay-payment.js.map +1 -1
  92. package/dist/test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.js.map +1 -1
  93. package/dist/test/mocks/payment-clients/mock-applepay-session.js.map +1 -1
  94. package/dist/test/mocks/payment-clients/mock-applepay-sessionmanager.js.map +1 -1
  95. package/dist/test/mocks/payment-clients/mock-applepay-validatemerchantevent.js.map +1 -1
  96. package/dist/test/mocks/payment-clients/mock-braintree-client.js.map +1 -1
  97. package/dist/test/mocks/payment-clients/mock-data-collector.js.map +1 -1
  98. package/dist/test/mocks/payment-clients/mock-googlepay-client.js.map +1 -1
  99. package/dist/test/mocks/payment-clients/mock-googlepay-library.js.map +1 -1
  100. package/dist/test/mocks/payment-clients/mock-grecaptcha.js.map +1 -1
  101. package/dist/test/mocks/payment-clients/mock-hostedfields-client.js.map +1 -1
  102. package/dist/test/mocks/payment-clients/mock-hostedfieldstateobject-generator.js.map +1 -1
  103. package/dist/test/mocks/payment-clients/mock-hostedfieldtokenizepayload.js.map +1 -1
  104. package/dist/test/mocks/payment-clients/mock-paypal-client.js.map +1 -1
  105. package/dist/test/mocks/payment-clients/mock-paypal-library.js.map +1 -1
  106. package/dist/test/mocks/payment-clients/mock-venmo-client.js.map +1 -1
  107. package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-datasource-delegate.js.map +1 -1
  108. package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-handler.js.map +1 -1
  109. package/dist/test/mocks/payment-providers/individual-providers/mock-creditcard-handler.js.map +1 -1
  110. package/dist/test/mocks/payment-providers/individual-providers/mock-googlepay-handler.js.map +1 -1
  111. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource-delegate.js.map +1 -1
  112. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource.js.map +1 -1
  113. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-handler.js.map +1 -1
  114. package/dist/test/mocks/payment-providers/individual-providers/mock-venmo-handler.js.map +1 -1
  115. package/dist/test/mocks/payment-providers/mock-payment-providers.js.map +1 -1
  116. package/dist/test/tests/braintree-manager.test.js.map +1 -1
  117. package/dist/test/tests/donation-form-controller.test.js +39 -39
  118. package/dist/test/tests/donation-form-controller.test.js.map +1 -1
  119. package/dist/test/tests/donation-form.test.js +4 -4
  120. package/dist/test/tests/donation-form.test.js.map +1 -1
  121. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js +16 -14
  122. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js.map +1 -1
  123. package/dist/test/tests/form-elements/donation-summary.test.js.map +1 -1
  124. package/dist/test/tests/form-elements/payment-selector.test.js.map +1 -1
  125. package/dist/test/tests/modals/error-modal-content.test.js +2 -2
  126. package/dist/test/tests/modals/error-modal-content.test.js.map +1 -1
  127. package/dist/test/tests/modals/upsell-modal-content.test.js +31 -31
  128. package/dist/test/tests/modals/upsell-modal-content.test.js.map +1 -1
  129. package/dist/test/tests/models/donation-payment-info.test.js.map +1 -1
  130. package/dist/test/tests/payment-clients.test.js.map +1 -1
  131. package/dist/test/tests/payment-providers/applepay-sessiondatasource.test.js.map +1 -1
  132. package/dist/test/tests/payment-providers/applepay-sessionmanager.test.js.map +1 -1
  133. package/dist/test/tests/payment-providers/applepay.test.js.map +1 -1
  134. package/dist/test/tests/payment-providers/creditcard.test.js.map +1 -1
  135. package/dist/test/tests/payment-providers/googlepay.test.js.map +1 -1
  136. package/dist/test/tests/payment-providers/payment-providers.test.js.map +1 -1
  137. package/dist/test/tests/payment-providers/paypal-button-datasource.test.js.map +1 -1
  138. package/dist/test/tests/payment-providers/paypal.test.js.map +1 -1
  139. package/dist/test/tests/payment-providers/venmo.test.js.map +1 -1
  140. package/dist/test/tests/recaptcha-manager.test.js.map +1 -1
  141. package/package.json +107 -107
  142. package/src/@types/analytics-handler/index.d.ts +8 -8
  143. package/src/@types/braintree-web/LICENSE +21 -21
  144. package/src/@types/braintree-web/index.d.ts +93 -93
  145. package/src/@types/braintree-web/modules/american-express.d.ts +50 -50
  146. package/src/@types/braintree-web/modules/apple-pay.d.ts +213 -213
  147. package/src/@types/braintree-web/modules/client.d.ts +103 -103
  148. package/src/@types/braintree-web/modules/core.d.ts +34 -34
  149. package/src/@types/braintree-web/modules/data-collector.d.ts +13 -13
  150. package/src/@types/braintree-web/modules/google-payment.d.ts +269 -269
  151. package/src/@types/braintree-web/modules/hosted-fields.d.ts +366 -366
  152. package/src/@types/braintree-web/modules/paypal-checkout.d.ts +262 -262
  153. package/src/@types/braintree-web/modules/paypal.d.ts +177 -177
  154. package/src/@types/braintree-web/modules/three-d-secure.d.ts +141 -141
  155. package/src/@types/braintree-web/modules/unionpay.d.ts +224 -224
  156. package/src/@types/braintree-web/modules/us-bank-account.d.ts +81 -81
  157. package/src/@types/braintree-web/modules/venmo.d.ts +110 -110
  158. package/src/@types/braintree-web/package.json +64 -64
  159. package/src/@types/paypal-checkout-components/LICENSE +21 -21
  160. package/src/@types/paypal-checkout-components/index.d.ts +67 -67
  161. package/src/@types/paypal-checkout-components/modules/button.d.ts +50 -50
  162. package/src/@types/paypal-checkout-components/modules/callback-data.d.ts +244 -244
  163. package/src/@types/paypal-checkout-components/modules/configuration.d.ts +114 -114
  164. package/src/@types/paypal-checkout-components/package.json +58 -58
  165. package/src/braintree-manager/braintree-interfaces.ts +172 -172
  166. package/src/braintree-manager/braintree-manager.ts +281 -281
  167. package/src/braintree-manager/payment-clients.ts +146 -146
  168. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.ts +13 -13
  169. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.ts +8 -8
  170. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.ts +10 -10
  171. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.ts +119 -119
  172. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.ts +21 -21
  173. package/src/braintree-manager/payment-providers/apple-pay/apple-pay.ts +97 -97
  174. package/src/braintree-manager/payment-providers/credit-card/credit-card-interface.ts +21 -21
  175. package/src/braintree-manager/payment-providers/credit-card/credit-card.ts +130 -130
  176. package/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.ts +19 -19
  177. package/src/braintree-manager/payment-providers/credit-card/hosted-field-container.ts +85 -85
  178. package/src/braintree-manager/payment-providers/google-pay-interface.ts +8 -8
  179. package/src/braintree-manager/payment-providers/google-pay.ts +59 -59
  180. package/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.ts +218 -218
  181. package/src/braintree-manager/payment-providers/paypal/paypal-interface.ts +13 -13
  182. package/src/braintree-manager/payment-providers/paypal/paypal.ts +78 -78
  183. package/src/braintree-manager/payment-providers/venmo-interface.ts +8 -8
  184. package/src/braintree-manager/payment-providers/venmo.ts +67 -67
  185. package/src/braintree-manager/payment-providers-interface.ts +25 -25
  186. package/src/braintree-manager/payment-providers.ts +147 -147
  187. package/src/donation-form-controller.ts +623 -623
  188. package/src/donation-form-error.ts +6 -6
  189. package/src/donation-form.ts +576 -576
  190. package/src/form-elements/badged-input.ts +109 -109
  191. package/src/form-elements/contact-form/autocomplete-field-options.ts +63 -63
  192. package/src/form-elements/contact-form/contact-form.ts +436 -434
  193. package/src/form-elements/contact-form/countries.ts +252 -252
  194. package/src/form-elements/header/donation-form-header.ts +98 -98
  195. package/src/form-elements/header/donation-summary.ts +61 -61
  196. package/src/form-elements/payment-selector.ts +365 -365
  197. package/src/form-elements/total-amount.ts +46 -46
  198. package/src/modals/confirm-donation-modal-content.ts +168 -168
  199. package/src/modals/error-modal-content.ts +48 -48
  200. package/src/modals/upsell-modal-content.ts +284 -284
  201. package/src/payment-flow-handlers/donation-flow-modal-manager.ts +439 -439
  202. package/src/payment-flow-handlers/handlers/applepay-flow-handler.ts +109 -109
  203. package/src/payment-flow-handlers/handlers/creditcard-flow-handler.ts +232 -232
  204. package/src/payment-flow-handlers/handlers/googlepay-flow-handler.ts +113 -111
  205. package/src/payment-flow-handlers/handlers/paypal-flow-handler.ts +333 -331
  206. package/src/payment-flow-handlers/handlers/venmo-flow-handler.ts +119 -119
  207. package/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.ts +127 -127
  208. package/src/payment-flow-handlers/payment-flow-handlers.ts +218 -218
  209. package/src/recaptcha-manager/recaptcha-manager.ts +123 -123
  210. package/src/util/promisedSleep.ts +3 -3
@@ -20,8 +20,8 @@ describe('Donation Flow Modal Manager', () => {
20
20
  sinon.restore();
21
21
  });
22
22
  it('can close the modal', () => __awaiter(void 0, void 0, void 0, function* () {
23
- const mockModalManager = (yield fixture(html `
24
- <mock-modal-manager></mock-modal-manager>
23
+ const mockModalManager = (yield fixture(html `
24
+ <mock-modal-manager></mock-modal-manager>
25
25
  `));
26
26
  const mockBraintreeManager = new MockBraintreeManager();
27
27
  const manager = new DonationFlowModalManager({
@@ -51,8 +51,8 @@ describe('Donation Flow Modal Manager', () => {
51
51
  }));
52
52
  it('can show the processing modal', () => __awaiter(void 0, void 0, void 0, function* () {
53
53
  var _a;
54
- const mockModalManager = (yield fixture(html `
55
- <mock-modal-manager></mock-modal-manager>
54
+ const mockModalManager = (yield fixture(html `
55
+ <mock-modal-manager></mock-modal-manager>
56
56
  `));
57
57
  const mockBraintreeManager = new MockBraintreeManager();
58
58
  const manager = new DonationFlowModalManager({
@@ -71,8 +71,8 @@ describe('Donation Flow Modal Manager', () => {
71
71
  }));
72
72
  it('can show the error modal', () => __awaiter(void 0, void 0, void 0, function* () {
73
73
  var _a, _b;
74
- const mockModalManager = (yield fixture(html `
75
- <mock-modal-manager></mock-modal-manager>
74
+ const mockModalManager = (yield fixture(html `
75
+ <mock-modal-manager></mock-modal-manager>
76
76
  `));
77
77
  const mockBraintreeManager = new MockBraintreeManager();
78
78
  const manager = new DonationFlowModalManager({
@@ -91,8 +91,8 @@ describe('Donation Flow Modal Manager', () => {
91
91
  }));
92
92
  it('shows the thank you modal and calls `donationSuccessful` to take user to thank you page', () => __awaiter(void 0, void 0, void 0, function* () {
93
93
  var _a, _b;
94
- const mockModalManager = (yield fixture(html `
95
- <mock-modal-manager></mock-modal-manager>
94
+ const mockModalManager = (yield fixture(html `
95
+ <mock-modal-manager></mock-modal-manager>
96
96
  `));
97
97
  const mockBraintreeManager = new MockBraintreeManager();
98
98
  const logEvent = sinon.fake();
@@ -119,8 +119,8 @@ describe('Donation Flow Modal Manager', () => {
119
119
  expect(response).to.deep.equal(mockSuccessResponse);
120
120
  }));
121
121
  it('donation submitted analytics gets sent when drawing thank you modal', () => __awaiter(void 0, void 0, void 0, function* () {
122
- const mockModalManager = (yield fixture(html `
123
- <mock-modal-manager></mock-modal-manager>
122
+ const mockModalManager = (yield fixture(html `
123
+ <mock-modal-manager></mock-modal-manager>
124
124
  `));
125
125
  const mockBraintreeManager = new MockBraintreeManager();
126
126
  const logEvent = sinon.fake();
@@ -145,8 +145,8 @@ describe('Donation Flow Modal Manager', () => {
145
145
  }));
146
146
  it('can show the confirmation modal', () => __awaiter(void 0, void 0, void 0, function* () {
147
147
  var _a, _b;
148
- const mockModalManager = (yield fixture(html `
149
- <mock-modal-manager></mock-modal-manager>
148
+ const mockModalManager = (yield fixture(html `
149
+ <mock-modal-manager></mock-modal-manager>
150
150
  `));
151
151
  const mockBraintreeManager = new MockBraintreeManager();
152
152
  const manager = new DonationFlowModalManager({
@@ -168,8 +168,8 @@ describe('Donation Flow Modal Manager', () => {
168
168
  expect((_b = (_a = modalOptions === null || modalOptions === void 0 ? void 0 : modalOptions.config) === null || _a === void 0 ? void 0 : _a.title) === null || _b === void 0 ? void 0 : _b.values).to.contain('Confirm monthly donation');
169
169
  }));
170
170
  it('can start the donation submission flow', () => __awaiter(void 0, void 0, void 0, function* () {
171
- const mockModalManager = (yield fixture(html `
172
- <mock-modal-manager></mock-modal-manager>
171
+ const mockModalManager = (yield fixture(html `
172
+ <mock-modal-manager></mock-modal-manager>
173
173
  `));
174
174
  const mockBraintreeManager = new MockBraintreeManager();
175
175
  const manager = new DonationFlowModalManager({
@@ -193,6 +193,8 @@ describe('Donation Flow Modal Manager', () => {
193
193
  value: {
194
194
  amount: 5,
195
195
  billing: {
196
+ firstName: 'Fooey',
197
+ lastName: 'McBarrison',
196
198
  countryCodeAlpha2: 'US',
197
199
  extendedAddress: 'Apt 123',
198
200
  locality: 'San Francisco',
@@ -1 +1 @@
1
- {"version":3,"file":"donation-flow-modal-manager.test.js","sourceRoot":"","sources":["../../../../test/tests/flow-handlers/donation-flow-modal-manager.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAE1G,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,GACb,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,IAAI,SAAiD,CAAC;AAEtD,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,UAAU,CAAC,GAAG,EAAE;QACd,SAAS,GAAG;Y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AAO,CAAC,2BAA2B,CAAC;YACvD,KAAK,EAAE,KAAK;YACZ,eAAe,EAAE,eAAe,CAAC,UAAU;YAC3C,YAAY,EAAE,IAAI,mBAAmB,CAAC;gBACpC,YAAY,EAAE,YAAY,CAAC,OAAO;gBAClC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,KAAK;aACjB,CAAC;YACF,WAAW,EAAE,eAAe;YAC5B,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAC3B,OAAO,EAAE,IAAI;YACb,KAAK,EAAE;gBACL,MAAM,EAAE,CAAC;gBACT,OAAO,EAAE;oBACP,iBAAiB,EAAE,IAAI;oBACvB,eAAe,EAAE,SAAS;oBAC1B,QAAQ,EAAE,eAAe;oBACzB,UAAU,EAAE,OAAO;oBACnB,MAAM,EAAE,IAAI;oBACZ,aAAa,EAAE,aAAa;iBAC7B;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,aAAa;oBACpB,SAAS,EAAE,OAAO;oBAClB,QAAQ,EAAE,YAAY;iBACvB;gBACD,WAAW,EAAE,KAAK;gBAClB,YAAY,EAAE,UAAU;gBACxB,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,aAAa;gBAC9B,cAAc,EAAE,KAAK;aACtB;SACF,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\r\nimport { DonationFlowModalManager } from '../../../src/payment-flow-handlers/donation-flow-modal-manager';\r\nimport { MockModalManager } from '../../mocks/mock-modal-manager';\r\nimport '../../mocks/mock-modal-manager';\r\nimport { MockBraintreeManager } from '../../mocks/mock-braintree-manager';\r\nimport { mockSuccessResponse } from '../../mocks/models/mock-success-response';\r\nimport {\r\n PaymentProvider,\r\n DonationPaymentInfo,\r\n DonationType,\r\n} from '@internetarchive/donation-form-data-models';\r\nimport { mockBillingInfo } from '../../mocks/models/mock-billing-info';\r\nimport { mockCustomerInfo } from '../../mocks/models/mock-customer-info';\r\nimport { DonationControllerEventLoggerInterface } from '../../../src/@types/analytics-handler';\r\nimport sinon from 'sinon';\r\n\r\nlet analytics: DonationControllerEventLoggerInterface;\r\n\r\ndescribe('Donation Flow Modal Manager', () => {\r\n beforeEach(() => {\r\n analytics = {\r\n logEvent: sinon.fake(),\r\n logDonationFlowEvent: sinon.fake(),\r\n };\r\n });\r\n afterEach(() => {\r\n sinon.restore();\r\n });\r\n it('can close the modal', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics,\r\n });\r\n manager.closeModal();\r\n expect(mockModalManager.closeCalled).to.be.true;\r\n });\r\n\r\n it('can calculate the proper default upsell amount', async () => {\r\n const defaultAmount = 8;\r\n let amount = DonationFlowModalManager.getDefaultUpsellAmount(1);\r\n expect(amount).to.equal(defaultAmount);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(10);\r\n expect(amount).to.equal(defaultAmount);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(10.01);\r\n expect(amount).to.equal(10);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(25);\r\n expect(amount).to.equal(10);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(25.01);\r\n expect(amount).to.equal(25);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(100);\r\n expect(amount).to.equal(25);\r\n amount = DonationFlowModalManager.getDefaultUpsellAmount(100.01);\r\n expect(amount).to.equal(50);\r\n });\r\n\r\n it('can show the processing modal', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics,\r\n });\r\n manager.showProcessingModal();\r\n const modalOptions = mockModalManager.showModalOptions;\r\n expect(modalOptions?.config.headerColor).to.equal('#497fbf');\r\n expect(modalOptions?.config.showProcessingIndicator).to.be.true;\r\n expect(modalOptions?.config.processingImageMode).to.equal('processing');\r\n expect(modalOptions?.config.closeOnBackdropClick).to.be.false;\r\n expect(modalOptions?.config.showCloseButton).to.be.false;\r\n expect(modalOptions?.config.title?.strings[0]).to.contain('Processing...');\r\n });\r\n\r\n it('can show the error modal', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics,\r\n });\r\n manager.showErrorModal({ message: 'foo-error' });\r\n const modalOptions = mockModalManager.showModalOptions;\r\n expect(modalOptions?.config.headerColor).to.equal('#691916');\r\n expect(modalOptions?.config.showProcessingIndicator).to.be.false;\r\n expect(modalOptions?.config.closeOnBackdropClick).to.be.true;\r\n expect(modalOptions?.config.showCloseButton).to.be.true;\r\n expect(modalOptions?.config.headline?.strings[0]).to.contain(\r\n \"There's been a problem completing your donation.\",\r\n );\r\n expect(modalOptions?.config.message?.values[0]).to.equal('foo-error');\r\n });\r\n\r\n it('shows the thank you modal and calls `donationSuccessful` to take user to thank you page', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const logEvent = sinon.fake();\r\n const logDonationFlowEvent = sinon.fake();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics: {\r\n logEvent,\r\n logDonationFlowEvent,\r\n },\r\n });\r\n manager.showThankYouModal({\r\n successResponse: mockSuccessResponse,\r\n });\r\n const modalOptions = mockModalManager.showModalOptions;\r\n expect(modalOptions?.config.headerColor).to.equal('#55A183');\r\n expect(modalOptions?.config.processingImageMode).to.equal('complete');\r\n expect(modalOptions?.config.showProcessingIndicator).to.be.true;\r\n expect(modalOptions?.config.closeOnBackdropClick).to.be.true;\r\n expect(modalOptions?.config.showCloseButton).to.be.true;\r\n expect(modalOptions?.config.title?.strings[0]).to.contain('Thank You!');\r\n const response = mockBraintreeManager.donationSuccessfulOptions?.successResponse;\r\n expect(response).to.deep.equal(mockSuccessResponse);\r\n });\r\n\r\n it('donation submitted analytics gets sent when drawing thank you modal', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const logEvent = sinon.fake();\r\n const logDonationFlowEvent = sinon.fake();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics: {\r\n logEvent,\r\n logDonationFlowEvent,\r\n },\r\n });\r\n const successResponse = mockSuccessResponse;\r\n successResponse.paymentProvider = PaymentProvider.GooglePay;\r\n manager.showThankYouModal({\r\n successResponse: mockSuccessResponse,\r\n });\r\n\r\n // fires analytics\r\n expect(logDonationFlowEvent.callCount).to.equal(1);\r\n expect(logDonationFlowEvent.args[0][0]).to.equal(`Donated-GooglePay`);\r\n expect(logDonationFlowEvent.args[0][1]).to.equal(DonationType.OneTime);\r\n });\r\n\r\n it('can show the confirmation modal', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics,\r\n });\r\n manager.showConfirmationStepModal({\r\n donationType: DonationType.Upsell,\r\n amount: 8,\r\n currencyType: 'USD',\r\n cancelDonationCB: () => console.log('donation cancelled'),\r\n confirmDonationCB: () => console.log('donation confirmed'),\r\n });\r\n\r\n const modalOptions = mockModalManager.showModalOptions;\r\n expect(modalOptions?.config.headerColor).to.equal('#55A183');\r\n expect(modalOptions?.config.closeOnBackdropClick).to.be.false;\r\n expect(modalOptions?.config.showCloseButton).to.be.true;\r\n expect(modalOptions?.config?.title?.values).to.contain('Confirm monthly donation');\r\n });\r\n\r\n it('can start the donation submission flow', async () => {\r\n const mockModalManager = (await fixture(html`\r\n <mock-modal-manager></mock-modal-manager>\r\n `)) as MockModalManager;\r\n const mockBraintreeManager = new MockBraintreeManager();\r\n const manager = new DonationFlowModalManager({\r\n braintreeManager: mockBraintreeManager,\r\n modalManager: mockModalManager,\r\n analytics,\r\n });\r\n const result = await manager.startDonationSubmissionFlow({\r\n nonce: 'foo',\r\n paymentProvider: PaymentProvider.CreditCard,\r\n donationInfo: new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: 5,\r\n coverFees: false,\r\n }),\r\n billingInfo: mockBillingInfo,\r\n customerInfo: mockCustomerInfo,\r\n });\r\n\r\n expect(result).to.deep.equal({\r\n success: true,\r\n value: {\r\n amount: 5,\r\n billing: {\r\n countryCodeAlpha2: 'US',\r\n extendedAddress: 'Apt 123',\r\n locality: 'San Francisco',\r\n postalCode: '12345',\r\n region: 'CA',\r\n streetAddress: '123 Fake St',\r\n },\r\n customer: {\r\n email: 'foo@bar.com',\r\n firstName: 'Fooey',\r\n lastName: 'McBarrison',\r\n },\r\n customer_id: 'bar',\r\n donationType: 'one-time',\r\n paymentMethodNonce: 'foo',\r\n paymentProvider: 'Credit Card',\r\n transaction_id: 'foo',\r\n },\r\n });\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"donation-flow-modal-manager.test.js","sourceRoot":"","sources":["../../../../test/tests/flow-handlers/donation-flow-modal-manager.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,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ACD,QAAQ,EAAE;oBACR,KAAK,EAAE,aAAa;oBACpB,SAAS,EAAE,OAAO;oBAClB,QAAQ,EAAE,YAAY;iBACvB;gBACD,WAAW,EAAE,KAAK;gBAClB,YAAY,EAAE,UAAU;gBACxB,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,aAAa;gBAC9B,cAAc,EAAE,KAAK;aACtB;SACF,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport { DonationFlowModalManager } from '../../../src/payment-flow-handlers/donation-flow-modal-manager';\nimport { MockModalManager } from '../../mocks/mock-modal-manager';\nimport '../../mocks/mock-modal-manager';\nimport { MockBraintreeManager } from '../../mocks/mock-braintree-manager';\nimport { mockSuccessResponse } from '../../mocks/models/mock-success-response';\nimport {\n PaymentProvider,\n DonationPaymentInfo,\n DonationType,\n} from '@internetarchive/donation-form-data-models';\nimport { mockBillingInfo } from '../../mocks/models/mock-billing-info';\nimport { mockCustomerInfo } from '../../mocks/models/mock-customer-info';\nimport { DonationControllerEventLoggerInterface } from '../../../src/@types/analytics-handler';\nimport sinon from 'sinon';\n\nlet analytics: DonationControllerEventLoggerInterface;\n\ndescribe('Donation Flow Modal Manager', () => {\n beforeEach(() => {\n analytics = {\n logEvent: sinon.fake(),\n logDonationFlowEvent: sinon.fake(),\n };\n });\n afterEach(() => {\n sinon.restore();\n });\n it('can close the modal', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics,\n });\n manager.closeModal();\n expect(mockModalManager.closeCalled).to.be.true;\n });\n\n it('can calculate the proper default upsell amount', async () => {\n const defaultAmount = 8;\n let amount = DonationFlowModalManager.getDefaultUpsellAmount(1);\n expect(amount).to.equal(defaultAmount);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(10);\n expect(amount).to.equal(defaultAmount);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(10.01);\n expect(amount).to.equal(10);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(25);\n expect(amount).to.equal(10);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(25.01);\n expect(amount).to.equal(25);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(100);\n expect(amount).to.equal(25);\n amount = DonationFlowModalManager.getDefaultUpsellAmount(100.01);\n expect(amount).to.equal(50);\n });\n\n it('can show the processing modal', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics,\n });\n manager.showProcessingModal();\n const modalOptions = mockModalManager.showModalOptions;\n expect(modalOptions?.config.headerColor).to.equal('#497fbf');\n expect(modalOptions?.config.showProcessingIndicator).to.be.true;\n expect(modalOptions?.config.processingImageMode).to.equal('processing');\n expect(modalOptions?.config.closeOnBackdropClick).to.be.false;\n expect(modalOptions?.config.showCloseButton).to.be.false;\n expect(modalOptions?.config.title?.strings[0]).to.contain('Processing...');\n });\n\n it('can show the error modal', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics,\n });\n manager.showErrorModal({ message: 'foo-error' });\n const modalOptions = mockModalManager.showModalOptions;\n expect(modalOptions?.config.headerColor).to.equal('#691916');\n expect(modalOptions?.config.showProcessingIndicator).to.be.false;\n expect(modalOptions?.config.closeOnBackdropClick).to.be.true;\n expect(modalOptions?.config.showCloseButton).to.be.true;\n expect(modalOptions?.config.headline?.strings[0]).to.contain(\n \"There's been a problem completing your donation.\",\n );\n expect(modalOptions?.config.message?.values[0]).to.equal('foo-error');\n });\n\n it('shows the thank you modal and calls `donationSuccessful` to take user to thank you page', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const logEvent = sinon.fake();\n const logDonationFlowEvent = sinon.fake();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics: {\n logEvent,\n logDonationFlowEvent,\n },\n });\n manager.showThankYouModal({\n successResponse: mockSuccessResponse,\n });\n const modalOptions = mockModalManager.showModalOptions;\n expect(modalOptions?.config.headerColor).to.equal('#55A183');\n expect(modalOptions?.config.processingImageMode).to.equal('complete');\n expect(modalOptions?.config.showProcessingIndicator).to.be.true;\n expect(modalOptions?.config.closeOnBackdropClick).to.be.true;\n expect(modalOptions?.config.showCloseButton).to.be.true;\n expect(modalOptions?.config.title?.strings[0]).to.contain('Thank You!');\n const response = mockBraintreeManager.donationSuccessfulOptions?.successResponse;\n expect(response).to.deep.equal(mockSuccessResponse);\n });\n\n it('donation submitted analytics gets sent when drawing thank you modal', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const logEvent = sinon.fake();\n const logDonationFlowEvent = sinon.fake();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics: {\n logEvent,\n logDonationFlowEvent,\n },\n });\n const successResponse = mockSuccessResponse;\n successResponse.paymentProvider = PaymentProvider.GooglePay;\n manager.showThankYouModal({\n successResponse: mockSuccessResponse,\n });\n\n // fires analytics\n expect(logDonationFlowEvent.callCount).to.equal(1);\n expect(logDonationFlowEvent.args[0][0]).to.equal(`Donated-GooglePay`);\n expect(logDonationFlowEvent.args[0][1]).to.equal(DonationType.OneTime);\n });\n\n it('can show the confirmation modal', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics,\n });\n manager.showConfirmationStepModal({\n donationType: DonationType.Upsell,\n amount: 8,\n currencyType: 'USD',\n cancelDonationCB: () => console.log('donation cancelled'),\n confirmDonationCB: () => console.log('donation confirmed'),\n });\n\n const modalOptions = mockModalManager.showModalOptions;\n expect(modalOptions?.config.headerColor).to.equal('#55A183');\n expect(modalOptions?.config.closeOnBackdropClick).to.be.false;\n expect(modalOptions?.config.showCloseButton).to.be.true;\n expect(modalOptions?.config?.title?.values).to.contain('Confirm monthly donation');\n });\n\n it('can start the donation submission flow', async () => {\n const mockModalManager = (await fixture(html`\n <mock-modal-manager></mock-modal-manager>\n `)) as MockModalManager;\n const mockBraintreeManager = new MockBraintreeManager();\n const manager = new DonationFlowModalManager({\n braintreeManager: mockBraintreeManager,\n modalManager: mockModalManager,\n analytics,\n });\n const result = await manager.startDonationSubmissionFlow({\n nonce: 'foo',\n paymentProvider: PaymentProvider.CreditCard,\n donationInfo: new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 5,\n coverFees: false,\n }),\n billingInfo: mockBillingInfo,\n customerInfo: mockCustomerInfo,\n });\n\n expect(result).to.deep.equal({\n success: true,\n value: {\n amount: 5,\n billing: {\n firstName: 'Fooey',\n lastName: 'McBarrison',\n countryCodeAlpha2: 'US',\n extendedAddress: 'Apt 123',\n locality: 'San Francisco',\n postalCode: '12345',\n region: 'CA',\n streetAddress: '123 Fake St',\n },\n customer: {\n email: 'foo@bar.com',\n firstName: 'Fooey',\n lastName: 'McBarrison',\n },\n customer_id: 'bar',\n donationType: 'one-time',\n paymentMethodNonce: 'foo',\n paymentProvider: 'Credit Card',\n transaction_id: 'foo',\n },\n });\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"donation-summary.test.js","sourceRoot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CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,YAAY,GAAG,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAExD,MAAM,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACrE,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, elementUpdated } from '@open-wc/testing';\r\nimport { DonationSummary } from '../../../src/form-elements/header/donation-summary';\r\nimport '../../../src/form-elements/header/donation-summary';\r\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\r\n\r\ndescribe('DonationSummary', () => {\r\n it('shows the proper title for one-time donations', async () => {\r\n const el = (await fixture(html` <donation-summary></donation-summary>> `)) as DonationSummary;\r\n\r\n const donationInfo = new DonationPaymentInfo({\r\n amount: 3.5,\r\n donationType: DonationType.OneTime,\r\n coverFees: false,\r\n });\r\n\r\n el.donationInfo = donationInfo;\r\n\r\n await elementUpdated(el);\r\n\r\n const titleElement = el.shadowRoot?.querySelector('h1');\r\n\r\n expect(titleElement?.innerText).to.equal('$3.50 Donation');\r\n });\r\n\r\n it('shows the proper title for monthly donations', async () => {\r\n const el = (await fixture(html` <donation-summary></donation-summary>> `)) as DonationSummary;\r\n\r\n const donationInfo = new DonationPaymentInfo({\r\n amount: 7.5,\r\n donationType: DonationType.Monthly,\r\n coverFees: false,\r\n });\r\n\r\n el.donationInfo = donationInfo;\r\n\r\n await elementUpdated(el);\r\n\r\n const titleElement = el.shadowRoot?.querySelector('h1');\r\n\r\n expect(titleElement?.innerText).to.equal('$7.50 Monthly Donation');\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"donation-summary.test.js","sourceRoot":"","sources":["../../../../test/tests/form-elements/donation-summary.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MA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,CAAC,CAAC;QAExD,MAAM,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACrE,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, elementUpdated } from '@open-wc/testing';\nimport { DonationSummary } from '../../../src/form-elements/header/donation-summary';\nimport '../../../src/form-elements/header/donation-summary';\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\n\ndescribe('DonationSummary', () => {\n it('shows the proper title for one-time donations', async () => {\n const el = (await fixture(html` <donation-summary></donation-summary>> `)) as DonationSummary;\n\n const donationInfo = new DonationPaymentInfo({\n amount: 3.5,\n donationType: DonationType.OneTime,\n coverFees: false,\n });\n\n el.donationInfo = donationInfo;\n\n await elementUpdated(el);\n\n const titleElement = el.shadowRoot?.querySelector('h1');\n\n expect(titleElement?.innerText).to.equal('$3.50 Donation');\n });\n\n it('shows the proper title for monthly donations', async () => {\n const el = (await fixture(html` <donation-summary></donation-summary>> `)) as DonationSummary;\n\n const donationInfo = new DonationPaymentInfo({\n amount: 7.5,\n donationType: DonationType.Monthly,\n coverFees: false,\n });\n\n el.donationInfo = donationInfo;\n\n await elementUpdated(el);\n\n const titleElement = el.shadowRoot?.querySelector('h1');\n\n expect(titleElement?.innerText).to.equal('$7.50 Monthly Donation');\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"payment-selector.test.js","sourceRoot":"","sources":["../../../../test/tests/form-elements/payment-selector.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAA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CAAC,CAAoB,CAAC;QAC7F,MAAM,aAAa,GAAG,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,4BAA4B,CAAC,CAAC;QACjF,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3C,UAAU,CAAC,GAAG,EAAE;YACd,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,mBAAmB,CAAC,CAAC;QACzD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;IAC5B,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, elementUpdated, oneEvent } from '@open-wc/testing';\r\nimport { PaymentSelector } from '../../../src/form-elements/payment-selector';\r\nimport '../../../src/form-elements/payment-selector';\r\nimport { MockPaymentProviders } from '../../mocks/payment-providers/mock-payment-providers';\r\nimport { promisedSleep } from '../../../src/util/promisedSleep';\r\n\r\ndescribe('Payment Selector', () => {\r\n it('shows Venmo if it is available', async () => {\r\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\r\n\r\n const paymentProviders = new MockPaymentProviders();\r\n el.paymentProviders = paymentProviders;\r\n await elementUpdated(el);\r\n await promisedSleep(250);\r\n\r\n const venmoButton = el.shadowRoot?.querySelector('.venmo.provider-button');\r\n expect(venmoButton?.classList.contains('available')).to.be.true;\r\n });\r\n\r\n it('can show PayPal when called', async () => {\r\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\r\n el.showPaypalButton();\r\n await elementUpdated(el);\r\n const paypalButton = el.shadowRoot?.querySelector('.paypal-container.provider-button');\r\n expect(paypalButton?.classList.contains('available')).to.be.true;\r\n });\r\n\r\n it('emits paypalBlockerSelected event when paypal is selected in an error state', async () => {\r\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\r\n const paypalBlocker = el.shadowRoot?.querySelector('.paypal-local-button');\r\n const clickEvent = new MouseEvent('click');\r\n setTimeout(() => {\r\n paypalBlocker?.dispatchEvent(clickEvent);\r\n });\r\n const response = await oneEvent(el, 'paypalBlockerSelected');\r\n expect(response).to.exist;\r\n });\r\n\r\n it('emits applePaySelected event with original click event when ApplePay is selected', async () => {\r\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\r\n const paypalBlocker = el.shadowRoot?.querySelector('.applepay.provider-button');\r\n const clickEvent = new MouseEvent('click');\r\n setTimeout(() => {\r\n paypalBlocker?.dispatchEvent(clickEvent);\r\n });\r\n const response = await oneEvent(el, 'applePaySelected');\r\n const event = response.detail.originalEvent;\r\n expect(event).to.equal(clickEvent);\r\n });\r\n\r\n it('emits googlePaySelected when GooglePay is selected', async () => {\r\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\r\n const paypalBlocker = el.shadowRoot?.querySelector('.googlepay.provider-button');\r\n const clickEvent = new MouseEvent('click');\r\n setTimeout(() => {\r\n paypalBlocker?.dispatchEvent(clickEvent);\r\n });\r\n const response = await oneEvent(el, 'googlePaySelected');\r\n expect(response).to.exist;\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"payment-selector.test.js","sourceRoot":"","sources":["../../../../test/tests/form-elements/payment-selector.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,gCAAgC,EAAE,GAAS,EAAE;;QAC9C,MAAM,EAAE,GA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AM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3C,UAAU,CAAC,GAAG,EAAE;YACd,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,mBAAmB,CAAC,CAAC;QACzD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;IAC5B,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, elementUpdated, oneEvent } from '@open-wc/testing';\nimport { PaymentSelector } from '../../../src/form-elements/payment-selector';\nimport '../../../src/form-elements/payment-selector';\nimport { MockPaymentProviders } from '../../mocks/payment-providers/mock-payment-providers';\nimport { promisedSleep } from '../../../src/util/promisedSleep';\n\ndescribe('Payment Selector', () => {\n it('shows Venmo if it is available', async () => {\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\n\n const paymentProviders = new MockPaymentProviders();\n el.paymentProviders = paymentProviders;\n await elementUpdated(el);\n await promisedSleep(250);\n\n const venmoButton = el.shadowRoot?.querySelector('.venmo.provider-button');\n expect(venmoButton?.classList.contains('available')).to.be.true;\n });\n\n it('can show PayPal when called', async () => {\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\n el.showPaypalButton();\n await elementUpdated(el);\n const paypalButton = el.shadowRoot?.querySelector('.paypal-container.provider-button');\n expect(paypalButton?.classList.contains('available')).to.be.true;\n });\n\n it('emits paypalBlockerSelected event when paypal is selected in an error state', async () => {\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\n const paypalBlocker = el.shadowRoot?.querySelector('.paypal-local-button');\n const clickEvent = new MouseEvent('click');\n setTimeout(() => {\n paypalBlocker?.dispatchEvent(clickEvent);\n });\n const response = await oneEvent(el, 'paypalBlockerSelected');\n expect(response).to.exist;\n });\n\n it('emits applePaySelected event with original click event when ApplePay is selected', async () => {\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\n const paypalBlocker = el.shadowRoot?.querySelector('.applepay.provider-button');\n const clickEvent = new MouseEvent('click');\n setTimeout(() => {\n paypalBlocker?.dispatchEvent(clickEvent);\n });\n const response = await oneEvent(el, 'applePaySelected');\n const event = response.detail.originalEvent;\n expect(event).to.equal(clickEvent);\n });\n\n it('emits googlePaySelected when GooglePay is selected', async () => {\n const el = (await fixture(html` <payment-selector></payment-selector> `)) as PaymentSelector;\n const paypalBlocker = el.shadowRoot?.querySelector('.googlepay.provider-button');\n const clickEvent = new MouseEvent('click');\n setTimeout(() => {\n paypalBlocker?.dispatchEvent(clickEvent);\n });\n const response = await oneEvent(el, 'googlePaySelected');\n expect(response).to.exist;\n });\n});\n"]}
@@ -4,8 +4,8 @@ import '../../../src/modals/error-modal-content';
4
4
  describe('Error Modal Content', () => {
5
5
  it('renders a "Questions" link', () => __awaiter(void 0, void 0, void 0, function* () {
6
6
  var _a;
7
- const el = yield fixture(html `
8
- <donation-form-error-modal-content></donation-form-error-modal-content>
7
+ const el = yield fixture(html `
8
+ <donation-form-error-modal-content></donation-form-error-modal-content>
9
9
  `);
10
10
  const questionsLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.container a');
11
11
  expect(questionsLink).to.exist;
@@ -1 +1 @@
1
- {"version":3,"file":"error-modal-content.test.js","sourceRoot":"","sources":["../../../../test/tests/modals/error-modal-content.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,yCAAyC,CAAC;AAEjD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,4BAA4B,EAAE,GAAS,EAAE;;QAC1C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAA;;KAE5B,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,cAAc,CAAC,CAAC;QACnE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC/B,MAAM,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\r\nimport '../../../src/modals/error-modal-content';\r\n\r\ndescribe('Error Modal Content', () => {\r\n it('renders a \"Questions\" link', async () => {\r\n const el = await fixture(html`\r\n <donation-form-error-modal-content></donation-form-error-modal-content>\r\n `);\r\n\r\n const questionsLink = el.shadowRoot?.querySelector('.container a');\r\n expect(questionsLink).to.exist;\r\n expect(questionsLink?.innerHTML).to.contain('Questions?');\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"error-modal-content.test.js","sourceRoot":"","sources":["../../../../test/tests/modals/error-modal-content.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,yCAAyC,CAAC;AAEjD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,4BAA4B,EAAE,GAAS,EAAE;;QAC1C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAA;;KAE5B,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,cAAc,CAAC,CAAC;QACnE,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC/B,MAAM,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport '../../../src/modals/error-modal-content';\n\ndescribe('Error Modal Content', () => {\n it('renders a \"Questions\" link', async () => {\n const el = await fixture(html`\n <donation-form-error-modal-content></donation-form-error-modal-content>\n `);\n\n const questionsLink = el.shadowRoot?.querySelector('.container a');\n expect(questionsLink).to.exist;\n expect(questionsLink?.innerHTML).to.contain('Questions?');\n });\n});\n"]}
@@ -7,16 +7,16 @@ describe('Upsell Modal Content', () => {
7
7
  describe('UI Actions', () => {
8
8
  it('shows a no button', () => __awaiter(void 0, void 0, void 0, function* () {
9
9
  var _a;
10
- const el = (yield fixture(html `
11
- <upsell-modal-content></upsell-modal-content>
10
+ const el = (yield fixture(html `
11
+ <upsell-modal-content></upsell-modal-content>
12
12
  `));
13
13
  const noButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#no-button');
14
14
  expect(noButton).to.exist;
15
15
  }));
16
16
  it('shows the proper yes button for non-paypal types', () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  var _a, _b;
18
- const el = (yield fixture(html `
19
- <upsell-modal-content .yesButtonMode=${UpsellModalCTAMode.YesButton}></upsell-modal-content>
18
+ const el = (yield fixture(html `
19
+ <upsell-modal-content .yesButtonMode=${UpsellModalCTAMode.YesButton}></upsell-modal-content>
20
20
  `));
21
21
  const yesButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#yes-button');
22
22
  expect(yesButton).to.exist;
@@ -25,10 +25,10 @@ describe('Upsell Modal Content', () => {
25
25
  }));
26
26
  it('shows the paypal upsell slot for paypal upsells', () => __awaiter(void 0, void 0, void 0, function* () {
27
27
  var _a, _b;
28
- const el = (yield fixture(html `
29
- <upsell-modal-content
30
- .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}
31
- ></upsell-modal-content>
28
+ const el = (yield fixture(html `
29
+ <upsell-modal-content
30
+ .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}
31
+ ></upsell-modal-content>
32
32
  `));
33
33
  const payPalSlot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.paypal-upsell-slot-container');
34
34
  expect(payPalSlot).to.exist;
@@ -39,11 +39,11 @@ describe('Upsell Modal Content', () => {
39
39
  describe('Events Emitted', () => {
40
40
  it('emits a `yesSelected` event with the amount when yes is selected', () => __awaiter(void 0, void 0, void 0, function* () {
41
41
  var _a;
42
- const el = (yield fixture(html `
43
- <upsell-modal-content
44
- .amount=${7.5}
45
- .yesButtonMode=${UpsellModalCTAMode.YesButton}
46
- ></upsell-modal-content>
42
+ const el = (yield fixture(html `
43
+ <upsell-modal-content
44
+ .amount=${7.5}
45
+ .yesButtonMode=${UpsellModalCTAMode.YesButton}
46
+ ></upsell-modal-content>
47
47
  `));
48
48
  const yesButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#yes-button');
49
49
  const clickEvent = new MouseEvent('click');
@@ -56,8 +56,8 @@ describe('Upsell Modal Content', () => {
56
56
  }));
57
57
  it('emits a `noThanksSelected` event when no thanks is selected', () => __awaiter(void 0, void 0, void 0, function* () {
58
58
  var _a;
59
- const el = (yield fixture(html `
60
- <upsell-modal-content></upsell-modal-content>
59
+ const el = (yield fixture(html `
60
+ <upsell-modal-content></upsell-modal-content>
61
61
  `));
62
62
  const noButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#no-button');
63
63
  const clickEvent = new MouseEvent('click');
@@ -71,8 +71,8 @@ describe('Upsell Modal Content', () => {
71
71
  describe('Amount Changer', () => {
72
72
  it('emits an `amountChanged` event with the amount if change successful', () => __awaiter(void 0, void 0, void 0, function* () {
73
73
  var _a;
74
- const el = (yield fixture(html `
75
- <upsell-modal-content></upsell-modal-content>
74
+ const el = (yield fixture(html `
75
+ <upsell-modal-content></upsell-modal-content>
76
76
  `));
77
77
  const amountInput = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#amount-input');
78
78
  amountInput.value = '3.50';
@@ -86,8 +86,8 @@ describe('Upsell Modal Content', () => {
86
86
  }));
87
87
  it('nothing happens if the input is empty', () => __awaiter(void 0, void 0, void 0, function* () {
88
88
  var _a;
89
- const el = (yield fixture(html `
90
- <upsell-modal-content></upsell-modal-content>
89
+ const el = (yield fixture(html `
90
+ <upsell-modal-content></upsell-modal-content>
91
91
  `));
92
92
  const amountInput = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#amount-input');
93
93
  amountInput.value = '';
@@ -99,8 +99,8 @@ describe('Upsell Modal Content', () => {
99
99
  }));
100
100
  it('shows an error if the amount isNaN', () => __awaiter(void 0, void 0, void 0, function* () {
101
101
  var _a, _b;
102
- const el = (yield fixture(html `
103
- <upsell-modal-content></upsell-modal-content>
102
+ const el = (yield fixture(html `
103
+ <upsell-modal-content></upsell-modal-content>
104
104
  `));
105
105
  const amountInput = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#amount-input');
106
106
  amountInput.value = 'a';
@@ -114,8 +114,8 @@ describe('Upsell Modal Content', () => {
114
114
  }));
115
115
  it('shows an error if the amount is too low', () => __awaiter(void 0, void 0, void 0, function* () {
116
116
  var _a, _b;
117
- const el = (yield fixture(html `
118
- <upsell-modal-content></upsell-modal-content>
117
+ const el = (yield fixture(html `
118
+ <upsell-modal-content></upsell-modal-content>
119
119
  `));
120
120
  const amountInput = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#amount-input');
121
121
  amountInput.value = '0.99';
@@ -129,8 +129,8 @@ describe('Upsell Modal Content', () => {
129
129
  }));
130
130
  it('shows an error if the amount is too high', () => __awaiter(void 0, void 0, void 0, function* () {
131
131
  var _a, _b;
132
- const el = (yield fixture(html `
133
- <upsell-modal-content></upsell-modal-content>
132
+ const el = (yield fixture(html `
133
+ <upsell-modal-content></upsell-modal-content>
134
134
  `));
135
135
  const amountInput = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#amount-input');
136
136
  amountInput.value = '10000';
@@ -144,16 +144,16 @@ describe('Upsell Modal Content', () => {
144
144
  }));
145
145
  it('shows the paypal blocker if there is an error', () => __awaiter(void 0, void 0, void 0, function* () {
146
146
  var _a;
147
- const el = (yield fixture(html `
148
- <upsell-modal-content
149
- .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}
150
- ></upsell-modal-content>
147
+ const el = (yield fixture(html `
148
+ <upsell-modal-content
149
+ .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}
150
+ ></upsell-modal-content>
151
151
  `));
152
152
  const paypalBlocker = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.paypal-upsell-slot-blocker');
153
153
  expect(el.error).to.be.undefined;
154
154
  expect(paypalBlocker.classList.contains('hidden')).to.be.true;
155
- el.error = lit2html `
156
- Some error
155
+ el.error = lit2html `
156
+ Some error
157
157
  `;
158
158
  yield el.updateComplete;
159
159
  expect(el.error).to.not.be.undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"upsell-modal-content.test.js","sourceRoot":"","sources":["../../../../test/tests/modals/upsell-modal-content.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAsB,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEvC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,mBAAmB,EAAE,GAAS,EAAE;;YACjC,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAA;;OAE7B,CAAC,CAAu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AE,CAAC,cAAc,CAAC;YACxB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YACrC,MAAM,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC;QAClF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;;YAC7D,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAA;;2BAET,kBAAkB,CAAC,gBAAgB;;OAEvD,CAAC,CAAuB,CAAC;YAE1B,MAAM,aAAa,GAAG,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAChD,6BAA6B,CACZ,CAAC;YACpB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;YACjC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAC9D,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAA;;OAElB,CAAC;YACF,MAAM,EAAE,CAAC,cAAc,CAAC;YACxB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YACrC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACjE,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, oneEvent } from '@open-wc/testing';\r\nimport { UpsellModalContent, UpsellModalCTAMode } from '../../../src/modals/upsell-modal-content';\r\nimport '../../../src/modals/upsell-modal-content';\r\nimport { html as lit2html } from 'lit';\r\n\r\ndescribe('Upsell Modal Content', () => {\r\n describe('UI Actions', () => {\r\n it('shows a no button', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const noButton = el.shadowRoot?.querySelector('#no-button');\r\n expect(noButton).to.exist;\r\n });\r\n\r\n it('shows the proper yes button for non-paypal types', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content .yesButtonMode=${UpsellModalCTAMode.YesButton}></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\r\n expect(yesButton).to.exist;\r\n const payPalSlot = el.shadowRoot?.querySelector('.paypal-upsell-slot-container');\r\n expect(payPalSlot).to.not.exist;\r\n });\r\n\r\n it('shows the paypal upsell slot for paypal upsells', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content\r\n .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}\r\n ></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const payPalSlot = el.shadowRoot?.querySelector('.paypal-upsell-slot-container');\r\n expect(payPalSlot).to.exist;\r\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\r\n expect(yesButton).to.not.exist;\r\n });\r\n });\r\n\r\n describe('Events Emitted', () => {\r\n it('emits a `yesSelected` event with the amount when yes is selected', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content\r\n .amount=${7.5}\r\n .yesButtonMode=${UpsellModalCTAMode.YesButton}\r\n ></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\r\n const clickEvent = new MouseEvent('click');\r\n setTimeout(() => {\r\n yesButton?.dispatchEvent(clickEvent);\r\n });\r\n const response = await oneEvent(el, 'yesSelected');\r\n expect(response).to.exist;\r\n expect(response.detail.amount).to.equal(7.5);\r\n });\r\n\r\n it('emits a `noThanksSelected` event when no thanks is selected', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const noButton = el.shadowRoot?.querySelector('#no-button');\r\n const clickEvent = new MouseEvent('click');\r\n setTimeout(() => {\r\n noButton?.dispatchEvent(clickEvent);\r\n });\r\n const response = await oneEvent(el, 'noThanksSelected');\r\n expect(response).to.exist;\r\n });\r\n });\r\n\r\n describe('Amount Changer', () => {\r\n it('emits an `amountChanged` event with the amount if change successful', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\r\n amountInput.value = '3.50';\r\n const inputEvent = new Event('input');\r\n setTimeout(() => {\r\n amountInput.dispatchEvent(inputEvent);\r\n });\r\n const response = await oneEvent(el, 'amountChanged');\r\n expect(response).to.exist;\r\n expect(response.detail.amount).to.equal(3.5);\r\n });\r\n\r\n it('nothing happens if the input is empty', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\r\n amountInput.value = '';\r\n const inputEvent = new Event('input');\r\n expect(el.error).to.be.undefined;\r\n amountInput.dispatchEvent(inputEvent);\r\n await el.updateComplete;\r\n expect(el.error).to.be.undefined;\r\n });\r\n\r\n it('shows an error if the amount isNaN', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\r\n amountInput.value = 'a';\r\n const inputEvent = new Event('input');\r\n const errorDiv = el.shadowRoot?.querySelector('.error');\r\n expect(el.error).to.be.undefined;\r\n amountInput.dispatchEvent(inputEvent);\r\n await el.updateComplete;\r\n expect(el.error).to.not.be.undefined;\r\n expect(errorDiv?.innerHTML).to.contain('Please enter a valid amount.');\r\n });\r\n\r\n it('shows an error if the amount is too low', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\r\n amountInput.value = '0.99';\r\n const inputEvent = new Event('input');\r\n const errorDiv = el.shadowRoot?.querySelector('.error');\r\n expect(el.error).to.be.undefined;\r\n amountInput.dispatchEvent(inputEvent);\r\n await el.updateComplete;\r\n expect(el.error).to.not.be.undefined;\r\n expect(errorDiv?.innerHTML).to.contain('The minimum donation amount is $1');\r\n });\r\n\r\n it('shows an error if the amount is too high', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\r\n amountInput.value = '10000';\r\n const inputEvent = new Event('input');\r\n const errorDiv = el.shadowRoot?.querySelector('.error');\r\n expect(el.error).to.be.undefined;\r\n amountInput.dispatchEvent(inputEvent);\r\n await el.updateComplete;\r\n expect(el.error).to.not.be.undefined;\r\n expect(errorDiv?.innerHTML).to.contain('To make a donation of $10,000 or more');\r\n });\r\n\r\n it('shows the paypal blocker if there is an error', async () => {\r\n const el = (await fixture(html`\r\n <upsell-modal-content\r\n .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}\r\n ></upsell-modal-content>\r\n `)) as UpsellModalContent;\r\n\r\n const paypalBlocker = el.shadowRoot?.querySelector(\r\n '.paypal-upsell-slot-blocker',\r\n ) as HTMLDivElement;\r\n expect(el.error).to.be.undefined;\r\n expect(paypalBlocker.classList.contains('hidden')).to.be.true;\r\n el.error = lit2html`\r\n Some error\r\n `;\r\n await el.updateComplete;\r\n expect(el.error).to.not.be.undefined;\r\n expect(paypalBlocker.classList.contains('hidden')).to.be.false;\r\n });\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"upsell-modal-content.test.js","sourceRo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,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAA;;OAElB,CAAC;YACF,MAAM,EAAE,CAAC,cAAc,CAAC;YACxB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YACrC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACjE,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect, oneEvent } from '@open-wc/testing';\nimport { UpsellModalContent, UpsellModalCTAMode } from '../../../src/modals/upsell-modal-content';\nimport '../../../src/modals/upsell-modal-content';\nimport { html as lit2html } from 'lit';\n\ndescribe('Upsell Modal Content', () => {\n describe('UI Actions', () => {\n it('shows a no button', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const noButton = el.shadowRoot?.querySelector('#no-button');\n expect(noButton).to.exist;\n });\n\n it('shows the proper yes button for non-paypal types', async () => {\n const el = (await fixture(html`\n <upsell-modal-content .yesButtonMode=${UpsellModalCTAMode.YesButton}></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\n expect(yesButton).to.exist;\n const payPalSlot = el.shadowRoot?.querySelector('.paypal-upsell-slot-container');\n expect(payPalSlot).to.not.exist;\n });\n\n it('shows the paypal upsell slot for paypal upsells', async () => {\n const el = (await fixture(html`\n <upsell-modal-content\n .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}\n ></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const payPalSlot = el.shadowRoot?.querySelector('.paypal-upsell-slot-container');\n expect(payPalSlot).to.exist;\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\n expect(yesButton).to.not.exist;\n });\n });\n\n describe('Events Emitted', () => {\n it('emits a `yesSelected` event with the amount when yes is selected', async () => {\n const el = (await fixture(html`\n <upsell-modal-content\n .amount=${7.5}\n .yesButtonMode=${UpsellModalCTAMode.YesButton}\n ></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const yesButton = el.shadowRoot?.querySelector('#yes-button');\n const clickEvent = new MouseEvent('click');\n setTimeout(() => {\n yesButton?.dispatchEvent(clickEvent);\n });\n const response = await oneEvent(el, 'yesSelected');\n expect(response).to.exist;\n expect(response.detail.amount).to.equal(7.5);\n });\n\n it('emits a `noThanksSelected` event when no thanks is selected', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const noButton = el.shadowRoot?.querySelector('#no-button');\n const clickEvent = new MouseEvent('click');\n setTimeout(() => {\n noButton?.dispatchEvent(clickEvent);\n });\n const response = await oneEvent(el, 'noThanksSelected');\n expect(response).to.exist;\n });\n });\n\n describe('Amount Changer', () => {\n it('emits an `amountChanged` event with the amount if change successful', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\n amountInput.value = '3.50';\n const inputEvent = new Event('input');\n setTimeout(() => {\n amountInput.dispatchEvent(inputEvent);\n });\n const response = await oneEvent(el, 'amountChanged');\n expect(response).to.exist;\n expect(response.detail.amount).to.equal(3.5);\n });\n\n it('nothing happens if the input is empty', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\n amountInput.value = '';\n const inputEvent = new Event('input');\n expect(el.error).to.be.undefined;\n amountInput.dispatchEvent(inputEvent);\n await el.updateComplete;\n expect(el.error).to.be.undefined;\n });\n\n it('shows an error if the amount isNaN', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\n amountInput.value = 'a';\n const inputEvent = new Event('input');\n const errorDiv = el.shadowRoot?.querySelector('.error');\n expect(el.error).to.be.undefined;\n amountInput.dispatchEvent(inputEvent);\n await el.updateComplete;\n expect(el.error).to.not.be.undefined;\n expect(errorDiv?.innerHTML).to.contain('Please enter a valid amount.');\n });\n\n it('shows an error if the amount is too low', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\n amountInput.value = '0.99';\n const inputEvent = new Event('input');\n const errorDiv = el.shadowRoot?.querySelector('.error');\n expect(el.error).to.be.undefined;\n amountInput.dispatchEvent(inputEvent);\n await el.updateComplete;\n expect(el.error).to.not.be.undefined;\n expect(errorDiv?.innerHTML).to.contain('The minimum donation amount is $1');\n });\n\n it('shows an error if the amount is too high', async () => {\n const el = (await fixture(html`\n <upsell-modal-content></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const amountInput = el.shadowRoot?.querySelector('#amount-input') as HTMLInputElement;\n amountInput.value = '10000';\n const inputEvent = new Event('input');\n const errorDiv = el.shadowRoot?.querySelector('.error');\n expect(el.error).to.be.undefined;\n amountInput.dispatchEvent(inputEvent);\n await el.updateComplete;\n expect(el.error).to.not.be.undefined;\n expect(errorDiv?.innerHTML).to.contain('To make a donation of $10,000 or more');\n });\n\n it('shows the paypal blocker if there is an error', async () => {\n const el = (await fixture(html`\n <upsell-modal-content\n .yesButtonMode=${UpsellModalCTAMode.PayPalUpsellSlot}\n ></upsell-modal-content>\n `)) as UpsellModalContent;\n\n const paypalBlocker = el.shadowRoot?.querySelector(\n '.paypal-upsell-slot-blocker',\n ) as HTMLDivElement;\n expect(el.error).to.be.undefined;\n expect(paypalBlocker.classList.contains('hidden')).to.be.true;\n el.error = lit2html`\n Some error\n `;\n await el.updateComplete;\n expect(el.error).to.not.be.undefined;\n expect(paypalBlocker.classList.contains('hidden')).to.be.false;\n });\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"donation-payment-info.test.js","sourceRoot":"","sources":["../../../../test/tests/models/donation-payment-info.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE/F,qEAAqE;AACrE,kDAAkD;AAClD,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC1D,CAAC;AAED,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,iDAAiD,EAAE,GAAS,EAAE;QAC/D,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;QAC7D,MAAM,UAAU,GAAG,GAAG,CAAC;QACvB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAEzE,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY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AY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAS,EAAE;QACxE,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,gDAAgD;QAChD,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAS,EAAE;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;QAC/C,MAAM,eAAe,GAAG,mBAAmB,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\r\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\r\n\r\n// this is a separate calculation from the one in DonationPaymentInfo\r\n// to have a second verification independent of it\r\nfunction calculateFee(amount: number): number {\r\n return Math.round((amount * 0.0219 + 0.29) * 100) / 100;\r\n}\r\n\r\ndescribe('Donation Payment Info', () => {\r\n it('calculates the proper total for no fees covered', async () => {\r\n const donationInfo = new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: 3.5,\r\n coverFees: false,\r\n });\r\n\r\n expect(donationInfo.total).to.equal(3.5);\r\n });\r\n\r\n it('calculates the proper total for fees coverage', async () => {\r\n const baseAmount = 3.5;\r\n const expectedFee = calculateFee(baseAmount);\r\n const expectedTotal = Math.round((baseAmount + expectedFee) * 100) / 100;\r\n\r\n const donationInfo = new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: baseAmount,\r\n coverFees: true,\r\n });\r\n\r\n expect(donationInfo.total).to.equal(expectedTotal);\r\n });\r\n\r\n it('calculates the proper expected fees from manual calculations', async () => {\r\n const donationInfo = new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: 5,\r\n coverFees: true,\r\n });\r\n expect(donationInfo.fee).to.equal(0.4);\r\n expect(donationInfo.total).to.equal(5.4);\r\n\r\n donationInfo.amount = 3.5;\r\n expect(donationInfo.fee).to.equal(0.37);\r\n expect(donationInfo.total).to.equal(3.87);\r\n });\r\n\r\n it('calculates the proper expected fees', async () => {\r\n const baseAmount = 3.23;\r\n const expectedFee = calculateFee(baseAmount);\r\n const calculatedFee = DonationPaymentInfo.calculateFeeAmount(baseAmount);\r\n expect(expectedFee).to.equal(calculatedFee);\r\n });\r\n\r\n it('get the proper fee amount covered when covering fees', async () => {\r\n const baseAmount = 4.12;\r\n const expectedFee = calculateFee(baseAmount);\r\n const donationInfo = new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: baseAmount,\r\n coverFees: true,\r\n });\r\n\r\n expect(donationInfo.feeAmountCovered).to.equal(expectedFee);\r\n });\r\n\r\n it('get the proper fee amount covered when not covering fees', async () => {\r\n const baseAmount = 4.12;\r\n // const expectedFee = calculateFee(baseAmount);\r\n const donationInfo = new DonationPaymentInfo({\r\n donationType: DonationType.OneTime,\r\n amount: baseAmount,\r\n coverFees: false,\r\n });\r\n\r\n expect(donationInfo.feeAmountCovered).to.equal(0);\r\n });\r\n\r\n it('calculates the proper expected total', async () => {\r\n const baseAmount = 3.29;\r\n const expectedFee = calculateFee(baseAmount);\r\n const expectedTotal = baseAmount + expectedFee;\r\n const calculatedTotal = DonationPaymentInfo.calculateTotal(baseAmount, true);\r\n expect(expectedTotal).to.equal(calculatedTotal);\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"donation-payment-info.test.js","sourceRoot":"","sources":["../../../../test/tests/models/donation-payment-info.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE/F,qEAAqE;AACrE,kDAAkD;AAClD,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC1D,CAAC;AAED,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,iDAAiD,EAAE,GAAS,EAAE;QAC/D,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;QAC7D,MAAM,UAAU,GAAG,GAAG,CAAC;QACvB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;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sDAAsD,EAAE,GAAS,EAAE;QACpE,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAS,EAAE;QACxE,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,gDAAgD;QAChD,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;YAC3C,YAAY,EAAE,YAAY,CAAC,OAAO;YAClC,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAS,EAAE;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;QAC/C,MAAM,eAAe,GAAG,mBAAmB,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\n\n// this is a separate calculation from the one in DonationPaymentInfo\n// to have a second verification independent of it\nfunction calculateFee(amount: number): number {\n return Math.round((amount * 0.0219 + 0.29) * 100) / 100;\n}\n\ndescribe('Donation Payment Info', () => {\n it('calculates the proper total for no fees covered', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 3.5,\n coverFees: false,\n });\n\n expect(donationInfo.total).to.equal(3.5);\n });\n\n it('calculates the proper total for fees coverage', async () => {\n const baseAmount = 3.5;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = Math.round((baseAmount + expectedFee) * 100) / 100;\n\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.total).to.equal(expectedTotal);\n });\n\n it('calculates the proper expected fees from manual calculations', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 5,\n coverFees: true,\n });\n expect(donationInfo.fee).to.equal(0.4);\n expect(donationInfo.total).to.equal(5.4);\n\n donationInfo.amount = 3.5;\n expect(donationInfo.fee).to.equal(0.37);\n expect(donationInfo.total).to.equal(3.87);\n });\n\n it('calculates the proper expected fees', async () => {\n const baseAmount = 3.23;\n const expectedFee = calculateFee(baseAmount);\n const calculatedFee = DonationPaymentInfo.calculateFeeAmount(baseAmount);\n expect(expectedFee).to.equal(calculatedFee);\n });\n\n it('get the proper fee amount covered when covering fees', async () => {\n const baseAmount = 4.12;\n const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(expectedFee);\n });\n\n it('get the proper fee amount covered when not covering fees', async () => {\n const baseAmount = 4.12;\n // const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: false,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(0);\n });\n\n it('calculates the proper expected total', async () => {\n const baseAmount = 3.29;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = baseAmount + expectedFee;\n const calculatedTotal = DonationPaymentInfo.calculateTotal(baseAmount, true);\n expect(expectedTotal).to.equal(calculatedTotal);\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"payment-clients.test.js","sourceRoot":"","sources":["../../../test/tests/payment-clients.test.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,8BAA8B,EAAE,GAAS,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACtF,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C;QACtF,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC1C,MAAc,CAAC,MAAM,GAAG,UAAU,CAAC;QACpC,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QAC/D,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IACrC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { expect } from '@open-wc/testing';\r\nimport { HostingEnvironment } from '../../src/braintree-manager/braintree-interfaces';\r\nimport { PaymentClients } from '../../src/braintree-manager/payment-clients';\r\nimport { MockLazyLoader } from '../mocks/mock-lazy-loader';\r\nimport { MockApplePayClient } from '../mocks/payment-clients/mock-applepay-client';\r\nimport { MockBraintreeClient } from '../mocks/payment-clients/mock-braintree-client';\r\nimport { MockDeviceDataCollector } from '../mocks/payment-clients/mock-data-collector';\r\nimport { MockGooglePaymentClient } from '../mocks/payment-clients/mock-googlepay-client';\r\nimport { MockHostedFieldsClient } from '../mocks/payment-clients/mock-hostedfields-client';\r\nimport { MockVenmoClient } from '../mocks/payment-clients/mock-venmo-client';\r\nimport { MockGooglePayLibrary } from '../mocks/payment-clients/mock-googlepay-library';\r\nimport { MockGrecaptcha, MockGrecaptchaMode } from '../mocks/payment-clients/mock-grecaptcha';\r\nimport { MockPaypalLibrary } from '../mocks/payment-clients/mock-paypal-library';\r\n\r\ndescribe('PaymentClients', () => {\r\n it('returns the braintree client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockBraintreeClient = new MockBraintreeClient();\r\n (window.braintree as any) = {\r\n client: mockBraintreeClient,\r\n };\r\n const braintreeClient = await paymentClients.braintreeClient.get();\r\n expect(braintreeClient).to.equal(mockBraintreeClient);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the dataCollector client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockDataCollector = new MockDeviceDataCollector();\r\n (window.braintree as any) = {\r\n dataCollector: mockDataCollector,\r\n };\r\n const dataCollector = await paymentClients.dataCollector.get();\r\n expect(dataCollector).to.equal(dataCollector);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the hostedFields client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockHostedFields = new MockHostedFieldsClient();\r\n (window.braintree as any) = {\r\n hostedFields: mockHostedFields,\r\n };\r\n const hostedFields = await paymentClients.hostedFields.get();\r\n expect(hostedFields).to.equal(mockHostedFields);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the venmo client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockVenmo = new MockVenmoClient({ isBrowserSupported: true });\r\n (window.braintree as any) = {\r\n venmo: mockVenmo,\r\n };\r\n const venmo = await paymentClients.venmo.get();\r\n expect(venmo).to.equal(mockVenmo);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the PayPal client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockPaypal = new MockVenmoClient({ isBrowserSupported: true });\r\n (window.braintree as any) = {\r\n paypalCheckout: mockPaypal,\r\n };\r\n const paypal = await paymentClients.payPal.get();\r\n expect(paypal).to.equal(mockPaypal);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the ApplePay client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockApplePay = new MockApplePayClient();\r\n (window.braintree as any) = {\r\n applePay: mockApplePay,\r\n };\r\n const applePay = await paymentClients.applePay.get();\r\n expect(applePay).to.equal(mockApplePay);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the GooglePayBraintreeClient client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockGooglePay = new MockGooglePaymentClient();\r\n (window.braintree as any) = {\r\n googlePayment: mockGooglePay,\r\n };\r\n const googlePayment = await paymentClients.googlePayBraintreeClient.get();\r\n expect(googlePayment).to.equal(mockGooglePay);\r\n (window.braintree as any) = undefined;\r\n });\r\n\r\n it('returns the GooglePaymentsClient client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n window.google = {\r\n payments: {\r\n api: {\r\n PaymentsClient: MockGooglePayLibrary,\r\n },\r\n },\r\n };\r\n const googlePayment = await paymentClients.googlePaymentsClient.get();\r\n expect(googlePayment instanceof MockGooglePayLibrary).to.be.true;\r\n (window.google as any) = undefined;\r\n });\r\n\r\n it('returns the recaptcha client', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockGrecaptcha = new MockGrecaptcha(MockGrecaptchaMode.Success);\r\n window.grecaptcha = mockGrecaptcha;\r\n setTimeout(() => {\r\n // this callback needs to happen because the load happens asynchronously\r\n (window as any).donationFormGrecaptchaLoadedCallback();\r\n }, 10);\r\n const recaptchaLibrary = await paymentClients.recaptchaLibrary.get();\r\n expect(recaptchaLibrary).to.equal(mockGrecaptcha);\r\n (window.grecaptcha as any) = undefined;\r\n });\r\n\r\n it('returns the paypal library', async () => {\r\n const lazyLoader = new MockLazyLoader();\r\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\r\n const mockPaypal = new MockPaypalLibrary();\r\n (window as any).paypal = mockPaypal;\r\n const paypalLibrary = await paymentClients.paypalLibrary.get();\r\n expect(paypalLibrary).to.equal(mockPaypal);\r\n (window as any).paypal = undefined;\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"payment-clients.test.js","sourceRoot":"","sources":["../../../test/tests/payment-clients.test.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,8BAA8B,EAAE,GAAS,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACtF,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACrD,MAAM,CAAC,SAAiB,GAAG;YAC1B,MAAM,EAAE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QACpC,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QAC/D,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IACrC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { expect } from '@open-wc/testing';\nimport { HostingEnvironment } from '../../src/braintree-manager/braintree-interfaces';\nimport { PaymentClients } from '../../src/braintree-manager/payment-clients';\nimport { MockLazyLoader } from '../mocks/mock-lazy-loader';\nimport { MockApplePayClient } from '../mocks/payment-clients/mock-applepay-client';\nimport { MockBraintreeClient } from '../mocks/payment-clients/mock-braintree-client';\nimport { MockDeviceDataCollector } from '../mocks/payment-clients/mock-data-collector';\nimport { MockGooglePaymentClient } from '../mocks/payment-clients/mock-googlepay-client';\nimport { MockHostedFieldsClient } from '../mocks/payment-clients/mock-hostedfields-client';\nimport { MockVenmoClient } from '../mocks/payment-clients/mock-venmo-client';\nimport { MockGooglePayLibrary } from '../mocks/payment-clients/mock-googlepay-library';\nimport { MockGrecaptcha, MockGrecaptchaMode } from '../mocks/payment-clients/mock-grecaptcha';\nimport { MockPaypalLibrary } from '../mocks/payment-clients/mock-paypal-library';\n\ndescribe('PaymentClients', () => {\n it('returns the braintree client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockBraintreeClient = new MockBraintreeClient();\n (window.braintree as any) = {\n client: mockBraintreeClient,\n };\n const braintreeClient = await paymentClients.braintreeClient.get();\n expect(braintreeClient).to.equal(mockBraintreeClient);\n (window.braintree as any) = undefined;\n });\n\n it('returns the dataCollector client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockDataCollector = new MockDeviceDataCollector();\n (window.braintree as any) = {\n dataCollector: mockDataCollector,\n };\n const dataCollector = await paymentClients.dataCollector.get();\n expect(dataCollector).to.equal(dataCollector);\n (window.braintree as any) = undefined;\n });\n\n it('returns the hostedFields client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockHostedFields = new MockHostedFieldsClient();\n (window.braintree as any) = {\n hostedFields: mockHostedFields,\n };\n const hostedFields = await paymentClients.hostedFields.get();\n expect(hostedFields).to.equal(mockHostedFields);\n (window.braintree as any) = undefined;\n });\n\n it('returns the venmo client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockVenmo = new MockVenmoClient({ isBrowserSupported: true });\n (window.braintree as any) = {\n venmo: mockVenmo,\n };\n const venmo = await paymentClients.venmo.get();\n expect(venmo).to.equal(mockVenmo);\n (window.braintree as any) = undefined;\n });\n\n it('returns the PayPal client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockPaypal = new MockVenmoClient({ isBrowserSupported: true });\n (window.braintree as any) = {\n paypalCheckout: mockPaypal,\n };\n const paypal = await paymentClients.payPal.get();\n expect(paypal).to.equal(mockPaypal);\n (window.braintree as any) = undefined;\n });\n\n it('returns the ApplePay client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockApplePay = new MockApplePayClient();\n (window.braintree as any) = {\n applePay: mockApplePay,\n };\n const applePay = await paymentClients.applePay.get();\n expect(applePay).to.equal(mockApplePay);\n (window.braintree as any) = undefined;\n });\n\n it('returns the GooglePayBraintreeClient client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockGooglePay = new MockGooglePaymentClient();\n (window.braintree as any) = {\n googlePayment: mockGooglePay,\n };\n const googlePayment = await paymentClients.googlePayBraintreeClient.get();\n expect(googlePayment).to.equal(mockGooglePay);\n (window.braintree as any) = undefined;\n });\n\n it('returns the GooglePaymentsClient client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n window.google = {\n payments: {\n api: {\n PaymentsClient: MockGooglePayLibrary,\n },\n },\n };\n const googlePayment = await paymentClients.googlePaymentsClient.get();\n expect(googlePayment instanceof MockGooglePayLibrary).to.be.true;\n (window.google as any) = undefined;\n });\n\n it('returns the recaptcha client', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockGrecaptcha = new MockGrecaptcha(MockGrecaptchaMode.Success);\n window.grecaptcha = mockGrecaptcha;\n setTimeout(() => {\n // this callback needs to happen because the load happens asynchronously\n (window as any).donationFormGrecaptchaLoadedCallback();\n }, 10);\n const recaptchaLibrary = await paymentClients.recaptchaLibrary.get();\n expect(recaptchaLibrary).to.equal(mockGrecaptcha);\n (window.grecaptcha as any) = undefined;\n });\n\n it('returns the paypal library', async () => {\n const lazyLoader = new MockLazyLoader();\n const paymentClients = new PaymentClients(lazyLoader, HostingEnvironment.Development);\n const mockPaypal = new MockPaypalLibrary();\n (window as any).paypal = mockPaypal;\n const paypalLibrary = await paymentClients.paypalLibrary.get();\n expect(paypalLibrary).to.equal(mockPaypal);\n (window as any).paypal = undefined;\n });\n});\n"]}