@internetarchive/donation-form 0.5.20 → 0.5.21-a1

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 (135) hide show
  1. package/dist/demo/braintree-endpoint-manager.js +0 -1
  2. package/dist/demo/braintree-endpoint-manager.js.map +1 -1
  3. package/dist/demo/demo-analytics-handler.js.map +1 -1
  4. package/dist/demo/submit-form-with.js.map +1 -1
  5. package/dist/src/braintree-manager/braintree-manager.js +33 -35
  6. package/dist/src/braintree-manager/braintree-manager.js.map +1 -1
  7. package/dist/src/braintree-manager/payment-clients.js.map +1 -1
  8. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.js +1 -0
  9. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.js +1 -0
  10. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.js +1 -0
  11. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.js.map +1 -1
  12. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay.js +15 -14
  13. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay.js.map +1 -1
  14. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card-interface.js +1 -0
  15. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card.js +3 -3
  16. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card.js.map +1 -1
  17. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-container.js +6 -6
  18. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-container.js.map +1 -1
  19. package/dist/src/braintree-manager/payment-providers/google-pay-interface.js +1 -0
  20. package/dist/src/braintree-manager/payment-providers/google-pay.js +15 -15
  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 +1 -0
  24. package/dist/src/braintree-manager/payment-providers/paypal/paypal.js +1 -3
  25. package/dist/src/braintree-manager/payment-providers/paypal/paypal.js.map +1 -1
  26. package/dist/src/braintree-manager/payment-providers/venmo-interface.js +1 -0
  27. package/dist/src/braintree-manager/payment-providers/venmo.js +9 -8
  28. package/dist/src/braintree-manager/payment-providers/venmo.js.map +1 -1
  29. package/dist/src/braintree-manager/payment-providers-interface.d.ts +1 -1
  30. package/dist/src/braintree-manager/payment-providers-interface.js +1 -0
  31. package/dist/src/braintree-manager/payment-providers.js +3 -3
  32. package/dist/src/braintree-manager/payment-providers.js.map +1 -1
  33. package/dist/src/donation-form-controller.js +6 -5
  34. package/dist/src/donation-form-controller.js.map +1 -1
  35. package/dist/src/donation-form.js +9 -9
  36. package/dist/src/donation-form.js.map +1 -1
  37. package/dist/src/form-elements/badged-input.js +1 -5
  38. package/dist/src/form-elements/badged-input.js.map +1 -1
  39. package/dist/src/form-elements/contact-form/autocomplete-field-options.d.ts +1 -1
  40. package/dist/src/form-elements/contact-form/autocomplete-field-options.js +1 -0
  41. package/dist/src/form-elements/contact-form/contact-form.js +12 -10
  42. package/dist/src/form-elements/contact-form/contact-form.js.map +1 -1
  43. package/dist/src/form-elements/header/donation-form-header.js +1 -3
  44. package/dist/src/form-elements/header/donation-form-header.js.map +1 -1
  45. package/dist/src/form-elements/header/donation-summary.js.map +1 -1
  46. package/dist/src/form-elements/payment-selector.js +4 -4
  47. package/dist/src/form-elements/payment-selector.js.map +1 -1
  48. package/dist/src/form-elements/total-amount.js.map +1 -1
  49. package/dist/src/modals/confirm-donation-modal-content.js +13 -3
  50. package/dist/src/modals/confirm-donation-modal-content.js.map +1 -1
  51. package/dist/src/modals/error-modal-content.js.map +1 -1
  52. package/dist/src/modals/upsell-modal-content.js +5 -15
  53. package/dist/src/modals/upsell-modal-content.js.map +1 -1
  54. package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js +8 -19
  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.map +1 -1
  59. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js +6 -6
  60. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js.map +1 -1
  61. package/dist/src/payment-flow-handlers/handlers/venmo-flow-handler.js +2 -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 +11 -11
  65. package/dist/src/payment-flow-handlers/payment-flow-handlers.js.map +1 -1
  66. package/dist/test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.js.map +1 -1
  67. package/dist/test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.js.map +1 -1
  68. package/dist/test/mocks/flow-handlers/mock-payment-flow-handlers.js.map +1 -1
  69. package/dist/test/mocks/mock-braintree-manager.js.map +1 -1
  70. package/dist/test/mocks/mock-modal-manager.js.map +1 -1
  71. package/dist/test/mocks/mock-payment-clients.js +68 -58
  72. package/dist/test/mocks/mock-payment-clients.js.map +1 -1
  73. package/dist/test/mocks/models/mock-custom-fields.js +0 -1
  74. package/dist/test/mocks/models/mock-custom-fields.js.map +1 -1
  75. package/dist/test/mocks/models/mock-success-response.js +0 -1
  76. package/dist/test/mocks/models/mock-success-response.js.map +1 -1
  77. package/dist/test/mocks/payment-clients/mock-applepay-client.js.map +1 -1
  78. package/dist/test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.js.map +1 -1
  79. package/dist/test/mocks/payment-clients/mock-applepay-sessionmanager.js +3 -3
  80. package/dist/test/mocks/payment-clients/mock-applepay-sessionmanager.js.map +1 -1
  81. package/dist/test/mocks/payment-clients/mock-googlepay-library.js +4 -4
  82. package/dist/test/mocks/payment-clients/mock-googlepay-library.js.map +1 -1
  83. package/dist/test/mocks/payment-clients/mock-grecaptcha.js +8 -9
  84. package/dist/test/mocks/payment-clients/mock-grecaptcha.js.map +1 -1
  85. package/dist/test/mocks/payment-clients/mock-hostedfields-client.js +6 -6
  86. package/dist/test/mocks/payment-clients/mock-hostedfields-client.js.map +1 -1
  87. package/dist/test/mocks/payment-clients/mock-venmo-client.js +5 -5
  88. package/dist/test/mocks/payment-clients/mock-venmo-client.js.map +1 -1
  89. package/dist/test/mocks/payment-providers/individual-providers/mock-creditcard-handler.js +13 -13
  90. package/dist/test/mocks/payment-providers/individual-providers/mock-creditcard-handler.js.map +1 -1
  91. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource.js.map +1 -1
  92. package/dist/test/mocks/payment-providers/mock-payment-providers.js +2 -1
  93. package/dist/test/mocks/payment-providers/mock-payment-providers.js.map +1 -1
  94. package/dist/test/tests/braintree-manager.test.js +0 -1
  95. package/dist/test/tests/braintree-manager.test.js.map +1 -1
  96. package/dist/test/tests/donation-form-controller.test.js +1 -3
  97. package/dist/test/tests/donation-form-controller.test.js.map +1 -1
  98. package/dist/test/tests/donation-form.test.js +4 -12
  99. package/dist/test/tests/donation-form.test.js.map +1 -1
  100. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js +7 -8
  101. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js.map +1 -1
  102. package/dist/test/tests/form-elements/donation-summary.test.js +2 -6
  103. package/dist/test/tests/form-elements/donation-summary.test.js.map +1 -1
  104. package/dist/test/tests/form-elements/payment-selector.test.js +5 -15
  105. package/dist/test/tests/form-elements/payment-selector.test.js.map +1 -1
  106. package/dist/test/tests/modals/error-modal-content.test.js.map +1 -1
  107. package/dist/test/tests/modals/upsell-modal-content.test.js.map +1 -1
  108. package/dist/test/tests/payment-clients.test.js.map +1 -1
  109. package/dist/test/tests/payment-providers/applepay.test.js +1 -1
  110. package/dist/test/tests/payment-providers/applepay.test.js.map +1 -1
  111. package/dist/test/tests/payment-providers/paypal-button-datasource.test.js.map +1 -1
  112. package/dist/test/tests/payment-providers/venmo.test.js +1 -1
  113. package/dist/test/tests/payment-providers/venmo.test.js.map +1 -1
  114. package/dist/test/tests/recaptcha-manager.test.js +4 -12
  115. package/dist/test/tests/recaptcha-manager.test.js.map +1 -1
  116. package/package.json +31 -25
  117. package/src/braintree-manager/braintree-manager.ts +0 -2
  118. package/src/braintree-manager/payment-clients.ts +1 -2
  119. package/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.ts +1 -1
  120. package/src/braintree-manager/payment-providers/paypal/paypal.ts +3 -3
  121. package/src/donation-form-controller.ts +10 -9
  122. package/src/donation-form.ts +12 -15
  123. package/src/form-elements/badged-input.ts +1 -5
  124. package/src/form-elements/contact-form/contact-form.ts +25 -23
  125. package/src/form-elements/header/donation-form-header.ts +1 -3
  126. package/src/form-elements/payment-selector.ts +4 -4
  127. package/src/modals/confirm-donation-modal-content.ts +16 -6
  128. package/src/modals/upsell-modal-content.ts +5 -15
  129. package/src/payment-flow-handlers/donation-flow-modal-manager.ts +12 -22
  130. package/src/payment-flow-handlers/handlers/applepay-flow-handler.ts +2 -1
  131. package/src/payment-flow-handlers/handlers/creditcard-flow-handler.ts +2 -1
  132. package/src/payment-flow-handlers/handlers/googlepay-flow-handler.ts +4 -6
  133. package/src/payment-flow-handlers/handlers/paypal-flow-handler.ts +7 -6
  134. package/src/payment-flow-handlers/handlers/venmo-flow-handler.ts +2 -1
  135. package/src/payment-flow-handlers/payment-flow-handlers.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"venmo-flow-handler.js","sourceRoot":"","sources":["../../../../src/payment-flow-handlers/handlers/venmo-flow-handler.ts"],"names":[],"mappings":";AACA,OAAO,EAGL,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAEL,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAQ3C,MAAM,OAAO,gBAAg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Interface } from '../../braintree-manager/braintree-interfaces';\nimport {\n DonorContactInfo,\n DonationPaymentInfo,\n PaymentProvider,\n} from '@internetarchive/donation-form-data-models';\nimport {\n VenmoRestorationStateHandlerInterface,\n VenmoRestorationStateHandler,\n} from './venmo-restoration-state-handler';\nimport { DonationFlowModalManagerInterface } from '../donation-flow-modal-manager';\n\nexport interface VenmoFlowHandlerInterface {\n startup(): Promise<void>;\n paymentInitiated(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): Promise<void>;\n}\n\nexport class VenmoFlowHandler implements VenmoFlowHandlerInterface {\n private donationFlowModalManager: DonationFlowModalManagerInterface;\n\n private braintreeManager: BraintreeManagerInterface;\n\n private restorationStateHandler: VenmoRestorationStateHandlerInterface;\n\n constructor(options: {\n braintreeManager: BraintreeManagerInterface;\n donationFlowModalManager: DonationFlowModalManagerInterface;\n restorationStateHandler?: VenmoRestorationStateHandlerInterface;\n }) {\n this.braintreeManager = options.braintreeManager;\n this.donationFlowModalManager = options.donationFlowModalManager;\n this.restorationStateHandler =\n options.restorationStateHandler ?? new VenmoRestorationStateHandler();\n }\n\n /**\n * Check if we have any results from Venmo on startup.\n *\n * This happens if the app redirects to us in a new tab so we can resume the session.\n *\n * @returns {Promise<void>}\n * @memberof VenmoFlowHandler\n */\n async startup(): Promise<void> {\n const handler = await this.braintreeManager.paymentProviders.venmoHandler.get();\n const instance = await handler?.instance.get();\n if (instance?.hasTokenizationResult()) {\n // if we get redirected back from venmo in a different tab, we need to restore the data\n // that was persisted when the payment was initiated\n const restoredInfo = await this.restorationStateHandler.getRestorationState();\n if (restoredInfo) {\n this.paymentInitiated(restoredInfo.contactInfo, restoredInfo.donationInfo);\n } else {\n console.error('no restoration info');\n this.donationFlowModalManager.showErrorModal({\n message: 'Error restoring donation session',\n });\n }\n }\n }\n\n // VenmoFlowHandlerInterface conformance\n async paymentInitiated(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n // if we get redirected back from venmo in a different tab, we need to restore the data\n // that was persisted when the payment was initiated so persist it here\n this.restorationStateHandler.persistState(contactInfo, donationInfo);\n\n try {\n const handler = await this.braintreeManager.paymentProviders.venmoHandler.get();\n const result = await handler?.startPayment();\n if (!result) {\n this.restorationStateHandler.clearState();\n this.donationFlowModalManager.showErrorModal({\n message: 'Error setting up the donation',\n });\n return;\n }\n this.handleTokenizationResult(result, contactInfo, donationInfo);\n } catch (tokenizeError) {\n this.restorationStateHandler.clearState();\n this.handleTokenizationError(tokenizeError);\n this.donationFlowModalManager.showErrorModal({\n message: `There was a problem loading your donation information. Please try again.`,\n });\n }\n }\n\n private async handleTokenizationResult(\n payload: braintree.VenmoTokenizePayload,\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n this.restorationStateHandler.clearState();\n\n this.donationFlowModalManager.startDonationSubmissionFlow({\n nonce: payload.nonce,\n paymentProvider: PaymentProvider.Venmo,\n donationInfo: donationInfo,\n customerInfo: contactInfo.customer,\n billingInfo: contactInfo.billing,\n });\n }\n\n private handleTokenizationError(tokenizeError: braintree.BraintreeError): void {\n // Handle flow errors or premature flow closure\n switch (tokenizeError.code) {\n case 'VENMO_APP_CANCELED':\n break;\n case 'VENMO_CANCELED':\n break;\n default:\n console.error('Error!', tokenizeError);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"venmo-flow-handler.js","sourceRoot":"","sources":["../../../../src/payment-flow-handlers/handlers/venmo-flow-handler.ts"],"names":[],"mappings":";AACA,OAAO,EAGL,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAEL,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAS3C,MAAM,OAAO,gBAAgB;IAO3B,YAAY,OAIX;;QACC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;QACjE,IAAI,CAAC,uBAAuB;YAC1B,MAAA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AAC,UAAU,EAAE,CAAC;oBAC1C,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC;wBAC3C,OAAO,EAAE,+BAA+B;qBACzC,CAAC,CAAC;oBACH,OAAO;iBACR;gBACD,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;aAClE;YAAC,OAAO,aAAa,EAAE;gBACtB,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC;gBAC1C,IAAI,CAAC,uBAAuB,CAAC,aAA+B,CAAC,CAAC;gBAC9D,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC;oBAC3C,OAAO,EAAE,0EAA0E;iBACpF,CAAC,CAAC;aACJ;QACH,CAAC;KAAA;IAEa,wBAAwB,CACpC,OAAuC,EACvC,WAA6B,EAC7B,YAAiC;;YAEjC,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC;YAE1C,IAAI,CAAC,wBAAwB,CAAC,2BAA2B,CAAC;gBACxD,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,eAAe,EAAE,eAAe,CAAC,KAAK;gBACtC,YAAY,EAAE,YAAY;gBAC1B,YAAY,EAAE,WAAW,CAAC,QAAQ;gBAClC,WAAW,EAAE,WAAW,CAAC,OAAO;aACjC,CAAC,CAAC;QACL,CAAC;KAAA;IAEO,uBAAuB,CAAC,aAAuC;QACrE,+CAA+C;QAC/C,QAAQ,aAAa,CAAC,IAAI,EAAE;YAC1B,KAAK,oBAAoB;gBACvB,MAAM;YACR,KAAK,gBAAgB;gBACnB,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;SAC1C;IACH,CAAC;CACF","sourcesContent":["import { BraintreeManagerInterface } from '../../braintree-manager/braintree-interfaces';\nimport {\n DonorContactInfo,\n DonationPaymentInfo,\n PaymentProvider,\n} from '@internetarchive/donation-form-data-models';\nimport {\n VenmoRestorationStateHandlerInterface,\n VenmoRestorationStateHandler,\n} from './venmo-restoration-state-handler';\nimport { DonationFlowModalManagerInterface } from '../donation-flow-modal-manager';\nimport { BraintreeError } from '../../@types/braintree-web';\n\nexport interface VenmoFlowHandlerInterface {\n startup(): Promise<void>;\n paymentInitiated(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): Promise<void>;\n}\n\nexport class VenmoFlowHandler implements VenmoFlowHandlerInterface {\n private donationFlowModalManager: DonationFlowModalManagerInterface;\n\n private braintreeManager: BraintreeManagerInterface;\n\n private restorationStateHandler: VenmoRestorationStateHandlerInterface;\n\n constructor(options: {\n braintreeManager: BraintreeManagerInterface;\n donationFlowModalManager: DonationFlowModalManagerInterface;\n restorationStateHandler?: VenmoRestorationStateHandlerInterface;\n }) {\n this.braintreeManager = options.braintreeManager;\n this.donationFlowModalManager = options.donationFlowModalManager;\n this.restorationStateHandler =\n options.restorationStateHandler ?? new VenmoRestorationStateHandler();\n }\n\n /**\n * Check if we have any results from Venmo on startup.\n *\n * This happens if the app redirects to us in a new tab so we can resume the session.\n *\n * @returns {Promise<void>}\n * @memberof VenmoFlowHandler\n */\n async startup(): Promise<void> {\n const handler = await this.braintreeManager.paymentProviders.venmoHandler.get();\n const instance = await handler?.instance.get();\n if (instance?.hasTokenizationResult()) {\n // if we get redirected back from venmo in a different tab, we need to restore the data\n // that was persisted when the payment was initiated\n const restoredInfo = await this.restorationStateHandler.getRestorationState();\n if (restoredInfo) {\n this.paymentInitiated(restoredInfo.contactInfo, restoredInfo.donationInfo);\n } else {\n console.error('no restoration info');\n this.donationFlowModalManager.showErrorModal({\n message: 'Error restoring donation session',\n });\n }\n }\n }\n\n // VenmoFlowHandlerInterface conformance\n async paymentInitiated(\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n // if we get redirected back from venmo in a different tab, we need to restore the data\n // that was persisted when the payment was initiated so persist it here\n this.restorationStateHandler.persistState(contactInfo, donationInfo);\n\n try {\n const handler = await this.braintreeManager.paymentProviders.venmoHandler.get();\n const result = await handler?.startPayment();\n if (!result) {\n this.restorationStateHandler.clearState();\n this.donationFlowModalManager.showErrorModal({\n message: 'Error setting up the donation',\n });\n return;\n }\n this.handleTokenizationResult(result, contactInfo, donationInfo);\n } catch (tokenizeError) {\n this.restorationStateHandler.clearState();\n this.handleTokenizationError(tokenizeError as BraintreeError);\n this.donationFlowModalManager.showErrorModal({\n message: `There was a problem loading your donation information. Please try again.`,\n });\n }\n }\n\n private async handleTokenizationResult(\n payload: braintree.VenmoTokenizePayload,\n contactInfo: DonorContactInfo,\n donationInfo: DonationPaymentInfo,\n ): Promise<void> {\n this.restorationStateHandler.clearState();\n\n this.donationFlowModalManager.startDonationSubmissionFlow({\n nonce: payload.nonce,\n paymentProvider: PaymentProvider.Venmo,\n donationInfo: donationInfo,\n customerInfo: contactInfo.customer,\n billingInfo: contactInfo.billing,\n });\n }\n\n private handleTokenizationError(tokenizeError: braintree.BraintreeError): void {\n // Handle flow errors or premature flow closure\n switch (tokenizeError.code) {\n case 'VENMO_APP_CANCELED':\n break;\n case 'VENMO_CANCELED':\n break;\n default:\n console.error('Error!', tokenizeError);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"venmo-restoration-state-handler.js","sourceRoot":"","sources":["../../../../src/payment-flow-handlers/handlers/venmo-restoration-state-handler.ts"],"names":[],"mappings":";AA4BA;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAIhC,yCAAyC;IACzC,YAAY,MAA4E;QACtF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,4BAA4B;IAKvC,YAAY,OAAqC;QAJzC,mBAAc,GAAG,2BAA2B,CAAC;QAKnD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE;YAC1B,IAAI,C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AAe;QAC5C,IAAI;YACF,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,SAAS,EAAE;YAClB,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF","sourcesContent":["import { DonorContactInfo, DonationPaymentInfo } from '@internetarchive/donation-form-data-models';\n\nexport interface VenmoRestorationStateHandlerInterface {\n /**\n * Persist the session state\n *\n * @param {DonorContactInfo} contactInfo\n * @param {DonationPaymentInfo} donationInfo\n * @memberof VenmoRestorationStateHandlerInterface\n */\n persistState(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): void;\n\n /**\n * Get the session restoration state\n *\n * @returns {(Promise<VenmoRestorationState | undefined>)}\n * @memberof VenmoRestorationStateHandlerInterface\n */\n getRestorationState(): Promise<VenmoRestorationState | undefined>;\n\n /**\n * Clear the restoration state\n *\n * @memberof VenmoRestorationStateHandlerInterface\n */\n clearState(): void;\n}\n\n/**\n * Structure to store the session restoration state\n *\n * @export\n * @class VenmoRestorationState\n */\nexport class VenmoRestorationState {\n contactInfo: DonorContactInfo;\n donationInfo: DonationPaymentInfo;\n\n // TODO: Add restoration state expiration\n constructor(params: { contactInfo: DonorContactInfo; donationInfo: DonationPaymentInfo }) {\n this.contactInfo = params.contactInfo;\n this.donationInfo = params.donationInfo;\n }\n}\n\n/**\n * The VenmoRestorationStateHandler is used to persist and restore a Venmo checkout session.\n *\n * Venmo takes the user out of the web browser and into their app to authorize the purchase.\n * It then redirects the user back to the website to finish the transaction. The problem is\n * it may open a new browser tab so it's like starting a new session. We need to persist\n * the session information from the start of the Venmo session and restore it when it resumes.\n *\n * This class stores the session information in localStorage when the Venmo session is started\n * and retrieves it when the session is restored.\n *\n * @export\n * @class VenmoRestorationStateHandler\n * @implements {VenmoRestorationStateHandlerInterface}\n */\nexport class VenmoRestorationStateHandler implements VenmoRestorationStateHandlerInterface {\n private persistanceKey = 'venmoRestorationStateInfo';\n\n private storageSystem?: Storage;\n\n constructor(options?: { storageSystem?: Storage }) {\n if (options?.storageSystem) {\n this.storageSystem = options.storageSystem;\n } else if (this.storageSystemAvailable(localStorage)) {\n this.storageSystem = localStorage;\n } else if (this.storageSystemAvailable(sessionStorage)) {\n this.storageSystem = sessionStorage;\n }\n }\n\n /** @inheritdoc */\n clearState(): void {\n this.storageSystem?.removeItem(this.persistanceKey);\n }\n\n /** @inheritdoc */\n persistState(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): void {\n const venmoRestoration = new VenmoRestorationState({\n contactInfo,\n donationInfo,\n });\n const serialized = JSON.stringify(venmoRestoration);\n this.storageSystem?.setItem(this.persistanceKey, serialized);\n }\n\n /** @inheritdoc */\n async getRestorationState(): Promise<VenmoRestorationState | undefined> {\n const stored = this.storageSystem?.getItem(this.persistanceKey);\n if (!stored) {\n console.error('restoreState: No stored data');\n return undefined;\n }\n\n const deserialized = JSON.parse(stored);\n if (!deserialized) {\n console.error('restoreState: Data could not be deserialized');\n return undefined;\n }\n\n const donationInfo = new VenmoRestorationState(deserialized);\n\n return donationInfo;\n }\n\n /**\n * Check if a particular storage system (localStorage/sessionStorage) is availble\n *\n * @private\n * @param {Storage} system\n * @returns {boolean}\n * @memberof VenmoRestorationStateHandler\n */\n private storageSystemAvailable(system: Storage): boolean {\n try {\n system.setItem('foo', 'bar');\n system.removeItem('foo');\n return true;\n } catch (exception) {\n return false;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"venmo-restoration-state-handler.js","sourceRoot":"","sources":["../../../../src/payment-flow-handlers/handlers/venmo-restoration-state-handler.ts"],"names":[],"mappings":";AA4BA;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAIhC,yCAAyC;IACzC,YAAY,MAA4E;QACtF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAA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YAAY,EAAE;gBACjB,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBAC9D,OAAO,SAAS,CAAC;aAClB;YAED,MAAM,YAAY,GAAG,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAC;YAE7D,OAAO,YAAY,CAAC;;KACrB;IAED;;;;;;;OAOG;IACK,sBAAsB,CAAC,MAAe;QAC5C,IAAI;YACF,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,SAAS,EAAE;YAClB,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF","sourcesContent":["import { DonorContactInfo, DonationPaymentInfo } from '@internetarchive/donation-form-data-models';\n\nexport interface VenmoRestorationStateHandlerInterface {\n /**\n * Persist the session state\n *\n * @param {DonorContactInfo} contactInfo\n * @param {DonationPaymentInfo} donationInfo\n * @memberof VenmoRestorationStateHandlerInterface\n */\n persistState(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): void;\n\n /**\n * Get the session restoration state\n *\n * @returns {(Promise<VenmoRestorationState | undefined>)}\n * @memberof VenmoRestorationStateHandlerInterface\n */\n getRestorationState(): Promise<VenmoRestorationState | undefined>;\n\n /**\n * Clear the restoration state\n *\n * @memberof VenmoRestorationStateHandlerInterface\n */\n clearState(): void;\n}\n\n/**\n * Structure to store the session restoration state\n *\n * @export\n * @class VenmoRestorationState\n */\nexport class VenmoRestorationState {\n contactInfo: DonorContactInfo;\n donationInfo: DonationPaymentInfo;\n\n // TODO: Add restoration state expiration\n constructor(params: { contactInfo: DonorContactInfo; donationInfo: DonationPaymentInfo }) {\n this.contactInfo = params.contactInfo;\n this.donationInfo = params.donationInfo;\n }\n}\n\n/**\n * The VenmoRestorationStateHandler is used to persist and restore a Venmo checkout session.\n *\n * Venmo takes the user out of the web browser and into their app to authorize the purchase.\n * It then redirects the user back to the website to finish the transaction. The problem is\n * it may open a new browser tab so it's like starting a new session. We need to persist\n * the session information from the start of the Venmo session and restore it when it resumes.\n *\n * This class stores the session information in localStorage when the Venmo session is started\n * and retrieves it when the session is restored.\n *\n * @export\n * @class VenmoRestorationStateHandler\n * @implements {VenmoRestorationStateHandlerInterface}\n */\nexport class VenmoRestorationStateHandler implements VenmoRestorationStateHandlerInterface {\n private persistanceKey = 'venmoRestorationStateInfo';\n\n private storageSystem?: Storage;\n\n constructor(options?: { storageSystem?: Storage }) {\n if (options?.storageSystem) {\n this.storageSystem = options.storageSystem;\n } else if (this.storageSystemAvailable(localStorage)) {\n this.storageSystem = localStorage;\n } else if (this.storageSystemAvailable(sessionStorage)) {\n this.storageSystem = sessionStorage;\n }\n }\n\n /** @inheritdoc */\n clearState(): void {\n this.storageSystem?.removeItem(this.persistanceKey);\n }\n\n /** @inheritdoc */\n persistState(contactInfo: DonorContactInfo, donationInfo: DonationPaymentInfo): void {\n const venmoRestoration = new VenmoRestorationState({\n contactInfo,\n donationInfo,\n });\n const serialized = JSON.stringify(venmoRestoration);\n this.storageSystem?.setItem(this.persistanceKey, serialized);\n }\n\n /** @inheritdoc */\n async getRestorationState(): Promise<VenmoRestorationState | undefined> {\n const stored = this.storageSystem?.getItem(this.persistanceKey);\n if (!stored) {\n console.error('restoreState: No stored data');\n return undefined;\n }\n\n const deserialized = JSON.parse(stored);\n if (!deserialized) {\n console.error('restoreState: Data could not be deserialized');\n return undefined;\n }\n\n const donationInfo = new VenmoRestorationState(deserialized);\n\n return donationInfo;\n }\n\n /**\n * Check if a particular storage system (localStorage/sessionStorage) is availble\n *\n * @private\n * @param {Storage} system\n * @returns {boolean}\n * @memberof VenmoRestorationStateHandler\n */\n private storageSystemAvailable(system: Storage): boolean {\n try {\n system.setItem('foo', 'bar');\n system.removeItem('foo');\n return true;\n } catch (exception) {\n return false;\n }\n }\n}\n"]}
@@ -25,17 +25,6 @@ import { GooglePayFlowHandler, } from './handlers/googlepay-flow-handler';
25
25
  * @implements {PaymentFlowHandlersInterface}
26
26
  */
27
27
  export class PaymentFlowHandlers {
28
- constructor(options) {
29
- this.braintreeManager = options.braintreeManager;
30
- this.modalManager = options.modalManager;
31
- this.recaptchaManager = options.recaptchaManager;
32
- this.resources = options.resources;
33
- this.donationFlowModalManager = new DonationFlowModalManager({
34
- braintreeManager: this.braintreeManager,
35
- modalManager: this.modalManager,
36
- analytics: this.resources.analytics,
37
- });
38
- }
39
28
  startup() {
40
29
  var _a, _b;
41
30
  return __awaiter(this, void 0, void 0, function* () {
@@ -104,5 +93,16 @@ export class PaymentFlowHandlers {
104
93
  });
105
94
  return this.googlePayHandlerCache;
106
95
  }
96
+ constructor(options) {
97
+ this.braintreeManager = options.braintreeManager;
98
+ this.modalManager = options.modalManager;
99
+ this.recaptchaManager = options.recaptchaManager;
100
+ this.resources = options.resources;
101
+ this.donationFlowModalManager = new DonationFlowModalManager({
102
+ braintreeManager: this.braintreeManager,
103
+ modalManager: this.modalManager,
104
+ analytics: this.resources.analytics,
105
+ });
106
+ }
107
107
  }
108
108
  //# sourceMappingURL=payment-flow-handlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"payment-flow-handlers.js","sourceRoot":"","sources":["../../../src/payment-flow-handlers/payment-flow-handlers.ts"],"names":[],"mappings":";AAEA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAA8B,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAG/F,OAAO,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAA6B,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAEL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AA2C3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,mBAAmB;IAqG9B,YAAY,OAUX;QACC,IAAI,CAAC,gBAAg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QAED,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC;YAC9C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;SACxD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,IAAI,eAAe;QACjB,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;SAClC;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,CAAC;YAClD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;SACxD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,IAAI,YAAY;QACd,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,OAAO,IAAI,CAAC,iBAAiB,CAAC;SAC/B;QAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,gBAAgB,CAAC;YAC5C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;SACxD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,gBAAgB;QAClB,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC;SACnC;QAED,IAAI,CAAC,qBAAqB,GAAG,IAAI,oBAAoB,CAAC;YACpD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;SACxD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACpC,CAAC;CAyCF","sourcesContent":["import { ModalManagerInterface } from '@internetarchive/modal-manager';\n\nimport {\n CreditCardFlowHandlerInterface,\n CreditCardFlowHandler,\n} from './handlers/creditcard-flow-handler';\nimport { PayPalFlowHandlerInterface, PayPalFlowHandler } from './handlers/paypal-flow-handler';\nimport { BraintreeManagerInterface } from '../braintree-manager/braintree-interfaces';\nimport { RecaptchaManagerInterface } from '../recaptcha-manager/recaptcha-manager';\nimport {\n ApplePayFlowHandlerInterface,\n ApplePayFlowHandler,\n} from './handlers/applepay-flow-handler';\nimport { VenmoFlowHandlerInterface, VenmoFlowHandler } from './handlers/venmo-flow-handler';\nimport {\n DonationFlowModalManagerInterface,\n DonationFlowModalManager,\n} from './donation-flow-modal-manager';\nimport {\n GooglePayFlowHandlerInterface,\n GooglePayFlowHandler,\n} from './handlers/googlepay-flow-handler';\nimport { UpsellModalCTAMode } from '../modals/upsell-modal-content';\nimport { DonationType } from '@internetarchive/donation-form-data-models';\n\nexport interface PaymentFlowHandlersInterface {\n startup(): Promise<void>;\n /**\n * Show the upsell modal\n *\n * @param {{\n * ctaMode?: UpsellModalCTAMode;\n * yesSelected?: (amount: number) => void;\n * noSelected?: () => void;\n * amountChanged?: (amount: number) => void;\n * userClosedModalCallback?: () => void;\n * }} [options]\n * @returns {Promise<void>}\n * @memberof DonationFlowModalManagerInterface\n */\n showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void>;\n\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n confirmDonationCB: Function;\n cancelDonationCB: Function;\n }): Promise<void>;\n\n creditCardHandler: CreditCardFlowHandlerInterface | undefined;\n paypalHandler: PayPalFlowHandlerInterface | undefined;\n applePayHandler: ApplePayFlowHandlerInterface | undefined;\n venmoHandler: VenmoFlowHandlerInterface | undefined;\n googlePayHandler: GooglePayFlowHandlerInterface | undefined;\n}\n\n/**\n * This class is a container for all of the individual flow handlers.\n *\n * Flow Handlers are responsible for handling the provider-specific interactions between\n * the UI and the Data.\n *\n * For instance, when the user clicks on the \"Donate\" button for credit cards, we\n * pull in contact info from the form, trigger the recaptcha, tokenize the form,\n * submit, show the upsell, complete. The Credit Card Flow Handler is responsible for\n * managing that series of steps.\n *\n * For PayPal, the user initiates the payment from the PayPal button and once they're\n * done, we show the modal. The PayPal Flow Handler is responsible for handling that\n * series of events.\n *\n * @export\n * @class PaymentFlowHandlers\n * @implements {PaymentFlowHandlersInterface}\n */\nexport class PaymentFlowHandlers implements PaymentFlowHandlersInterface {\n async startup(): Promise<void> {\n this.venmoHandler?.startup();\n this.creditCardHandler?.startup();\n }\n\n /** @inheritdoc */\n async showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n return this.donationFlowModalManager.showUpsellModal(options);\n }\n\n /** @inheritdoc */\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n confirmDonationCB: Function;\n cancelDonationCB: Function;\n }): Promise<void> {\n return this.donationFlowModalManager.showConfirmationStepModal(options);\n }\n\n get creditCardHandler(): CreditCardFlowHandlerInterface | undefined {\n if (this.creditCardHandlerCache) {\n return this.creditCardHandlerCache;\n }\n\n this.creditCardHandlerCache = new CreditCardFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n recaptchaManager: this.recaptchaManager,\n });\n\n return this.creditCardHandlerCache;\n }\n\n get paypalHandler(): PayPalFlowHandlerInterface | undefined {\n if (this.paypalHandlerCache) {\n return this.paypalHandlerCache;\n }\n\n this.paypalHandlerCache = new PayPalFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.paypalHandlerCache;\n }\n\n get applePayHandler(): ApplePayFlowHandlerInterface | undefined {\n if (this.applePayHandlerCache) {\n return this.applePayHandlerCache;\n }\n\n this.applePayHandlerCache = new ApplePayFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.applePayHandlerCache;\n }\n\n get venmoHandler(): VenmoFlowHandlerInterface | undefined {\n if (this.venmoHandlerCache) {\n return this.venmoHandlerCache;\n }\n\n this.venmoHandlerCache = new VenmoFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.venmoHandlerCache;\n }\n\n get googlePayHandler(): GooglePayFlowHandlerInterface | undefined {\n if (this.googlePayHandlerCache) {\n return this.googlePayHandlerCache;\n }\n\n this.googlePayHandlerCache = new GooglePayFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.googlePayHandlerCache;\n }\n\n private creditCardHandlerCache?: CreditCardFlowHandlerInterface;\n private paypalHandlerCache?: PayPalFlowHandlerInterface;\n private applePayHandlerCache?: ApplePayFlowHandlerInterface;\n private venmoHandlerCache?: VenmoFlowHandlerInterface;\n private googlePayHandlerCache?: GooglePayFlowHandlerInterface;\n\n constructor(options: {\n braintreeManager: BraintreeManagerInterface;\n modalManager: ModalManagerInterface;\n recaptchaManager: RecaptchaManagerInterface;\n resources: {\n analytics: {\n logEvent: (action: string, label: string) => void;\n logDonationFlowEvent: (action: string, label: string) => void;\n };\n };\n }) {\n this.braintreeManager = options.braintreeManager;\n this.modalManager = options.modalManager;\n this.recaptchaManager = options.recaptchaManager;\n this.resources = options.resources;\n\n this.donationFlowModalManager = new DonationFlowModalManager({\n braintreeManager: this.braintreeManager,\n modalManager: this.modalManager,\n analytics: this.resources.analytics,\n });\n }\n\n private braintreeManager: BraintreeManagerInterface;\n private modalManager: ModalManagerInterface;\n private recaptchaManager: RecaptchaManagerInterface;\n private donationFlowModalManager: DonationFlowModalManagerInterface;\n private resources: {\n analytics: {\n logEvent: (action: string, label: string) => void;\n logDonationFlowEvent: (action: string, label: string) => void;\n };\n };\n}\n"]}
1
+ {"version":3,"file":"payment-flow-handlers.js","sourceRoot":"","sources":["../../../src/payment-flow-handlers/payment-flow-handlers.ts"],"names":[],"mappings":";AAGA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAA8B,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAG/F,OAAO,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAA6B,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAEL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AA2C3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,mBAAmB;IACxB,OAAO;;;YACX,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,EAAE,CAAC;YAC7B,MAAA,IAAI,CAAC,iBAAiB,0CAAE,OAAO,EAAE,CAAC;;KACnC;IAED,kBAAkB;IACZ,eAAe,CAAC,OAOrB;;YACC,OAAO,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;KAAA;IAED,kBAAkB;IAClB,yBAAyB,CAAC,OAMzB;QACC,OAAO,IAAI,CAAC,wBAAwB,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,iBAAiB;QACnB,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,OAAO,IAAI,CAAC,sBAAsB,CAAC;SACpC;QAED,IAAI,CAAC,sBAAsB,GAAG,IAAI,qBAAqB,CAAC;YACtD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;YACvD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED,IAAI,aAAa;QACf,IAAI,IAA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G,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAEnC,IAAI,CAAC,wBAAwB,GAAG,IAAI,wBAAwB,CAAC;YAC3D,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS;SACpC,CAAC,CAAC;IACL,CAAC;CAYF","sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport { ModalManagerInterface } from '@internetarchive/modal-manager';\n\nimport {\n CreditCardFlowHandlerInterface,\n CreditCardFlowHandler,\n} from './handlers/creditcard-flow-handler';\nimport { PayPalFlowHandlerInterface, PayPalFlowHandler } from './handlers/paypal-flow-handler';\nimport { BraintreeManagerInterface } from '../braintree-manager/braintree-interfaces';\nimport { RecaptchaManagerInterface } from '../recaptcha-manager/recaptcha-manager';\nimport {\n ApplePayFlowHandlerInterface,\n ApplePayFlowHandler,\n} from './handlers/applepay-flow-handler';\nimport { VenmoFlowHandlerInterface, VenmoFlowHandler } from './handlers/venmo-flow-handler';\nimport {\n DonationFlowModalManagerInterface,\n DonationFlowModalManager,\n} from './donation-flow-modal-manager';\nimport {\n GooglePayFlowHandlerInterface,\n GooglePayFlowHandler,\n} from './handlers/googlepay-flow-handler';\nimport { UpsellModalCTAMode } from '../modals/upsell-modal-content';\nimport { DonationType } from '@internetarchive/donation-form-data-models';\n\nexport interface PaymentFlowHandlersInterface {\n startup(): Promise<void>;\n /**\n * Show the upsell modal\n *\n * @param {{\n * ctaMode?: UpsellModalCTAMode;\n * yesSelected?: (amount: number) => void;\n * noSelected?: () => void;\n * amountChanged?: (amount: number) => void;\n * userClosedModalCallback?: () => void;\n * }} [options]\n * @returns {Promise<void>}\n * @memberof DonationFlowModalManagerInterface\n */\n showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void>;\n\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n confirmDonationCB: Function;\n cancelDonationCB: Function;\n }): Promise<void>;\n\n creditCardHandler: CreditCardFlowHandlerInterface | undefined;\n paypalHandler: PayPalFlowHandlerInterface | undefined;\n applePayHandler: ApplePayFlowHandlerInterface | undefined;\n venmoHandler: VenmoFlowHandlerInterface | undefined;\n googlePayHandler: GooglePayFlowHandlerInterface | undefined;\n}\n\n/**\n * This class is a container for all of the individual flow handlers.\n *\n * Flow Handlers are responsible for handling the provider-specific interactions between\n * the UI and the Data.\n *\n * For instance, when the user clicks on the \"Donate\" button for credit cards, we\n * pull in contact info from the form, trigger the recaptcha, tokenize the form,\n * submit, show the upsell, complete. The Credit Card Flow Handler is responsible for\n * managing that series of steps.\n *\n * For PayPal, the user initiates the payment from the PayPal button and once they're\n * done, we show the modal. The PayPal Flow Handler is responsible for handling that\n * series of events.\n *\n * @export\n * @class PaymentFlowHandlers\n * @implements {PaymentFlowHandlersInterface}\n */\nexport class PaymentFlowHandlers implements PaymentFlowHandlersInterface {\n async startup(): Promise<void> {\n this.venmoHandler?.startup();\n this.creditCardHandler?.startup();\n }\n\n /** @inheritdoc */\n async showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n return this.donationFlowModalManager.showUpsellModal(options);\n }\n\n /** @inheritdoc */\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n confirmDonationCB: Function;\n cancelDonationCB: Function;\n }): Promise<void> {\n return this.donationFlowModalManager.showConfirmationStepModal(options);\n }\n\n get creditCardHandler(): CreditCardFlowHandlerInterface | undefined {\n if (this.creditCardHandlerCache) {\n return this.creditCardHandlerCache;\n }\n\n this.creditCardHandlerCache = new CreditCardFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n recaptchaManager: this.recaptchaManager,\n });\n\n return this.creditCardHandlerCache;\n }\n\n get paypalHandler(): PayPalFlowHandlerInterface | undefined {\n if (this.paypalHandlerCache) {\n return this.paypalHandlerCache;\n }\n\n this.paypalHandlerCache = new PayPalFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.paypalHandlerCache;\n }\n\n get applePayHandler(): ApplePayFlowHandlerInterface | undefined {\n if (this.applePayHandlerCache) {\n return this.applePayHandlerCache;\n }\n\n this.applePayHandlerCache = new ApplePayFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.applePayHandlerCache;\n }\n\n get venmoHandler(): VenmoFlowHandlerInterface | undefined {\n if (this.venmoHandlerCache) {\n return this.venmoHandlerCache;\n }\n\n this.venmoHandlerCache = new VenmoFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.venmoHandlerCache;\n }\n\n get googlePayHandler(): GooglePayFlowHandlerInterface | undefined {\n if (this.googlePayHandlerCache) {\n return this.googlePayHandlerCache;\n }\n\n this.googlePayHandlerCache = new GooglePayFlowHandler({\n braintreeManager: this.braintreeManager,\n donationFlowModalManager: this.donationFlowModalManager,\n });\n\n return this.googlePayHandlerCache;\n }\n\n private creditCardHandlerCache?: CreditCardFlowHandlerInterface;\n private paypalHandlerCache?: PayPalFlowHandlerInterface;\n private applePayHandlerCache?: ApplePayFlowHandlerInterface;\n private venmoHandlerCache?: VenmoFlowHandlerInterface;\n private googlePayHandlerCache?: GooglePayFlowHandlerInterface;\n\n constructor(options: {\n braintreeManager: BraintreeManagerInterface;\n modalManager: ModalManagerInterface;\n recaptchaManager: RecaptchaManagerInterface;\n resources: {\n analytics: {\n logEvent: (action: string, label: string) => void;\n logDonationFlowEvent: (action: string, label: string) => void;\n };\n };\n }) {\n this.braintreeManager = options.braintreeManager;\n this.modalManager = options.modalManager;\n this.recaptchaManager = options.recaptchaManager;\n this.resources = options.resources;\n\n this.donationFlowModalManager = new DonationFlowModalManager({\n braintreeManager: this.braintreeManager,\n modalManager: this.modalManager,\n analytics: this.resources.analytics,\n });\n }\n\n private braintreeManager: BraintreeManagerInterface;\n private modalManager: ModalManagerInterface;\n private recaptchaManager: RecaptchaManagerInterface;\n private donationFlowModalManager: DonationFlowModalManagerInterface;\n private resources: {\n analytics: {\n logEvent: (action: string, label: string) => void;\n logDonationFlowEvent: (action: string, label: string) => void;\n };\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-creditcard-flow-handler.js","sourceRoot":"","sources":["../../../../../test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAW,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAOpE,MAAM,OAAO,yBAAyB;IAAtC;QACE,kBAAa,GAAG,KAAK,CAAC;QAKd,YAAO,GAAyC,gBAAgB,EAErE,CAAC;IA8BN,CAAC;IA5BC,0BAA0B;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEK,OAAO;;YACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;KAAA;IAEK,cAAc;;YAClB,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAEK,gBAAgB,CACpB,oBAA2D,EAC3D,YAAiC,EACjC,gBAAkC;;YAElC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;YACjD,IAAI,CAAC,4BAA4B,GAAG,YAAY,CAAC;YACjD,IAAI,CAAC,gCAAgC,GAAG,gBAAgB,CAAC;QAC3D,CAAC;KAAA;IAED,EAAE,CACA,KAAQ,EACR,QAAwC;QAExC,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Emitter, createNanoEvents, Unsubscribe } from 'nanoevents';\nimport {\n CreditCardFlowHandlerInterface,\n CreditCardFlowHandlerEvents,\n} from '../../../../src/payment-flow-handlers/handlers/creditcard-flow-handler';\nimport { DonationPaymentInfo, DonorContactInfo } from '@internetarchive/donation-form-data-models';\n\nexport class MockCreditCardFlowHandler implements CreditCardFlowHandlerInterface {\n startupCalled = false;\n paymentInitiatedDonationInfo?: DonationPaymentInfo;\n paymentInitiatedDonorContactInfo?: DonorContactInfo;\n hostedFieldsResponse?: braintree.HostedFieldsTokenizePayload;\n\n private emitter: Emitter<CreditCardFlowHandlerEvents> = createNanoEvents<\n CreditCardFlowHandlerEvents\n >();\n\n emitValidHostedFieldsEvent(): void {\n this.emitter.emit('validityChanged', true);\n }\n\n async startup(): Promise<void> {\n this.startupCalled = true;\n }\n\n async tokenizeFields(): Promise<braintree.HostedFieldsTokenizePayload | undefined> {\n return undefined;\n }\n\n async paymentInitiated(\n hostedFieldsResponse: braintree.HostedFieldsTokenizePayload,\n donationInfo: DonationPaymentInfo,\n donorContactInfo: DonorContactInfo,\n ): Promise<void> {\n this.hostedFieldsResponse = hostedFieldsResponse;\n this.paymentInitiatedDonationInfo = donationInfo;\n this.paymentInitiatedDonorContactInfo = donorContactInfo;\n }\n\n on<E extends keyof CreditCardFlowHandlerEvents>(\n event: E,\n callback: CreditCardFlowHandlerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n}\n"]}
1
+ {"version":3,"file":"mock-creditcard-flow-handler.js","sourceRoot":"","sources":["../../../../../test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAW,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAOpE,MAAM,OAAO,yBAAyB;IAAtC;QACE,kBAAa,GAAG,KAAK,CAAC;QAKd,YAAO,GACb,gBAAgB,EAA+B,CAAC;IA8BpD,CAAC;IA5BC,0BAA0B;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEK,OAAO;;YACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;KAAA;IAEK,cAAc;;YAClB,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAEK,gBAAgB,CACpB,oBAA2D,EAC3D,YAAiC,EACjC,gBAAkC;;YAElC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;YACjD,IAAI,CAAC,4BAA4B,GAAG,YAAY,CAAC;YACjD,IAAI,CAAC,gCAAgC,GAAG,gBAAgB,CAAC;QAC3D,CAAC;KAAA;IAED,EAAE,CACA,KAAQ,EACR,QAAwC;QAExC,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Emitter, createNanoEvents, Unsubscribe } from 'nanoevents';\nimport {\n CreditCardFlowHandlerInterface,\n CreditCardFlowHandlerEvents,\n} from '../../../../src/payment-flow-handlers/handlers/creditcard-flow-handler';\nimport { DonationPaymentInfo, DonorContactInfo } from '@internetarchive/donation-form-data-models';\n\nexport class MockCreditCardFlowHandler implements CreditCardFlowHandlerInterface {\n startupCalled = false;\n paymentInitiatedDonationInfo?: DonationPaymentInfo;\n paymentInitiatedDonorContactInfo?: DonorContactInfo;\n hostedFieldsResponse?: braintree.HostedFieldsTokenizePayload;\n\n private emitter: Emitter<CreditCardFlowHandlerEvents> =\n createNanoEvents<CreditCardFlowHandlerEvents>();\n\n emitValidHostedFieldsEvent(): void {\n this.emitter.emit('validityChanged', true);\n }\n\n async startup(): Promise<void> {\n this.startupCalled = true;\n }\n\n async tokenizeFields(): Promise<braintree.HostedFieldsTokenizePayload | undefined> {\n return undefined;\n }\n\n async paymentInitiated(\n hostedFieldsResponse: braintree.HostedFieldsTokenizePayload,\n donationInfo: DonationPaymentInfo,\n donorContactInfo: DonorContactInfo,\n ): Promise<void> {\n this.hostedFieldsResponse = hostedFieldsResponse;\n this.paymentInitiatedDonationInfo = donationInfo;\n this.paymentInitiatedDonorContactInfo = donorContactInfo;\n }\n\n on<E extends keyof CreditCardFlowHandlerEvents>(\n event: E,\n callback: CreditCardFlowHandlerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-googlepay-flow-handler.js","sourceRoot":"","sources":["../../../../../test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.ts"],"names":[],"mappings":";AAKA,OAAO,EAAe,gBAAgB,EAAW,MAAM,YAAY,CAAC;AAEpE,MAAM,OAAO,wBAAwB;IAArC;QACU,YAAO,GAAwC,gBAAgB,EAEpE,CAAC;IAcN,CAAC;IAZC,EAAE,CACA,KAAQ,EACR,QAAuC;QAEvC,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAIK,gBAAgB,CAAC,YAAiC;;YACtD,IAAI,CAAC,4BAA4B,GAAG,YAAY,CAAC;QACnD,CAAC;KAAA;CACF","sourcesContent":["import {\n GooglePayFlowHandlerInterface,\n GooglePayFlowHandlerEvents,\n} from '../../../../src/payment-flow-handlers/handlers/googlepay-flow-handler';\nimport { DonationPaymentInfo } from '@internetarchive/donation-form-data-models';\nimport { Unsubscribe, createNanoEvents, Emitter } from 'nanoevents';\n\nexport class MockGooglePayFlowHandler implements GooglePayFlowHandlerInterface {\n private emitter: Emitter<GooglePayFlowHandlerEvents> = createNanoEvents<\n GooglePayFlowHandlerEvents\n >();\n\n on<E extends keyof GooglePayFlowHandlerEvents>(\n event: E,\n callback: GooglePayFlowHandlerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n\n paymentInitiatedDonationInfo?: DonationPaymentInfo;\n\n async paymentInitiated(donationInfo: DonationPaymentInfo): Promise<void> {\n this.paymentInitiatedDonationInfo = donationInfo;\n }\n}\n"]}
1
+ {"version":3,"file":"mock-googlepay-flow-handler.js","sourceRoot":"","sources":["../../../../../test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.ts"],"names":[],"mappings":";AAKA,OAAO,EAAe,gBAAgB,EAAW,MAAM,YAAY,CAAC;AAEpE,MAAM,OAAO,wBAAwB;IAArC;QACU,YAAO,GACb,gBAAgB,EAA8B,CAAC;IAcnD,CAAC;IAZC,EAAE,CACA,KAAQ,EACR,QAAuC;QAEvC,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAIK,gBAAgB,CAAC,YAAiC;;YACtD,IAAI,CAAC,4BAA4B,GAAG,YAAY,CAAC;QACnD,CAAC;KAAA;CACF","sourcesContent":["import {\n GooglePayFlowHandlerInterface,\n GooglePayFlowHandlerEvents,\n} from '../../../../src/payment-flow-handlers/handlers/googlepay-flow-handler';\nimport { DonationPaymentInfo } from '@internetarchive/donation-form-data-models';\nimport { Unsubscribe, createNanoEvents, Emitter } from 'nanoevents';\n\nexport class MockGooglePayFlowHandler implements GooglePayFlowHandlerInterface {\n private emitter: Emitter<GooglePayFlowHandlerEvents> =\n createNanoEvents<GooglePayFlowHandlerEvents>();\n\n on<E extends keyof GooglePayFlowHandlerEvents>(\n event: E,\n callback: GooglePayFlowHandlerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n\n paymentInitiatedDonationInfo?: DonationPaymentInfo;\n\n async paymentInitiated(donationInfo: DonationPaymentInfo): Promise<void> {\n this.paymentInitiatedDonationInfo = donationInfo;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-payment-flow-handlers.js","sourceRoot":"","sources":["../../../../test/mocks/flow-handlers/mock-payment-flow-handlers.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAI7F,MAAM,OAAO,uBAAuB;IAApC;QAkBE,kBAAa,GAAG,KAAK,CAAC;QAKtB,sBAAiB,GAA8B,IAAI,yBAAyB,EAAE,CAAC;QAC/E,kBAAa,GAA0B,IAAI,qBAAqB,EAAE,CAAC;QACnE,oBAAe,GAA4B,IAAI,uBAAuB,EAAE,CAAC;QACzE,iBAAY,GAAyB,IAAI,oBAAoB,EAAE,CAAC;QAChE,qBAAgB,GAA6B,IAAI,wBAAwB,EAAE,CAAC;IAC9E,CAAC;IA3BC,eAAe,CAAC,OAOf;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,yBAAyB,CAAC,OAIzB;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEK,OAAO;;;YACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,GAAG;;KAC9B;CAMF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PaymentFlowHandlersInterface } from '../../../src/payment-flow-handlers/payment-flow-handlers';\nimport { MockCreditCardFlowHandler } from './individual-handlers/mock-creditcard-flow-handler';\nimport { MockPayPalFlowHandler } from './individual-handlers/mock-paypal-flow-handler';\nimport { MockApplePayFlowHandler } from './individual-handlers/mock-applepay-flow-handler';\nimport { MockVenmoFlowHandler } from './individual-handlers/mock-venmo-flow-handler';\nimport { MockGooglePayFlowHandler } from './individual-handlers/mock-googlepay-flow-handler';\nimport { UpsellModalCTAMode } from '../../../src/modals/upsell-modal-content';\nimport { DonationType } from '@internetarchive/donation-form-data-models';\n\nexport class MockPaymentFlowHandlers implements PaymentFlowHandlersInterface {\n showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n throw new Error('Method not implemented.');\n }\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n }): Promise<void> {\n throw new Error('Method not implemented.');\n }\n startupCalled = false;\n async startup(): Promise<void> {\n this.startupCalled = true;\n this.venmoHandler?.startup();\n }\n creditCardHandler: MockCreditCardFlowHandler = new MockCreditCardFlowHandler();\n paypalHandler: MockPayPalFlowHandler = new MockPayPalFlowHandler();\n applePayHandler: MockApplePayFlowHandler = new MockApplePayFlowHandler();\n venmoHandler: MockVenmoFlowHandler = new MockVenmoFlowHandler();\n googlePayHandler: MockGooglePayFlowHandler = new MockGooglePayFlowHandler();\n}\n"]}
1
+ {"version":3,"file":"mock-payment-flow-handlers.js","sourceRoot":"","sources":["../../../../test/mocks/flow-handlers/mock-payment-flow-handlers.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAI7F,MAAM,OAAO,uBAAuB;IAApC;QAkBE,kBAAa,GAAG,KAAK,CAAC;QAKtB,sBAAiB,GAA8B,IAAI,yBAAyB,EAAE,CAAC;QAC/E,kBAAa,GAA0B,IAAI,qBAAqB,EAAE,CAAC;QACnE,oBAAe,GAA4B,IAAI,uBAAuB,EAAE,CAAC;QACzE,iBAAY,GAAyB,IAAI,oBAAoB,EAAE,CAAC;QAChE,qBAAgB,GAA6B,IAAI,wBAAwB,EAAE,CAAC;IAC9E,CAAC;IA3BC,eAAe,CAAC,OAOf;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,yBAAyB,CAAC,OAIzB;QACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEK,OAAO;;;YACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,EAAE,CAAC;;KAC9B;CAMF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PaymentFlowHandlersInterface } from '../../../src/payment-flow-handlers/payment-flow-handlers';\nimport { MockCreditCardFlowHandler } from './individual-handlers/mock-creditcard-flow-handler';\nimport { MockPayPalFlowHandler } from './individual-handlers/mock-paypal-flow-handler';\nimport { MockApplePayFlowHandler } from './individual-handlers/mock-applepay-flow-handler';\nimport { MockVenmoFlowHandler } from './individual-handlers/mock-venmo-flow-handler';\nimport { MockGooglePayFlowHandler } from './individual-handlers/mock-googlepay-flow-handler';\nimport { UpsellModalCTAMode } from '../../../src/modals/upsell-modal-content';\nimport { DonationType } from '@internetarchive/donation-form-data-models';\n\nexport class MockPaymentFlowHandlers implements PaymentFlowHandlersInterface {\n showUpsellModal(options: {\n oneTimeAmount: number;\n ctaMode?: UpsellModalCTAMode;\n yesSelected?: (amount: number) => void;\n noSelected?: () => void;\n amountChanged?: (amount: number) => void;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n throw new Error('Method not implemented.');\n }\n showConfirmationStepModal(options: {\n amount: number;\n donationType: DonationType;\n currencyType: string;\n }): Promise<void> {\n throw new Error('Method not implemented.');\n }\n startupCalled = false;\n async startup(): Promise<void> {\n this.startupCalled = true;\n this.venmoHandler?.startup();\n }\n creditCardHandler: MockCreditCardFlowHandler = new MockCreditCardFlowHandler();\n paypalHandler: MockPayPalFlowHandler = new MockPayPalFlowHandler();\n applePayHandler: MockApplePayFlowHandler = new MockApplePayFlowHandler();\n venmoHandler: MockVenmoFlowHandler = new MockVenmoFlowHandler();\n googlePayHandler: MockGooglePayFlowHandler = new MockGooglePayFlowHandler();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-braintree-manager.js","sourceRoot":"","sources":["../../../test/mocks/mock-braintree-manager.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAIL,gBAAgB,EAEhB,eAAe,EACf,aAAa,GACd,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAE3D,MAAM,OAAO,oBAAoB;IAS/B,YAAY,OAGX;;QANO,wBAAmB,GAAG,KAAK,CAAC;QAC5B,2BAAsB,GAA0B,SAAS,CAAC;QAU1D,YAAO,GAAG,gBAAgB,EAA0B,CAAC;QAS7D,qBAAgB,GAA8B,IAAI,oBAAoB,EAAE,CAAC;QAEzE,aAAQ,GAAG,IAAI,iBAAiB,CAAmB;YACjD,SAAS,EAAE,GAA8B,EAAE,CACzC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBACpB,OAAO,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC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,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;iBAC/C,CAAC,CAAC;aACJ;QACH,CAAC;KAAA;IAEK,oBAAoB,CAAC,OAG1B;;YACC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC;gBACpC,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,mBAAmB;aAC3B,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IAED,kBAAkB,CAAC,OAGlB;QACC,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/camelcase */\n/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {\n BraintreeManagerEvents,\n BraintreeManagerInterface,\n} from '../../src/braintree-manager/braintree-interfaces';\nimport { PromisedSingleton } from '@internetarchive/promised-singleton';\nimport {\n PaymentProvider,\n DonationPaymentInfo,\n BillingInfo,\n DonationResponse,\n CustomerInfo,\n SuccessResponse,\n ErrorResponse,\n} from '@internetarchive/donation-form-data-models';\nimport { MockPaymentProviders } from './payment-providers/mock-payment-providers';\nimport { mockSuccessResponse } from './models/mock-success-response';\nimport { MockBraintreeClient } from './payment-clients/mock-braintree-client';\nimport { PaymentProvidersInterface } from '../../src/braintree-manager/payment-providers-interface';\nimport { createNanoEvents, Unsubscribe } from 'nanoevents';\n\nexport class MockBraintreeManager implements BraintreeManagerInterface {\n donationSuccessfulOptions?: {\n successResponse: SuccessResponse;\n upsellSuccessResponse?: SuccessResponse | undefined;\n };\n\n private submitDonationError = false;\n private submitDonationResponse: 'success' | 'failure' = 'success';\n\n constructor(options?: {\n submitDonationError?: boolean;\n submitDonationResponse?: 'success' | 'failure';\n }) {\n this.submitDonationError = options?.submitDonationError ?? false;\n this.submitDonationResponse = options?.submitDonationResponse ?? 'success';\n }\n\n private emitter = createNanoEvents<BraintreeManagerEvents>();\n\n on<E extends keyof BraintreeManagerEvents>(\n event: E,\n callback: BraintreeManagerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n\n paymentProviders: PaymentProvidersInterface = new MockPaymentProviders();\n\n instance = new PromisedSingleton<braintree.Client>({\n generator: (): Promise<braintree.Client> =>\n new Promise(resolve => {\n resolve(new MockBraintreeClient());\n }),\n });\n\n setReferrer(referrer: string): void {}\n\n setLoggedInUser(loggedInUser: string): void {}\n\n setOrigin(origin: string): void {}\n\n startup(): void {}\n\n async submitDonation(options: {\n nonce: string;\n paymentProvider: PaymentProvider;\n donationInfo: DonationPaymentInfo;\n billingInfo: BillingInfo;\n customerInfo: CustomerInfo;\n upsellOnetimeTransactionId?: string | undefined;\n customerId?: string | undefined;\n recaptchaToken?: string | undefined;\n bin?: string | undefined;\n binName?: string | undefined;\n }): Promise<DonationResponse> {\n if (this.submitDonationError) {\n throw 'oh no';\n }\n\n if (this.submitDonationResponse === 'success') {\n const response = new SuccessResponse({\n paymentMethodNonce: options.nonce,\n paymentProvider: options.paymentProvider,\n amount: options.donationInfo.amount,\n donationType: options.donationInfo.donationType,\n transaction_id: 'foo',\n customer_id: 'bar',\n customer: options.customerInfo,\n billing: options.billingInfo,\n });\n\n return new DonationResponse({\n success: true,\n value: response,\n });\n } else {\n return new DonationResponse({\n success: false,\n value: new ErrorResponse({ message: 'error' }),\n });\n }\n }\n\n async submitUpsellDonation(options: {\n oneTimeDonationResponse: SuccessResponse;\n amount: number;\n }): Promise<DonationResponse> {\n const response = new DonationResponse({\n success: true,\n value: mockSuccessResponse,\n });\n return response;\n }\n\n donationSuccessful(options: {\n successResponse: SuccessResponse;\n upsellSuccessResponse?: SuccessResponse | undefined;\n }): void {\n this.donationSuccessfulOptions = options;\n }\n}\n"]}
1
+ {"version":3,"file":"mock-braintree-manager.js","sourceRoot":"","sources":["../../../test/mocks/mock-braintree-manager.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAI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C5B,MAAM,OAAO,CAAC;aACf;YAED,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,EAAE;gBAC7C,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;oBACnC,kBAAkB,EAAE,OAAO,CAAC,KAAK;oBACjC,eAAe,EAAE,OAAO,CAAC,eAAe;oBACxC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM;oBACnC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,YAAY;oBAC/C,cAAc,EAAE,KAAK;oBACrB,WAAW,EAAE,KAAK;oBAClB,QAAQ,EAAE,OAAO,CAAC,YAAY;oBAC9B,OAAO,EAAE,OAAO,CAAC,WAAW;iBAC7B,CAAC,CAAC;gBAEH,OAAO,IAAI,gBAAgB,CAAC;oBAC1B,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,QAAQ;iBAChB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,IAAI,gBAAgB,CAAC;oBAC1B,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;iBAC/C,CAAC,CAAC;aACJ;QACH,CAAC;KAAA;IAEK,oBAAoB,CAAC,OAG1B;;YACC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC;gBACpC,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,mBAAmB;aAC3B,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IAED,kBAAkB,CAAC,OAGlB;QACC,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {\n BraintreeManagerEvents,\n BraintreeManagerInterface,\n} from '../../src/braintree-manager/braintree-interfaces';\nimport { PromisedSingleton } from '@internetarchive/promised-singleton';\nimport {\n PaymentProvider,\n DonationPaymentInfo,\n BillingInfo,\n DonationResponse,\n CustomerInfo,\n SuccessResponse,\n ErrorResponse,\n} from '@internetarchive/donation-form-data-models';\nimport { MockPaymentProviders } from './payment-providers/mock-payment-providers';\nimport { mockSuccessResponse } from './models/mock-success-response';\nimport { MockBraintreeClient } from './payment-clients/mock-braintree-client';\nimport { PaymentProvidersInterface } from '../../src/braintree-manager/payment-providers-interface';\nimport { createNanoEvents, Unsubscribe } from 'nanoevents';\n\nexport class MockBraintreeManager implements BraintreeManagerInterface {\n donationSuccessfulOptions?: {\n successResponse: SuccessResponse;\n upsellSuccessResponse?: SuccessResponse | undefined;\n };\n\n private submitDonationError = false;\n private submitDonationResponse: 'success' | 'failure' = 'success';\n\n constructor(options?: {\n submitDonationError?: boolean;\n submitDonationResponse?: 'success' | 'failure';\n }) {\n this.submitDonationError = options?.submitDonationError ?? false;\n this.submitDonationResponse = options?.submitDonationResponse ?? 'success';\n }\n\n private emitter = createNanoEvents<BraintreeManagerEvents>();\n\n on<E extends keyof BraintreeManagerEvents>(\n event: E,\n callback: BraintreeManagerEvents[E],\n ): Unsubscribe {\n return this.emitter.on(event, callback);\n }\n\n paymentProviders: PaymentProvidersInterface = new MockPaymentProviders();\n\n instance = new PromisedSingleton<braintree.Client>({\n generator: (): Promise<braintree.Client> =>\n new Promise(resolve => {\n resolve(new MockBraintreeClient());\n }),\n });\n\n setReferrer(referrer: string): void {}\n\n setLoggedInUser(loggedInUser: string): void {}\n\n setOrigin(origin: string): void {}\n\n startup(): void {}\n\n async submitDonation(options: {\n nonce: string;\n paymentProvider: PaymentProvider;\n donationInfo: DonationPaymentInfo;\n billingInfo: BillingInfo;\n customerInfo: CustomerInfo;\n upsellOnetimeTransactionId?: string | undefined;\n customerId?: string | undefined;\n recaptchaToken?: string | undefined;\n bin?: string | undefined;\n binName?: string | undefined;\n }): Promise<DonationResponse> {\n if (this.submitDonationError) {\n throw 'oh no';\n }\n\n if (this.submitDonationResponse === 'success') {\n const response = new SuccessResponse({\n paymentMethodNonce: options.nonce,\n paymentProvider: options.paymentProvider,\n amount: options.donationInfo.amount,\n donationType: options.donationInfo.donationType,\n transaction_id: 'foo',\n customer_id: 'bar',\n customer: options.customerInfo,\n billing: options.billingInfo,\n });\n\n return new DonationResponse({\n success: true,\n value: response,\n });\n } else {\n return new DonationResponse({\n success: false,\n value: new ErrorResponse({ message: 'error' }),\n });\n }\n }\n\n async submitUpsellDonation(options: {\n oneTimeDonationResponse: SuccessResponse;\n amount: number;\n }): Promise<DonationResponse> {\n const response = new DonationResponse({\n success: true,\n value: mockSuccessResponse,\n });\n return response;\n }\n\n donationSuccessful(options: {\n successResponse: SuccessResponse;\n upsellSuccessResponse?: SuccessResponse | undefined;\n }): void {\n this.donationSuccessfulOptions = options;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-modal-manager.js","sourceRoot":"","sources":["../../../test/mocks/mock-modal-manager.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAe,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,YAAY;IAAlD;;QACE,gBAAW,GAAG,KAAK,CAAC;IAuBtB,CAAC;IAhBC,UAAU;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,OAAO,gBAAgB,CAAC,MAAM,CAAC;IACjC,CAAC;IAEK,SAAS,CAAC,OAIf;;YACC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;YAChC,OAAO;QACT,CAAC;KAAA;CACF,CAAA;AAxBY,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAwB5B;SAxBY,gBAAgB","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { ModalManager, ModalConfig, ModalManagerMode } from '@internetarchive/modal-manager';\nimport { TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('mock-modal-manager')\nexport class MockModalManager extends ModalManager {\n closeCalled = false;\n showModalOptions?: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n };\n\n closeModal(): void {\n this.closeCalled = true;\n }\n\n getMode(): ModalManagerMode {\n return ModalManagerMode.Closed;\n }\n\n async showModal(options: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.showModalOptions = options;\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"mock-modal-manager.js","sourceRoot":"","sources":["../../../test/mocks/mock-modal-manager.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAe,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,YAAY;IAA3C;;QACL,gBAAW,GAAG,KAAK,CAAC;IAuBtB,CAAC;IAhBC,UAAU;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,OAAO,gBAAgB,CAAC,MAAM,CAAC;IACjC,CAAC;IAEK,SAAS,CAAC,OAIf;;YACC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;YAChC,OAAO;QACT,CAAC;KAAA;CACF,CAAA;AAxBY,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAwB5B;SAxBY,gBAAgB","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { ModalManager, ModalConfig, ModalManagerMode } from '@internetarchive/modal-manager';\nimport { TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('mock-modal-manager')\nexport class MockModalManager extends ModalManager {\n closeCalled = false;\n showModalOptions?: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n };\n\n closeModal(): void {\n this.closeCalled = true;\n }\n\n getMode(): ModalManagerMode {\n return ModalManagerMode.Closed;\n }\n\n async showModal(options: {\n config: ModalConfig;\n customModalContent?: TemplateResult;\n userClosedModalCallback?: () => void;\n }): Promise<void> {\n this.showModalOptions = options;\n return;\n }\n}\n"]}
@@ -11,69 +11,79 @@ import { MockGooglePayLibrary } from './payment-clients/mock-googlepay-library';
11
11
  import { MockGrecaptcha, MockGrecaptchaMode } from './payment-clients/mock-grecaptcha';
12
12
  import { MockPaypalLibrary } from './payment-clients/mock-paypal-library';
13
13
  export class MockPaymentClients {
14
- constructor(generators) {
15
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16
- this.braintreeClient = (_a = generators === null || generators === void 0 ? void 0 : generators.client) !== null && _a !== void 0 ? _a : new PromisedSingleton({
17
- generator: () => new Promise((resolve, reject) => {
18
- resolve(new MockBraintreeClient());
19
- }),
20
- });
21
- this.dataCollector = (_b = generators === null || generators === void 0 ? void 0 : generators.dataCollector) !== null && _b !== void 0 ? _b : new PromisedSingleton({
22
- generator: () => new Promise((resolve, reject) => {
23
- resolve(new MockDeviceDataCollector());
24
- }),
25
- });
26
- this.hostedFields = (_c = generators === null || generators === void 0 ? void 0 : generators.hostedFields) !== null && _c !== void 0 ? _c : new PromisedSingleton({
27
- generator: () => new Promise((resolve, reject) => {
28
- const client = new MockHostedFieldsClient();
29
- resolve(client);
30
- }),
31
- });
32
- this.venmo = (_d = generators === null || generators === void 0 ? void 0 : generators.venmo) !== null && _d !== void 0 ? _d : new PromisedSingleton({
33
- generator: () => new Promise((resolve, reject) => {
34
- resolve(new MockVenmoClient({ isBrowserSupported: true }));
35
- }),
36
- });
37
- this.payPal = (_e = generators === null || generators === void 0 ? void 0 : generators.payPal) !== null && _e !== void 0 ? _e : new PromisedSingleton({
38
- generator: () => new Promise((resolve, reject) => {
39
- resolve(new MockPayPalClient());
40
- }),
41
- });
42
- this.applePay = (_f = generators === null || generators === void 0 ? void 0 : generators.applePay) !== null && _f !== void 0 ? _f : new PromisedSingleton({
43
- generator: () => new Promise((resolve, reject) => {
44
- resolve(new MockApplePayClient());
45
- }),
46
- });
47
- this.googlePayBraintreeClient = (_g = generators === null || generators === void 0 ? void 0 : generators.googlePayBraintreeClient) !== null && _g !== void 0 ? _g : new PromisedSingleton({
48
- generator: () => new Promise((resolve, reject) => {
49
- resolve(new MockGooglePaymentClient());
50
- }),
51
- });
52
- this.googlePaymentsClient = (_h = generators === null || generators === void 0 ? void 0 : generators.googlePaymentsClient) !== null && _h !== void 0 ? _h : new PromisedSingleton({
53
- generator: () => new Promise((resolve, reject) => {
54
- const mockGooglePayLibrary = new MockGooglePayLibrary();
55
- mockGooglePayLibrary.readyToPay = true;
56
- resolve(mockGooglePayLibrary);
57
- }),
58
- });
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
- this.paypalLibrary = (_j = generators === null || generators === void 0 ? void 0 : generators.paypalLibrary) !== null && _j !== void 0 ? _j : new PromisedSingleton({
61
- generator: () => new Promise((resolve, reject) => {
62
- const mockPayPalLibrary = new MockPaypalLibrary();
63
- resolve(mockPayPalLibrary);
64
- }),
65
- });
66
- this.recaptchaLibrary = (_k = generators === null || generators === void 0 ? void 0 : generators.recaptchaLibrary) !== null && _k !== void 0 ? _k : new PromisedSingleton({
67
- generator: () => new Promise((resolve, reject) => {
68
- resolve(new MockGrecaptcha(MockGrecaptchaMode.Success));
69
- }),
70
- });
71
- }
72
14
  emitValidityChangedEvent(valid) {
73
15
  return __awaiter(this, void 0, void 0, function* () {
74
16
  const hostedFields = (yield this.hostedFields.get());
75
17
  hostedFields.emitValidityChangedEvent(valid);
76
18
  });
77
19
  }
20
+ constructor(generators) {
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22
+ this.braintreeClient =
23
+ (_a = generators === null || generators === void 0 ? void 0 : generators.client) !== null && _a !== void 0 ? _a : new PromisedSingleton({
24
+ generator: () => new Promise((resolve, reject) => {
25
+ resolve(new MockBraintreeClient());
26
+ }),
27
+ });
28
+ this.dataCollector =
29
+ (_b = generators === null || generators === void 0 ? void 0 : generators.dataCollector) !== null && _b !== void 0 ? _b : new PromisedSingleton({
30
+ generator: () => new Promise((resolve, reject) => {
31
+ resolve(new MockDeviceDataCollector());
32
+ }),
33
+ });
34
+ this.hostedFields =
35
+ (_c = generators === null || generators === void 0 ? void 0 : generators.hostedFields) !== null && _c !== void 0 ? _c : new PromisedSingleton({
36
+ generator: () => new Promise((resolve, reject) => {
37
+ const client = new MockHostedFieldsClient();
38
+ resolve(client);
39
+ }),
40
+ });
41
+ this.venmo =
42
+ (_d = generators === null || generators === void 0 ? void 0 : generators.venmo) !== null && _d !== void 0 ? _d : new PromisedSingleton({
43
+ generator: () => new Promise((resolve, reject) => {
44
+ resolve(new MockVenmoClient({ isBrowserSupported: true }));
45
+ }),
46
+ });
47
+ this.payPal =
48
+ (_e = generators === null || generators === void 0 ? void 0 : generators.payPal) !== null && _e !== void 0 ? _e : new PromisedSingleton({
49
+ generator: () => new Promise((resolve, reject) => {
50
+ resolve(new MockPayPalClient());
51
+ }),
52
+ });
53
+ this.applePay =
54
+ (_f = generators === null || generators === void 0 ? void 0 : generators.applePay) !== null && _f !== void 0 ? _f : new PromisedSingleton({
55
+ generator: () => new Promise((resolve, reject) => {
56
+ resolve(new MockApplePayClient());
57
+ }),
58
+ });
59
+ this.googlePayBraintreeClient =
60
+ (_g = generators === null || generators === void 0 ? void 0 : generators.googlePayBraintreeClient) !== null && _g !== void 0 ? _g : new PromisedSingleton({
61
+ generator: () => new Promise((resolve, reject) => {
62
+ resolve(new MockGooglePaymentClient());
63
+ }),
64
+ });
65
+ this.googlePaymentsClient =
66
+ (_h = generators === null || generators === void 0 ? void 0 : generators.googlePaymentsClient) !== null && _h !== void 0 ? _h : new PromisedSingleton({
67
+ generator: () => new Promise((resolve, reject) => {
68
+ const mockGooglePayLibrary = new MockGooglePayLibrary();
69
+ mockGooglePayLibrary.readyToPay = true;
70
+ resolve(mockGooglePayLibrary);
71
+ }),
72
+ });
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ this.paypalLibrary =
75
+ (_j = generators === null || generators === void 0 ? void 0 : generators.paypalLibrary) !== null && _j !== void 0 ? _j : new PromisedSingleton({
76
+ generator: () => new Promise((resolve, reject) => {
77
+ const mockPayPalLibrary = new MockPaypalLibrary();
78
+ resolve(mockPayPalLibrary);
79
+ }),
80
+ });
81
+ this.recaptchaLibrary =
82
+ (_k = generators === null || generators === void 0 ? void 0 : generators.recaptchaLibrary) !== null && _k !== void 0 ? _k : new PromisedSingleton({
83
+ generator: () => new Promise((resolve, reject) => {
84
+ resolve(new MockGrecaptcha(MockGrecaptchaMode.Success));
85
+ }),
86
+ });
87
+ }
78
88
  }
79
89
  //# sourceMappingURL=mock-payment-clients.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-payment-clients.js","sourceRoot":"","sources":["../../../test/mocks/mock-payment-clients.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC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ACL,CAAC,CAAC;QACL,8DAA8D;QAC9D,IAAI,CAAC,aAAa,SAChB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,mCACzB,IAAI,iBAAiB,CAAM;YACzB,SAAS,EAAE,GAAiB,EAAE,CAC5B,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC9B,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;gBAClD,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC7B,CAAC,CAAC;SACL,CAAC,CAAC;QACL,IAAI,CAAC,gBAAgB,SACnB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,gBAAgB,mCAC5B,IAAI,iBAAiB,CAAwB;YAC3C,SAAS,EAAE,GAAmC,EAAE,CAC9C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC9B,OAAO,CAAC,IAAI,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1D,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAjHK,wBAAwB,CAAC,KAAc;;YAC3C,MAAM,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAA2B,CAAC;YAC/E,YAAY,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;KAAA;CA+GF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { PaymentClientsInterface } from '../../src/braintree-manager/payment-clients';\nimport { PromisedSingleton } from '@internetarchive/promised-singleton';\nimport { MockBraintreeClient } from './payment-clients/mock-braintree-client';\nimport { MockDeviceDataCollector } from './payment-clients/mock-data-collector';\nimport { MockHostedFieldsClient } from './payment-clients/mock-hostedfields-client';\nimport { MockVenmoClient } from './payment-clients/mock-venmo-client';\nimport { MockPayPalClient } from './payment-clients/mock-paypal-client';\nimport { MockApplePayClient } from './payment-clients/mock-applepay-client';\nimport { MockGooglePaymentClient } from './payment-clients/mock-googlepay-client';\nimport { MockGooglePayLibrary } from './payment-clients/mock-googlepay-library';\nimport { MockGrecaptcha, MockGrecaptchaMode } from './payment-clients/mock-grecaptcha';\nimport { MockPaypalLibrary } from './payment-clients/mock-paypal-library';\n\nexport class MockPaymentClients implements PaymentClientsInterface {\n async emitValidityChangedEvent(valid: boolean): Promise<void> {\n const hostedFields = (await this.hostedFields.get()) as MockHostedFieldsClient;\n hostedFields.emitValidityChangedEvent(valid);\n }\n\n braintreeClient: PromisedSingleton<braintree.Client>;\n dataCollector: PromisedSingleton<braintree.DataCollector>;\n hostedFields: PromisedSingleton<braintree.HostedFields>;\n venmo: PromisedSingleton<braintree.Venmo>;\n payPal: PromisedSingleton<braintree.PayPalCheckout>;\n applePay: PromisedSingleton<braintree.ApplePay>;\n googlePayBraintreeClient: PromisedSingleton<braintree.GooglePayment>;\n googlePaymentsClient: PromisedSingleton<google.payments.api.PaymentsClient>;\n paypalLibrary: PromisedSingleton<any>;\n recaptchaLibrary: PromisedSingleton<ReCaptchaV2.ReCaptcha>;\n\n constructor(generators?: {\n client?: PromisedSingleton<braintree.Client>;\n dataCollector?: PromisedSingleton<braintree.DataCollector>;\n hostedFields?: PromisedSingleton<braintree.HostedFields>;\n venmo?: PromisedSingleton<braintree.Venmo>;\n payPal?: PromisedSingleton<braintree.PayPalCheckout>;\n applePay?: PromisedSingleton<braintree.ApplePay>;\n googlePayBraintreeClient?: PromisedSingleton<braintree.GooglePayment>;\n googlePaymentsClient?: PromisedSingleton<google.payments.api.PaymentsClient>;\n paypalLibrary?: PromisedSingleton<any>;\n recaptchaLibrary?: PromisedSingleton<ReCaptchaV2.ReCaptcha>;\n }) {\n this.braintreeClient =\n generators?.client ??\n new PromisedSingleton<braintree.Client>({\n generator: (): Promise<braintree.Client> =>\n new Promise((resolve, reject) => {\n resolve(new MockBraintreeClient());\n }),\n });\n this.dataCollector =\n generators?.dataCollector ??\n new PromisedSingleton<braintree.DataCollector>({\n generator: (): Promise<braintree.DataCollector> =>\n new Promise((resolve, reject) => {\n resolve(new MockDeviceDataCollector());\n }),\n });\n this.hostedFields =\n generators?.hostedFields ??\n new PromisedSingleton<braintree.HostedFields>({\n generator: (): Promise<braintree.HostedFields> =>\n new Promise((resolve, reject) => {\n const client = new MockHostedFieldsClient();\n resolve(client);\n }),\n });\n this.venmo =\n generators?.venmo ??\n new PromisedSingleton<braintree.Venmo>({\n generator: (): Promise<braintree.Venmo> =>\n new Promise((resolve, reject) => {\n resolve(new MockVenmoClient({ isBrowserSupported: true }));\n }),\n });\n this.payPal =\n generators?.payPal ??\n new PromisedSingleton<braintree.PayPalCheckout>({\n generator: (): Promise<braintree.PayPalCheckout> =>\n new Promise((resolve, reject) => {\n resolve(new MockPayPalClient());\n }),\n });\n this.applePay =\n generators?.applePay ??\n new PromisedSingleton<braintree.ApplePay>({\n generator: (): Promise<braintree.ApplePay> =>\n new Promise((resolve, reject) => {\n resolve(new MockApplePayClient());\n }),\n });\n this.googlePayBraintreeClient =\n generators?.googlePayBraintreeClient ??\n new PromisedSingleton<braintree.GooglePayment>({\n generator: (): Promise<braintree.GooglePayment> =>\n new Promise((resolve, reject) => {\n resolve(new MockGooglePaymentClient());\n }),\n });\n this.googlePaymentsClient =\n generators?.googlePaymentsClient ??\n new PromisedSingleton<google.payments.api.PaymentsClient>({\n generator: (): Promise<google.payments.api.PaymentsClient> =>\n new Promise((resolve, reject) => {\n const mockGooglePayLibrary = new MockGooglePayLibrary();\n mockGooglePayLibrary.readyToPay = true;\n resolve(mockGooglePayLibrary);\n }),\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.paypalLibrary =\n generators?.paypalLibrary ??\n new PromisedSingleton<any>({\n generator: (): Promise<any> =>\n new Promise((resolve, reject) => {\n const mockPayPalLibrary = new MockPaypalLibrary();\n resolve(mockPayPalLibrary);\n }),\n });\n this.recaptchaLibrary =\n generators?.recaptchaLibrary ??\n new PromisedSingleton<ReCaptchaV2.ReCaptcha>({\n generator: (): Promise<ReCaptchaV2.ReCaptcha> =>\n new Promise((resolve, reject) => {\n resolve(new MockGrecaptcha(MockGrecaptchaMode.Success));\n }),\n });\n }\n}\n"]}
1
+ {"version":3,"file":"mock-payment-clients.js","sourceRoot":"","sources":["../../../test/mocks/mock-payment-clients.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,OAAO,kBAAkB;IACvB,wBAAwB,CAAC,KAAc;;YAC3C,MAAM,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAA2B,CAAC;YAC/E,YAAY,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;KAAA;IAaD,YAAY,UAWX;;QACC,IAAI,CAAC,eAAe;YAClB,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,mCAClB,IAAI,iBAAiB,CAAmB;gBACtC,SAAS,EAAE,GAA8B,EAAE,CACzC,IAAI,OAAO,CAAC,C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E,GAAiB,EAAE,CAC5B,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC9B,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;oBAClD,OAAO,CAAC,iBAAiB,CAAC,CAAC;gBAC7B,CAAC,CAAC;aACL,CAAC,CAAC;QACL,IAAI,CAAC,gBAAgB;YACnB,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,gBAAgB,mCAC5B,IAAI,iBAAiB,CAAwB;gBAC3C,SAAS,EAAE,GAAmC,EAAE,CAC9C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC9B,OAAO,CAAC,IAAI,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC1D,CAAC,CAAC;aACL,CAAC,CAAC;IACP,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { PaymentClientsInterface } from '../../src/braintree-manager/payment-clients';\nimport { PromisedSingleton } from '@internetarchive/promised-singleton';\nimport { MockBraintreeClient } from './payment-clients/mock-braintree-client';\nimport { MockDeviceDataCollector } from './payment-clients/mock-data-collector';\nimport { MockHostedFieldsClient } from './payment-clients/mock-hostedfields-client';\nimport { MockVenmoClient } from './payment-clients/mock-venmo-client';\nimport { MockPayPalClient } from './payment-clients/mock-paypal-client';\nimport { MockApplePayClient } from './payment-clients/mock-applepay-client';\nimport { MockGooglePaymentClient } from './payment-clients/mock-googlepay-client';\nimport { MockGooglePayLibrary } from './payment-clients/mock-googlepay-library';\nimport { MockGrecaptcha, MockGrecaptchaMode } from './payment-clients/mock-grecaptcha';\nimport { MockPaypalLibrary } from './payment-clients/mock-paypal-library';\n\nexport class MockPaymentClients implements PaymentClientsInterface {\n async emitValidityChangedEvent(valid: boolean): Promise<void> {\n const hostedFields = (await this.hostedFields.get()) as MockHostedFieldsClient;\n hostedFields.emitValidityChangedEvent(valid);\n }\n\n braintreeClient: PromisedSingleton<braintree.Client>;\n dataCollector: PromisedSingleton<braintree.DataCollector>;\n hostedFields: PromisedSingleton<braintree.HostedFields>;\n venmo: PromisedSingleton<braintree.Venmo>;\n payPal: PromisedSingleton<braintree.PayPalCheckout>;\n applePay: PromisedSingleton<braintree.ApplePay>;\n googlePayBraintreeClient: PromisedSingleton<braintree.GooglePayment>;\n googlePaymentsClient: PromisedSingleton<google.payments.api.PaymentsClient>;\n paypalLibrary: PromisedSingleton<any>;\n recaptchaLibrary: PromisedSingleton<ReCaptchaV2.ReCaptcha>;\n\n constructor(generators?: {\n client?: PromisedSingleton<braintree.Client>;\n dataCollector?: PromisedSingleton<braintree.DataCollector>;\n hostedFields?: PromisedSingleton<braintree.HostedFields>;\n venmo?: PromisedSingleton<braintree.Venmo>;\n payPal?: PromisedSingleton<braintree.PayPalCheckout>;\n applePay?: PromisedSingleton<braintree.ApplePay>;\n googlePayBraintreeClient?: PromisedSingleton<braintree.GooglePayment>;\n googlePaymentsClient?: PromisedSingleton<google.payments.api.PaymentsClient>;\n paypalLibrary?: PromisedSingleton<any>;\n recaptchaLibrary?: PromisedSingleton<ReCaptchaV2.ReCaptcha>;\n }) {\n this.braintreeClient =\n generators?.client ??\n new PromisedSingleton<braintree.Client>({\n generator: (): Promise<braintree.Client> =>\n new Promise((resolve, reject) => {\n resolve(new MockBraintreeClient());\n }),\n });\n this.dataCollector =\n generators?.dataCollector ??\n new PromisedSingleton<braintree.DataCollector>({\n generator: (): Promise<braintree.DataCollector> =>\n new Promise((resolve, reject) => {\n resolve(new MockDeviceDataCollector());\n }),\n });\n this.hostedFields =\n generators?.hostedFields ??\n new PromisedSingleton<braintree.HostedFields>({\n generator: (): Promise<braintree.HostedFields> =>\n new Promise((resolve, reject) => {\n const client = new MockHostedFieldsClient();\n resolve(client);\n }),\n });\n this.venmo =\n generators?.venmo ??\n new PromisedSingleton<braintree.Venmo>({\n generator: (): Promise<braintree.Venmo> =>\n new Promise((resolve, reject) => {\n resolve(new MockVenmoClient({ isBrowserSupported: true }));\n }),\n });\n this.payPal =\n generators?.payPal ??\n new PromisedSingleton<braintree.PayPalCheckout>({\n generator: (): Promise<braintree.PayPalCheckout> =>\n new Promise((resolve, reject) => {\n resolve(new MockPayPalClient());\n }),\n });\n this.applePay =\n generators?.applePay ??\n new PromisedSingleton<braintree.ApplePay>({\n generator: (): Promise<braintree.ApplePay> =>\n new Promise((resolve, reject) => {\n resolve(new MockApplePayClient());\n }),\n });\n this.googlePayBraintreeClient =\n generators?.googlePayBraintreeClient ??\n new PromisedSingleton<braintree.GooglePayment>({\n generator: (): Promise<braintree.GooglePayment> =>\n new Promise((resolve, reject) => {\n resolve(new MockGooglePaymentClient());\n }),\n });\n this.googlePaymentsClient =\n generators?.googlePaymentsClient ??\n new PromisedSingleton<google.payments.api.PaymentsClient>({\n generator: (): Promise<google.payments.api.PaymentsClient> =>\n new Promise((resolve, reject) => {\n const mockGooglePayLibrary = new MockGooglePayLibrary();\n mockGooglePayLibrary.readyToPay = true;\n resolve(mockGooglePayLibrary);\n }),\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.paypalLibrary =\n generators?.paypalLibrary ??\n new PromisedSingleton<any>({\n generator: (): Promise<any> =>\n new Promise((resolve, reject) => {\n const mockPayPalLibrary = new MockPaypalLibrary();\n resolve(mockPayPalLibrary);\n }),\n });\n this.recaptchaLibrary =\n generators?.recaptchaLibrary ??\n new PromisedSingleton<ReCaptchaV2.ReCaptcha>({\n generator: (): Promise<ReCaptchaV2.ReCaptcha> =>\n new Promise((resolve, reject) => {\n resolve(new MockGrecaptcha(MockGrecaptchaMode.Success));\n }),\n });\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/camelcase */
2
1
  import { DonationRequestCustomFields } from '@internetarchive/donation-form-data-models';
3
2
  export const mockCustomFields = new DonationRequestCustomFields({
4
3
  logged_in_user: 'some-username',
@@ -1 +1 @@
1
- {"version":3,"file":"mock-custom-fields.js","sourceRoot":"","sources":["../../../../test/mocks/models/mock-custom-fields.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,2BAA2B,CAAC;IAC9D,cAAc,EAAE,eAAe;IAC/B,QAAQ,EAAE,eAAe;IACzB,kBAAkB,EAAE,IAAI;CACzB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/camelcase */\nimport { DonationRequestCustomFields } from '@internetarchive/donation-form-data-models';\n\nexport const mockCustomFields = new DonationRequestCustomFields({\n logged_in_user: 'some-username',\n referrer: 'some-referrer',\n fee_amount_covered: 0.42,\n});\n"]}
1
+ {"version":3,"file":"mock-custom-fields.js","sourceRoot":"","sources":["../../../../test/mocks/models/mock-custom-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,2BAA2B,CAAC;IAC9D,cAAc,EAAE,eAAe;IAC/B,QAAQ,EAAE,eAAe;IACzB,kBAAkB,EAAE,IAAI;CACzB,CAAC,CAAC","sourcesContent":["import { DonationRequestCustomFields } from '@internetarchive/donation-form-data-models';\n\nexport const mockCustomFields = new DonationRequestCustomFields({\n logged_in_user: 'some-username',\n referrer: 'some-referrer',\n fee_amount_covered: 0.42,\n});\n"]}
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/camelcase */
2
1
  import { SuccessResponse, DonationType, PaymentProvider, } from '@internetarchive/donation-form-data-models';
3
2
  import { mockCustomerInfo } from './mock-customer-info';
4
3
  import { mockBillingInfo } from './mock-billing-info';
@@ -1 +1 @@
1
- {"version":3,"file":"mock-success-response.js","sourceRoot":"","sources":["../../../../test/mocks/models/mock-success-response.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,eAAe,CAAC;IACrD,eAAe,EAAE,eAAe,CAAC,UAAU;IAC3C,kBAAkB,EAAE,WAAW;IAC/B,MAAM,EAAE,CAAC;IACT,YAAY,EAAE,YAAY,CAAC,OAAO;IAClC,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,gBAAgB;IAC1B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/camelcase */\nimport {\n SuccessResponse,\n DonationType,\n PaymentProvider,\n} from '@internetarchive/donation-form-data-models';\nimport { mockCustomerInfo } from './mock-customer-info';\nimport { mockBillingInfo } from './mock-billing-info';\n\nexport const mockSuccessResponse = new SuccessResponse({\n paymentProvider: PaymentProvider.CreditCard,\n paymentMethodNonce: 'foo-nonce',\n amount: 5,\n donationType: DonationType.OneTime,\n transaction_id: '123',\n customer_id: '123',\n customer: mockCustomerInfo,\n billing: mockBillingInfo,\n});\n"]}
1
+ {"version":3,"file":"mock-success-response.js","sourceRoot":"","sources":["../../../../test/mocks/models/mock-success-response.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,eAAe,CAAC;IACrD,eAAe,EAAE,eAAe,CAAC,UAAU;IAC3C,kBAAkB,EAAE,WAAW;IAC/B,MAAM,EAAE,CAAC;IACT,YAAY,EAAE,YAAY,CAAC,OAAO;IAClC,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,gBAAgB;IAC1B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC","sourcesContent":["import {\n SuccessResponse,\n DonationType,\n PaymentProvider,\n} from '@internetarchive/donation-form-data-models';\nimport { mockCustomerInfo } from './mock-customer-info';\nimport { mockBillingInfo } from './mock-billing-info';\n\nexport const mockSuccessResponse = new SuccessResponse({\n paymentProvider: PaymentProvider.CreditCard,\n paymentMethodNonce: 'foo-nonce',\n amount: 5,\n donationType: DonationType.OneTime,\n transaction_id: '123',\n customer_id: '123',\n customer: mockCustomerInfo,\n billing: mockBillingInfo,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-applepay-client.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-client.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,sDAAsD;AACtD,MAAM,OAAO,kBAAkB;IAI7B,YAAY,OAGX;;QANO,2BAAsB,GAAG,IAAI,CAAC;QAC9B,+BAA0B,GAAG,IAAI,CAAC;QAc1C,YAAO,GAAG,KAAK,CAAC;QARd,IAAI,CAAC,sBAAsB,SAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,mCAAI,IAAI,CAAC;QACtE,IAAI,CAAC,0BAA0B,SAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,0BAA0B,mCAAI,IAAI,CAAC;IAChF,CAAC;IAEK,MAAM,CAAC,OAAqC;;YAChD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAID,oBAAoB,CAClB,cAAgD;QAEhD,OAAO;YACL,KAAK,EAAE;gBACL,KAAK,EAAE,cAAc;gBACrB,MAAM,EAAE,MAAM;aACf;YACD,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,KAAK;YACnB,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YACjC,oBAAoB,EAAE,EAAE;YAExB,4BAA4B,EAAE,CAAC,eAAe,CAAC;YAC/C,6BAA6B,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;SACjD,CAAC;IACJ,CAAC;IAED,iBAAiB,CACf,OAIC,EACD,QAA4B;QAE5B,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACrC;aAAM;YACL,MAAM,KAAK,GAA6B;gBACtC,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,SAAS;aACnB,CAAC;YACF,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;SAC5B;IACH,CAAC;IAEK,QAAQ,CAAC,OAAuB,EAAE,QAA6B;;YACnE,IAAI,IAAI,CAAC,0BAA0B,EAAE;gBACnC,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;iBACrC;qBAAM;oBACL,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;iBACvB;aACF;iBAAM;gBACL,MAAM,KAAK,GAA6B;oBACtC,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,SAAS;iBACnB,CAAC;gBACF,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;iBAC5B;qBAAM;oBACL,MAAM,KAAK,CAAC;iBACb;aACF;QACH,CAAC;KAAA;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nexport class MockApplePayClient implements braintree.ApplePay {\n private shouldValidateMerchant = true;\n private shouldTokenizeSuccessfully = true;\n\n constructor(options?: {\n shouldValidateMerchant?: boolean;\n shouldTokenizeSuccessfully?: boolean;\n }) {\n this.shouldValidateMerchant = options?.shouldValidateMerchant ?? true;\n this.shouldTokenizeSuccessfully = options?.shouldTokenizeSuccessfully ?? true;\n }\n\n async create(options: { client: braintree.Client }): Promise<braintree.ApplePay> {\n return this;\n }\n\n VERSION = 'foo';\n\n createPaymentRequest(\n paymentRequest: braintree.ApplePayPaymentRequest,\n ): braintree.ApplePayPaymentRequest {\n return {\n total: {\n label: 'Foo Donation',\n amount: '3.50',\n },\n countryCode: 'US',\n currencyCode: 'USD',\n supportedNetworks: ['Foo', 'Bar'],\n merchantCapabilities: [],\n\n requiredBillingContactFields: ['postalAddress'],\n requiredShippingContactFields: ['name', 'email'],\n };\n }\n\n performValidation(\n options: {\n validationURL: string;\n displayName?: string | undefined;\n merchantIdentifier?: string | undefined;\n },\n callback: braintree.callback,\n ): void {\n if (this.shouldValidateMerchant) {\n callback(undefined, { foo: 'bar' });\n } else {\n const error: braintree.BraintreeError = {\n code: 'foo',\n message: 'bar',\n type: 'CUSTOMER',\n details: 'foo bar',\n };\n callback(error, undefined);\n }\n }\n\n async tokenize(options: { token: any }, callback?: braintree.callback): Promise<any> {\n if (this.shouldTokenizeSuccessfully) {\n if (callback) {\n callback(undefined, { foo: 'bar' });\n } else {\n return { foo: 'bar' };\n }\n } else {\n const error: braintree.BraintreeError = {\n code: 'foo',\n message: 'bar',\n type: 'CUSTOMER',\n details: 'foo bar',\n };\n if (callback) {\n callback(error, undefined);\n } else {\n throw error;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"mock-applepay-client.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-client.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,sDAAsD;AACtD,MAAM,OAAO,kBAAkB;IAI7B,YAAY,OAGX;;QANO,2BAAsB,GAAG,IAAI,CAAC;QAC9B,+BAA0B,GAAG,IAAI,CAAC;QAc1C,YAAO,GAAG,KAAK,CAAC;QARd,IAAI,CAAC,sBAAsB,GAAG,MAAA,OAAO,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K,GAA6B;oBACtC,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,SAAS;iBACnB,CAAC;gBACF,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;iBAC5B;qBAAM;oBACL,MAAM,KAAK,CAAC;iBACb;aACF;QACH,CAAC;KAAA;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nexport class MockApplePayClient implements braintree.ApplePay {\n private shouldValidateMerchant = true;\n private shouldTokenizeSuccessfully = true;\n\n constructor(options?: {\n shouldValidateMerchant?: boolean;\n shouldTokenizeSuccessfully?: boolean;\n }) {\n this.shouldValidateMerchant = options?.shouldValidateMerchant ?? true;\n this.shouldTokenizeSuccessfully = options?.shouldTokenizeSuccessfully ?? true;\n }\n\n async create(options: { client: braintree.Client }): Promise<braintree.ApplePay> {\n return this;\n }\n\n VERSION = 'foo';\n\n createPaymentRequest(\n paymentRequest: braintree.ApplePayPaymentRequest,\n ): braintree.ApplePayPaymentRequest {\n return {\n total: {\n label: 'Foo Donation',\n amount: '3.50',\n },\n countryCode: 'US',\n currencyCode: 'USD',\n supportedNetworks: ['Foo', 'Bar'],\n merchantCapabilities: [],\n\n requiredBillingContactFields: ['postalAddress'],\n requiredShippingContactFields: ['name', 'email'],\n };\n }\n\n performValidation(\n options: {\n validationURL: string;\n displayName?: string | undefined;\n merchantIdentifier?: string | undefined;\n },\n callback: braintree.callback,\n ): void {\n if (this.shouldValidateMerchant) {\n callback(undefined, { foo: 'bar' });\n } else {\n const error: braintree.BraintreeError = {\n code: 'foo',\n message: 'bar',\n type: 'CUSTOMER',\n details: 'foo bar',\n };\n callback(error, undefined);\n }\n }\n\n async tokenize(options: { token: any }, callback?: braintree.callback): Promise<any> {\n if (this.shouldTokenizeSuccessfully) {\n if (callback) {\n callback(undefined, { foo: 'bar' });\n } else {\n return { foo: 'bar' };\n }\n } else {\n const error: braintree.BraintreeError = {\n code: 'foo',\n message: 'bar',\n type: 'CUSTOMER',\n details: 'foo bar',\n };\n if (callback) {\n callback(error, undefined);\n } else {\n throw error;\n }\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-applepay-paymentauthorizedevent.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,kCAAkC;IAA/C;QAEE,YAAO,GAA+B,IAAI,mBAAmB,EAAE,CAAC;QAChE,YAAO,GAAG,IAAI,CAAC;QACf,iBAAY,GAAG,IAAI,CAAC;QACpB,eAAU,GAAG,IAAI,CAAC;QAClB,aAAQ,GAAG,IAAI,CAAC;QAChB,kBAAa,GAAgB,IAAI,WAAW,EAAE,CAAC;QAC/C,qBAAgB,GAAG,KAAK,CAAC;QACzB,eAAU,GAAG,CAAC,CAAC;QACf,cAAS,GAAG,IAAI,CAAC;QACjB,gBAAW,GAAG,IAAI,CAAC;QACnB,eAAU,GAAgB,IAAI,WAAW,EAAE,CAAC;QAC5C,WAAM,GAAgB,IAAI,WAAW,EAAE,CAAC;QACxC,cAAS,GAAG,MAAM,CAAC;QACnB,SAAI,GAAG,KAAK,CAAC;IAoBf,CAAC;IAnBC,YAAY;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,SAAS,CACP,IAAyB,EACzB,OAA6B,EAC7B,UAAgC;QAEhC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,cAAc;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,wBAAwB;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { MockApplePayPayment } from './mock-applepay-payment';\n\nexport class MockApplePayPaymentAuthorizedEvent\n implements ApplePayJS.ApplePayPaymentAuthorizedEvent {\n payment: ApplePayJS.ApplePayPayment = new MockApplePayPayment();\n bubbles = true;\n cancelBubble = true;\n cancelable = true;\n composed = true;\n currentTarget: EventTarget = new EventTarget();\n defaultPrevented = false;\n eventPhase = 1;\n isTrusted = true;\n returnValue = true;\n srcElement: EventTarget = new EventTarget();\n target: EventTarget = new EventTarget();\n timeStamp = '1234';\n type = 'foo';\n composedPath(): Node[] {\n throw new Error('Method not implemented.');\n }\n initEvent(\n type?: string | undefined,\n bubbles?: boolean | undefined,\n cancelable?: boolean | undefined,\n ): void {\n throw new Error('Method not implemented.');\n }\n preventDefault(): void {\n throw new Error('Method not implemented.');\n }\n stopImmediatePropagation(): void {\n throw new Error('Method not implemented.');\n }\n stopPropagation(): void {\n throw new Error('Method not implemented.');\n }\n}\n"]}
1
+ {"version":3,"file":"mock-applepay-paymentauthorizedevent.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,kCAAkC;IAA/C;QAGE,YAAO,GAA+B,IAAI,mBAAmB,EAAE,CAAC;QAChE,YAAO,GAAG,IAAI,CAAC;QACf,iBAAY,GAAG,IAAI,CAAC;QACpB,eAAU,GAAG,IAAI,CAAC;QAClB,aAAQ,GAAG,IAAI,CAAC;QAChB,kBAAa,GAAgB,IAAI,WAAW,EAAE,CAAC;QAC/C,qBAAgB,GAAG,KAAK,CAAC;QACzB,eAAU,GAAG,CAAC,CAAC;QACf,cAAS,GAAG,IAAI,CAAC;QACjB,gBAAW,GAAG,IAAI,CAAC;QACnB,eAAU,GAAgB,IAAI,WAAW,EAAE,CAAC;QAC5C,WAAM,GAAgB,IAAI,WAAW,EAAE,CAAC;QACxC,cAAS,GAAG,MAAM,CAAC;QACnB,SAAI,GAAG,KAAK,CAAC;IAoBf,CAAC;IAnBC,YAAY;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,SAAS,CACP,IAAyB,EACzB,OAA6B,EAC7B,UAAgC;QAEhC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,cAAc;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,wBAAwB;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { MockApplePayPayment } from './mock-applepay-payment';\n\nexport class MockApplePayPaymentAuthorizedEvent\n implements ApplePayJS.ApplePayPaymentAuthorizedEvent\n{\n payment: ApplePayJS.ApplePayPayment = new MockApplePayPayment();\n bubbles = true;\n cancelBubble = true;\n cancelable = true;\n composed = true;\n currentTarget: EventTarget = new EventTarget();\n defaultPrevented = false;\n eventPhase = 1;\n isTrusted = true;\n returnValue = true;\n srcElement: EventTarget = new EventTarget();\n target: EventTarget = new EventTarget();\n timeStamp = '1234';\n type = 'foo';\n composedPath(): Node[] {\n throw new Error('Method not implemented.');\n }\n initEvent(\n type?: string | undefined,\n bubbles?: boolean | undefined,\n cancelable?: boolean | undefined,\n ): void {\n throw new Error('Method not implemented.');\n }\n preventDefault(): void {\n throw new Error('Method not implemented.');\n }\n stopImmediatePropagation(): void {\n throw new Error('Method not implemented.');\n }\n stopPropagation(): void {\n throw new Error('Method not implemented.');\n }\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  import { MockApplePaySession } from './mock-applepay-session';
2
2
  export class MockApplePaySessionManager {
3
- constructor(options) {
4
- this.makePayments = options.canMakePayments;
5
- }
6
3
  canMakePayments() {
7
4
  return this.makePayments;
8
5
  }
9
6
  createNewPaymentSession(paymentRequest) {
10
7
  return new MockApplePaySession(1, paymentRequest);
11
8
  }
9
+ constructor(options) {
10
+ this.makePayments = options.canMakePayments;
11
+ }
12
12
  }
13
13
  //# sourceMappingURL=mock-applepay-sessionmanager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-applepay-sessionmanager.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-sessionmanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,0BAA0B;IASrC,YAAY,OAAqC;QAC/C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAC9C,CAAC;IAVD,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,uBAAuB,CAAC,cAAiD;QACvE,OAAO,IAAI,mBAAmB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;CAOF","sourcesContent":["import { ApplePaySessionManagerInterface } from '../../../src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager';\nimport { MockApplePaySession } from './mock-applepay-session';\n\nexport class MockApplePaySessionManager implements ApplePaySessionManagerInterface {\n canMakePayments(): boolean {\n return this.makePayments;\n }\n\n createNewPaymentSession(paymentRequest: ApplePayJS.ApplePayPaymentRequest): ApplePaySession {\n return new MockApplePaySession(1, paymentRequest);\n }\n\n constructor(options: { canMakePayments: boolean }) {\n this.makePayments = options.canMakePayments;\n }\n\n private makePayments: boolean;\n}\n"]}
1
+ {"version":3,"file":"mock-applepay-sessionmanager.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-applepay-sessionmanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,0BAA0B;IACrC,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,uBAAuB,CAAC,cAAiD;QACvE,OAAO,IAAI,mBAAmB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,YAAY,OAAqC;QAC/C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAC9C,CAAC;CAGF","sourcesContent":["import { ApplePaySessionManagerInterface } from '../../../src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager';\nimport { MockApplePaySession } from './mock-applepay-session';\n\nexport class MockApplePaySessionManager implements ApplePaySessionManagerInterface {\n canMakePayments(): boolean {\n return this.makePayments;\n }\n\n createNewPaymentSession(paymentRequest: ApplePayJS.ApplePayPaymentRequest): ApplePaySession {\n return new MockApplePaySession(1, paymentRequest);\n }\n\n constructor(options: { canMakePayments: boolean }) {\n this.makePayments = options.canMakePayments;\n }\n\n private makePayments: boolean;\n}\n"]}
@@ -1,10 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
3
  export class MockGooglePayLibrary {
4
- constructor(paymentOptions) {
5
- this.readyToPay = false;
6
- this.paymentOptions = paymentOptions;
7
- }
8
4
  isReadyToPay(request) {
9
5
  return __awaiter(this, void 0, void 0, function* () {
10
6
  return { result: this.readyToPay };
@@ -19,5 +15,9 @@ export class MockGooglePayLibrary {
19
15
  prefetchPaymentData(request) {
20
16
  throw new Error('Method not implemented.');
21
17
  }
18
+ constructor(paymentOptions) {
19
+ this.readyToPay = false;
20
+ this.paymentOptions = paymentOptions;
21
+ }
22
22
  }
23
23
  //# sourceMappingURL=mock-googlepay-library.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-googlepay-library.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-googlepay-library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,MAAM,OAAO,oBAAoB;IAqB/B,YAAY,cAAmD;QApB/D,eAAU,GAAG,KAAK,CAAC;QAqBjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IApBK,YAAY,CAChB,OAAgD;;YAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,CAAC;KAAA;IAED,YAAY,CAAC,OAA0C;QACrD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe,CACb,OAA+C;QAE/C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,mBAAmB,CAAC,OAA+C;QACjE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CAOF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nexport class MockGooglePayLibrary implements google.payments.api.PaymentsClient {\n readyToPay = false;\n\n async isReadyToPay(\n request: google.payments.api.IsReadyToPayRequest,\n ): Promise<google.payments.api.IsReadyToPayResponse> {\n return { result: this.readyToPay };\n }\n\n createButton(options: google.payments.api.ButtonOptions): HTMLElement {\n throw new Error('Method not implemented.');\n }\n loadPaymentData(\n request: google.payments.api.PaymentDataRequest,\n ): Promise<google.payments.api.PaymentData> {\n throw new Error('Method not implemented.');\n }\n prefetchPaymentData(request: google.payments.api.PaymentDataRequest): void {\n throw new Error('Method not implemented.');\n }\n\n constructor(paymentOptions?: google.payments.api.PaymentOptions) {\n this.paymentOptions = paymentOptions;\n }\n\n private paymentOptions?: google.payments.api.PaymentOptions;\n}\n"]}
1
+ {"version":3,"file":"mock-googlepay-library.js","sourceRoot":"","sources":["../../../../test/mocks/payment-clients/mock-googlepay-library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,MAAM,OAAO,oBAAoB;IAGzB,YAAY,CAChB,OAAgD;;YAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,CAAC;KAAA;IAED,YAAY,CAAC,OAA0C;QACrD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe,CACb,OAA+C;QAE/C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,mBAAmB,CAAC,OAA+C;QACjE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,YAAY,cAAmD;QApB/D,eAAU,GAAG,KAAK,CAAC;QAqBjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CAGF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nexport class MockGooglePayLibrary implements google.payments.api.PaymentsClient {\n readyToPay = false;\n\n async isReadyToPay(\n request: google.payments.api.IsReadyToPayRequest,\n ): Promise<google.payments.api.IsReadyToPayResponse> {\n return { result: this.readyToPay };\n }\n\n createButton(options: google.payments.api.ButtonOptions): HTMLElement {\n throw new Error('Method not implemented.');\n }\n loadPaymentData(\n request: google.payments.api.PaymentDataRequest,\n ): Promise<google.payments.api.PaymentData> {\n throw new Error('Method not implemented.');\n }\n prefetchPaymentData(request: google.payments.api.PaymentDataRequest): void {\n throw new Error('Method not implemented.');\n }\n\n constructor(paymentOptions?: google.payments.api.PaymentOptions) {\n this.paymentOptions = paymentOptions;\n }\n\n private paymentOptions?: google.payments.api.PaymentOptions;\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/camelcase */
3
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
4
3
  export var MockGrecaptchaMode;
5
4
  (function (MockGrecaptchaMode) {
@@ -8,14 +7,6 @@ export var MockGrecaptchaMode;
8
7
  MockGrecaptchaMode[MockGrecaptchaMode["Error"] = 2] = "Error";
9
8
  })(MockGrecaptchaMode || (MockGrecaptchaMode = {}));
10
9
  export class MockGrecaptcha {
11
- constructor(mode, addDelay = false) {
12
- this.renderCalled = false;
13
- this.executeCalled = false;
14
- this.resetCalled = false;
15
- this.getResponseCalled = false;
16
- this.mode = mode;
17
- this.addDelay = addDelay;
18
- }
19
10
  render(container, parameters, inherit) {
20
11
  var _a, _b, _c;
21
12
  this.callback = (_a = parameters === null || parameters === void 0 ? void 0 : parameters.callback) === null || _a === void 0 ? void 0 : _a.bind(this);
@@ -59,5 +50,13 @@ export class MockGrecaptcha {
59
50
  break;
60
51
  }
61
52
  }
53
+ constructor(mode, addDelay = false) {
54
+ this.renderCalled = false;
55
+ this.executeCalled = false;
56
+ this.resetCalled = false;
57
+ this.getResponseCalled = false;
58
+ this.mode = mode;
59
+ this.addDelay = addDelay;
60
+ }
62
61
  }
63
62
  //# sourceMappingURL=mock-grecaptcha.js.map