@adyen/adyen-web 6.34.1 → 6.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/cjs/adyen.css +7 -8
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +2649 -1958
  6. package/dist/es/adyen.css +7 -8
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  9. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  10. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  18. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  20. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  21. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  22. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  23. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  26. package/dist/es/components/Card/constants.js.map +1 -1
  27. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  28. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  29. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  30. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  31. package/dist/es/components/Donation/Donation.js +1 -1
  32. package/dist/es/components/Donation/Donation.js.map +1 -1
  33. package/dist/es/components/Donation/DonationCampaignService.js +2 -0
  34. package/dist/es/components/Donation/DonationCampaignService.js.map +1 -0
  35. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  36. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  37. package/dist/es/components/Donation/components/utils.js.map +1 -1
  38. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  39. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  40. package/dist/es/components/Iris/Iris.js +1 -1
  41. package/dist/es/components/Iris/Iris.js.map +1 -1
  42. package/dist/es/components/Iris/types.js.map +1 -1
  43. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  44. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  45. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  46. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  47. package/dist/es/components/internal/Address/Address.js +1 -1
  48. package/dist/es/components/internal/Address/Address.js.map +1 -1
  49. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  50. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  51. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  52. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  53. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  54. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  55. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  56. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  57. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  58. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  59. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  60. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  61. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  62. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  63. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  64. package/dist/es/components/internal/IssuerList/IssuerList.js +1 -1
  65. package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
  66. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  67. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  68. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  69. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  70. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  71. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  72. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  73. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  74. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  75. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  76. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  77. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  78. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  79. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  80. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  81. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  82. package/dist/es/components/internal/UIElement/utils.js +1 -1
  83. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  84. package/dist/es/core/Analytics/Analytics.js +1 -1
  85. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  86. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  87. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  88. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  89. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  90. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  91. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  92. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  93. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  94. package/dist/es/core/Services/sessions/constants.js +1 -1
  95. package/dist/es/core/Services/sessions/constants.js.map +1 -1
  96. package/dist/es/core/Services/sessions/fetch-donation-campaigns.js +2 -0
  97. package/dist/es/core/Services/sessions/fetch-donation-campaigns.js.map +1 -0
  98. package/dist/es/core/Services/sessions/make-donation.js +2 -0
  99. package/dist/es/core/Services/sessions/make-donation.js.map +1 -0
  100. package/dist/es/core/config.js +1 -1
  101. package/dist/es/core/config.js.map +1 -1
  102. package/dist/es/core/core.registry.js +1 -1
  103. package/dist/es/core/core.registry.js.map +1 -1
  104. package/dist/es/core/utils.js +1 -1
  105. package/dist/es/core/utils.js.map +1 -1
  106. package/dist/es/index.d.ts +2649 -1958
  107. package/dist/es/utils/createSdkData.js +1 -1
  108. package/dist/es/utils/createSdkData.js.map +1 -1
  109. package/dist/es-legacy/adyen.css +7 -8
  110. package/dist/es-legacy/adyen.css.map +1 -1
  111. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  112. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  113. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  114. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  115. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  116. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  117. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  118. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  119. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  120. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  121. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  122. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  123. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  124. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  125. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  126. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  127. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  128. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  129. package/dist/es-legacy/components/Card/constants.js.map +1 -1
  130. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  131. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  132. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  133. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  134. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  135. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  136. package/dist/es-legacy/components/Donation/DonationCampaignService.js +2 -0
  137. package/dist/es-legacy/components/Donation/DonationCampaignService.js.map +1 -0
  138. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  139. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  140. package/dist/es-legacy/components/Donation/components/utils.js.map +1 -1
  141. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  142. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  143. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  144. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  145. package/dist/es-legacy/components/Iris/types.js.map +1 -1
  146. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  147. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  148. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  149. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  150. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  151. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  152. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  153. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  154. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  155. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  156. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  157. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  158. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  159. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  160. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  161. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  162. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  163. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  164. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  165. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  166. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  167. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  168. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  169. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  170. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  171. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  172. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  173. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  174. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  175. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  176. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  177. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  178. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  179. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  180. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  181. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  182. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  183. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  184. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  185. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  186. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  187. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  188. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  189. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  190. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  191. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  192. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  193. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  194. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  195. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  196. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  197. package/dist/es-legacy/core/Services/sessions/constants.js +1 -1
  198. package/dist/es-legacy/core/Services/sessions/constants.js.map +1 -1
  199. package/dist/es-legacy/core/Services/sessions/fetch-donation-campaigns.js +2 -0
  200. package/dist/es-legacy/core/Services/sessions/fetch-donation-campaigns.js.map +1 -0
  201. package/dist/es-legacy/core/Services/sessions/make-donation.js +2 -0
  202. package/dist/es-legacy/core/Services/sessions/make-donation.js.map +1 -0
  203. package/dist/es-legacy/core/config.js +1 -1
  204. package/dist/es-legacy/core/config.js.map +1 -1
  205. package/dist/es-legacy/core/core.registry.js +1 -1
  206. package/dist/es-legacy/core/core.registry.js.map +1 -1
  207. package/dist/es-legacy/core/utils.js +1 -1
  208. package/dist/es-legacy/core/utils.js.map +1 -1
  209. package/dist/es-legacy/utils/createSdkData.js +1 -1
  210. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  211. package/package.json +21 -21
  212. package/styles/adyen.css +7 -8
  213. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  214. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  215. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  216. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
  217. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  218. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  219. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  220. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ApplePayService.js","sources":["../../../../../src/components/ApplePay/services/ApplePayService.ts"],"sourcesContent":["import { ApplePayConfiguration, ApplePayPaymentAuthorizationResult } from '../types';\n\nexport interface ApplePayServiceOptions {\n version: number;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onValidateMerchant: ApplePayConfiguration['onValidateMerchant'];\n onCouponCodeChanged?: ApplePayConfiguration['onCouponCodeChanged'];\n onPaymentMethodSelected?: ApplePayConfiguration['onPaymentMethodSelected'];\n onShippingMethodSelected?: ApplePayConfiguration['onShippingMethodSelected'];\n onShippingContactSelected?: ApplePayConfiguration['onShippingContactSelected'];\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n this.session.onvalidatemerchant = event => {\n void this.onvalidatemerchant(event, options.onValidateMerchant);\n };\n this.session.onpaymentauthorized = event => {\n void this.onpaymentauthorized(event, options.onPaymentAuthorized);\n };\n\n this.session.oncancel = event => {\n this.oncancel(event, options.onCancel);\n };\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => {\n void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n };\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => {\n void this.onshippingcontactselected(event, options.onShippingContactSelected);\n };\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => {\n void this.onshippingmethodselected(event, options.onShippingMethodSelected);\n };\n }\n\n if (typeof options.onCouponCodeChanged === 'function') {\n this.session.oncouponcodechanged = event => {\n void this.oncouponcodechanged(event, options.onCouponCodeChanged);\n };\n }\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778001-begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A promise implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/apple_pay_js_api/providing_merchant_validation}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant: ApplePayConfiguration['onValidateMerchant']) {\n return new Promise<unknown>((resolve, reject) => {\n void onValidateMerchant(resolve, reject, event.validationURL);\n })\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentAuthorized - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778020-onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentMethodSelected - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778013-onpaymentmethodselected}\n */\n onpaymentmethodselected(\n event: ApplePayJS.ApplePayPaymentMethodSelectedEvent,\n onPaymentMethodSelected: ApplePayServiceOptions['onPaymentMethodSelected']\n ) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingContact attribute.\n * @param onShippingContactSelected - A promise that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingcontactselected(\n event: ApplePayJS.ApplePayShippingContactSelectedEvent,\n onShippingContactSelected: ApplePayConfiguration['onShippingContactSelected']\n ) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingMethod attribute.\n * @param onShippingMethodSelected - A promise that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingmethodselected(\n event: ApplePayJS.ApplePayShippingMethodSelectedEvent,\n onShippingMethodSelected: ApplePayConfiguration['onShippingMethodSelected']\n ) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n oncouponcodechanged(event: ApplePayJS.ApplePayCouponCodeChangedEvent, onCouponCodeChanged: ApplePayConfiguration['onCouponCodeChanged']) {\n return new Promise((resolve, reject) => onCouponCodeChanged(resolve, reject, event))\n .then((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n })\n .catch((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event -\n * @param onCancel -\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778029-oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel: (event: ApplePayJS.Event) => void): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","begin","this","session","onvalidatemerchant","event","onValidateMerchant","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","options","onError","onpaymentauthorized","onPaymentAuthorized","result","completePayment","onpaymentmethodselected","onPaymentMethodSelected","paymentMethodUpdate","completePaymentMethodSelection","onshippingcontactselected","onShippingContactSelected","shippingContactUpdate","completeShippingContactSelection","onshippingmethodselected","onShippingMethodSelected","shippingMethodUpdate","completeShippingMethodSelection","oncouponcodechanged","onCouponCodeChanged","couponCodeUpdate","completeCouponCodeChange","oncancel","onCancel","constructor","paymentRequest","_define_property","ApplePaySession","version"],"mappings":"wHAkBA,MAAMA,EAiDFC,KAAAA,GACI,OAAOC,KAAKC,QAAQF,OACxB,CASAG,kBAAAA,CAAmBC,EAAiDC,GAChE,OAAO,IAAIC,QAAiB,CAACC,EAASC,KAC7BH,EAAmBE,EAASC,EAAQJ,EAAMK,iBAE9CC,KAAKC,IACFV,KAAKC,QAAQU,2BAA2BD,KAE3CE,MAAMC,IACHC,QAAQD,MAAMA,GACdb,KAAKC,QAAQc,QACbf,KAAKgB,QAAQC,QAAQJ,IAEjC,CAUAK,mBAAAA,CACIf,EACAgB,GAEA,OAAO,IAAId,QAAQ,CAACC,EAASC,IAAWY,EAAoBb,EAASC,EAAQJ,IACxEM,KAAMW,IACHpB,KAAKC,QAAQoB,gBAAgBD,KAEhCR,MAAOQ,IACJpB,KAAKC,QAAQoB,gBAAgBD,IAEzC,CAUAE,uBAAAA,CACInB,EACAoB,GAEA,OAAO,IAAIlB,QAAQ,CAACC,EAASC,IAAWgB,EAAwBjB,EAASC,EAAQJ,IAC5EM,KAAMe,IACHxB,KAAKC,QAAQwB,+BAA+BD,KAE/CZ,MAAOY,IACJxB,KAAKC,QAAQwB,+BAA+BD,IAExD,CASAE,yBAAAA,CACIvB,EACAwB,GAEA,OAAO,IAAItB,QAAQ,CAACC,EAASC,IAAWoB,EAA0BrB,EAASC,EAAQJ,IAC9EM,KAAM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yBAAyB3B,EAAOa,EAAQe,4BAIf,mBAAhCf,EAAQmB,sBACfnC,KAAKC,QAAQiC,oBAAsB/B,IAC1BH,KAAKkC,oBAAoB/B,EAAOa,EAAQmB,sBAGzD"}
1
+ {"version":3,"file":"ApplePayService.js","sources":["../../../../../src/components/ApplePay/services/ApplePayService.ts"],"sourcesContent":["import { ApplePayConfiguration, ApplePayPaymentAuthorizationResult } from '../types';\n\nexport interface ApplePayServiceOptions {\n version: number;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onValidateMerchant: ApplePayConfiguration['onValidateMerchant'];\n onCouponCodeChanged?: ApplePayConfiguration['onCouponCodeChanged'];\n onPaymentMethodSelected?: ApplePayConfiguration['onPaymentMethodSelected'];\n onShippingMethodSelected?: ApplePayConfiguration['onShippingMethodSelected'];\n onShippingContactSelected?: ApplePayConfiguration['onShippingContactSelected'];\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n this.session.onvalidatemerchant = event => {\n void this.onvalidatemerchant(event, options.onValidateMerchant);\n };\n this.session.onpaymentauthorized = event => {\n void this.onpaymentauthorized(event, options.onPaymentAuthorized);\n };\n\n this.session.oncancel = event => {\n this.oncancel(event, options.onCancel);\n };\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => {\n void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n };\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => {\n void this.onshippingcontactselected(event, options.onShippingContactSelected);\n };\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => {\n void this.onshippingmethodselected(event, options.onShippingMethodSelected);\n };\n }\n\n if (typeof options.onCouponCodeChanged === 'function') {\n this.session.oncouponcodechanged = event => {\n void this.oncouponcodechanged(event, options.onCouponCodeChanged);\n };\n }\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A function implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/onvalidatemerchant}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant: ApplePayConfiguration['onValidateMerchant']) {\n return new Promise<unknown>((resolve, reject) => {\n void onValidateMerchant(resolve, reject, event.validationURL);\n })\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - An ApplePayPaymentAuthorizedEvent object (contains payment).\n * @param onPaymentAuthorized - A function that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - An ApplePayPaymentMethodSelectedEvent object (contains paymentMethod).\n * @param onPaymentMethodSelected - A function that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/onpaymentmethodselected}\n */\n onpaymentmethodselected(\n event: ApplePayJS.ApplePayPaymentMethodSelectedEvent,\n onPaymentMethodSelected: ApplePayServiceOptions['onPaymentMethodSelected']\n ) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new shipping contact is selected.\n * The onshippingcontactselected function must resolve before the 30 second timeout\n * @param event - An ApplePayShippingContactSelectedEvent object (contains shippingContact).\n * @param onShippingContactSelected - A function that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/onshippingcontactselected}\n */\n onshippingcontactselected(\n event: ApplePayJS.ApplePayShippingContactSelectedEvent,\n onShippingContactSelected: ApplePayConfiguration['onShippingContactSelected']\n ) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new shipping method is selected.\n * The onshippingmethodselected function must resolve before the 30 second timeout\n * @param event - An ApplePayShippingMethodSelectedEvent object (contains shippingMethod).\n * @param onShippingMethodSelected - A function that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/onshippingmethodselected}\n */\n onshippingmethodselected(\n event: ApplePayJS.ApplePayShippingMethodSelectedEvent,\n onShippingMethodSelected: ApplePayConfiguration['onShippingMethodSelected']\n ) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n /**\n * An event handler called by the system when the user enters or updates a coupon code.\n * The oncouponcodechanged function must resolve before the 30 second timeout\n * @param event - An ApplePayCouponCodeChangedEvent object (contains couponCode).\n * @param onCouponCodeChanged - A function that will complete the entry or update of a coupon code with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/oncouponcodechanged}\n */\n oncouponcodechanged(event: ApplePayJS.ApplePayCouponCodeChangedEvent, onCouponCodeChanged: ApplePayConfiguration['onCouponCodeChanged']) {\n return new Promise((resolve, reject) => onCouponCodeChanged(resolve, reject, event))\n .then((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n })\n .catch((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event - An ApplePayJS.Event object\n * @param onCancel - A function that will complete the cancellation of the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel: (event: ApplePayJS.Event) => void): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","begin","this","session","onvalidatemerchant","event","onValidateMerchant","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","options","onError","onpaymentauthorized","onPaymentAuthorized","result","completePayment","onpaymentmethodselected","onPaymentMethodSelected","paymentMethodUpdate","completePaymentMethodSelection","onshippingcontactselected","onShippingContactSelected","shippingContactUpdate","completeShippingContactSelection","onshippingmethodselected","onShippingMethodSelected","shippingMethodUpdate","completeShippingMethodSelection","oncouponcodechanged","onCouponCodeChanged","couponCodeUpdate","completeCouponCodeChange","oncancel","onCancel","constructor","paymentRequest","_define_property","ApplePaySession","version"],"mappings":"wHAkBA,MAAMA,EAiDFC,KAAAA,GACI,OAAOC,KAAKC,QAAQF,OACxB,CASAG,kBAAAA,CAAmBC,EAAiDC,GAChE,OAAO,IAAIC,QAAiB,CAACC,EAASC,KAC7BH,EAAmBE,EAASC,EAAQJ,EAAMK,iBAE9CC,KAAKC,IACFV,KAAKC,QAAQU,2BAA2BD,KAE3CE,MAAMC,IACHC,QAAQD,MAAMA,GACdb,KAAKC,QAAQc,QACbf,KAAKgB,QAAQC,QAAQJ,IAEjC,CAUAK,mBAAAA,CACIf,EACAgB,GAEA,OAAO,IAAId,QAAQ,CAACC,EAASC,IAAWY,EAAoBb,EAASC,EAAQJ,IACxEM,KAAMW,IACHpB,KAAKC,QAAQoB,gBAAgBD,KAEhCR,MAAOQ,IACJpB,KAAKC,QAAQoB,gBAAgBD,IAEzC,CAUAE,uBAAAA,CACInB,EACAoB,GAEA,OAAO,IAAIlB,QAAQ,CAACC,EAASC,IAAWgB,EAAwBjB,EAASC,EAAQJ,IAC5EM,KAAMe,IACHxB,KAAKC,QAAQwB,+BAA+BD,KAE/CZ,MAAOY,IACJxB,KAAKC,QAAQwB,+BAA+BD,IAExD,CASAE,yBAAAA,CACIvB,EACAwB,GAEA,OAAO,IAAItB,QAAQ,CAACC,EAASC,IAAWoB,EAA0BrB,EAASC,EAAQJ,IAC9EM,KAAMmB,IACH5B,KAAKC,QA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Qe,4BAIf,mBAAhCf,EAAQmB,sBACfnC,KAAKC,QAAQiC,oBAAsB/B,IAC1BH,KAAKkC,oBAAoB/B,EAAOa,EAAQmB,sBAGzD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as n,useState as o,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{DATE_POLICY_REQUIRED as u,CVC_POLICY_REQUIRED as c,ENCRYPTED_CARD_NUMBER as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,cardInputFormatters as y,getRuleByNameAndMode as f}from"./validate.js";import b from"../../../internal/SecuredFields/binLookup/extensions.js";import h from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForSFP as N,getLayout as v,extractPropsForCardFields as A}from"./utils.js";import j from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as C}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as F}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as O,getFocusHandler as P,getAddressHandler as w}from"./handlers.js";import E from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as k}from"../../../internal/Address/validate.js";import x from"../../../../core/Context/useImage.js";import{getArrayDifferences as B}from"../../../../utils/arrayUtils.js";import R from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as I}from"../../../internal/Icon/constants.js";import D from"./useSRPanelForCardInputErrors.js";import V from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as q}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as M}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as _}from"../../../../core/Errors/constants.js";import{usePrevious as L}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as T,InfoEventType as K,UiTarget as U}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as H}from"../../../../core/Context/AmountProvider.js";function z(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function W(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){z(e,r,t[r])})}return e}function $(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}const G=l=>{var z,G,J,Q,X,Y,Z;const ee=t(null),re=t(!1),te=x(),ne=t(null),oe=e=>{ne.current=e},se=t({});Object.keys(se.current).length||l.setComponentRef(se.current);const ae=t(0),ie=t(!1),le=n(()=>new j(l.specifications),[l.specifications]),{amount:de}=H();se.current.sfp=ee;const[ue,ce]=o("ready"),[me,pe]=o({}),[ye,fe]=o(W({},l.holderNameRequired&&{holderName:!1})),[be,he]=o(W({},l.hasHolderName&&{holderName:null!==(z=null===(Q=l.data)||void 0===Q?void 0:Q.holderName)&&void 0!==z?z:""})),[Se,ge]=o(""),[Ne,ve]=o(!1),[Ae,je]=o(u),[Ce,Fe]=o(c),[Oe,Pe]=o(null),[we,Ee]=o([]),[ke,xe]=o(l.storedPaymentMethodId?l.brand:""),Be=l.billingAddressMode!==d.none&&l.billingAddressRequired,Re=S(l.billingAddressMode),Ie=t(Re&&(null===(Y=l.data)||void 0===Y||null===(X=Y.billingAddress)||void 0===X?void 0:X.country)),[De,Ve]=o(!1),[qe,Me]=o(Be&&null!==(G=null===(Z=l.data)||void 0===Z?void 0:Z.billingAddress)&&void 0!==G?G:null),[_e,Le]=o(!1),[Te,Ke]=o(""),[Ue,He]=o({value:null}),[ze,We]=o(null),[$e,Ge]=o("card"),[Je,Qe]=o(!1),{handleChangeFor:Xe,triggerValidation:Ye,data:Ze,valid:er,errors:rr,setSchema:tr,setData:nr,setValid:or,setErrors:sr}=h({schema:[],defaultData:l.data,formatters:y,rules:p}),ar=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:de}),ir=null===(J=l.showInstallmentAmounts)||void 0===J||J,lr="kr"===(null!=Oe?Oe:l.countryCode),dr=!!l.configuration.koreanAuthenticationRequired&&lr,ur=_e&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,cr=(e,r)=>{l.onFocus({fieldType:e,event:r})},mr=(e,r)=>{l.onBlur({fieldType:e,event:r})},pr=s(e=>{Ge(e.brand),l.onBrand(e)},[]),yr=P(ge,cr,mr),fr=()=>v(W({props:l,showKCP:dr,showBrazilianSSN:ur},l.billingAddressRequired&&{countrySpecificSchemas:le.getAddressSchemaForCountry(null==qe?void 0:qe.country),billingAddressRequiredFields:l.billingAddressRequiredFields})),br=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;We(r)},[]),hr=w(nr,or,sr),Sr=O(ie,ee,fr()),gr=s(e=>{Nr(e)},[Je,Qe]),Nr=e=>{e.status&&("loading"==e.status?Qe(!1):Qe(!0))},vr=n(()=>b(l,{sfp:ee},{dualBrandSelectElements:we,setDualBrandSelectElements:Ee,setSelectedBrandValue:xe,issuingCountryCode:Oe,setIssuingCountryCode:Pe},ae),[we,Oe]);se.current.showValidation=()=>{re.current=!0,null==Cr||Cr(),ee.current.showValidation(),Ye(["holderName","socialSecurityNumber","taxNumber"]),(null==ne?void 0:ne.current)&&ne.current.showValidation()},se.current.processBinLookupResponse=(e,r)=>{vr.processBinLookup(e,r)},se.current.setStatus=ce,a(()=>(se.current.setFocusOn=ee.current.setFocusOn,se.current.updateStyles=ee.current.updateStyles,se.current.handleUnsupportedCard=ee.current.handleUnsupportedCard,()=>{ee.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...ur?["socialSecurityNumber"]:[],...dr?["taxNumber"]:[],...Be?["billingAddress"]:[]];tr(e)},[l.hasHolderName,ur,dr]),a(()=>{var e;he($(W({},be),{holderName:null!==(e=Ze.holderName)&&void 0!==e?e:"",taxNumber:Ze.taxNumber})),Ke(Ze.socialSecurityNumber),Be&&Me(W({},Ze.billingAddress)),fe($(W({},ye),{holderName:!l.holderNameRequired||er.holderName,socialSecurityNumber:!!er.socialSecurityNumber&&er.socialSecurityNumber,taxNumber:!!er.taxNumber&&er.taxNumber,billingAddress:!!er.billingAddress&&er.billingAddress}));const r=!!rr.billingAddress&&Object.entries(rr.billingAddress).reduce((e,[,r])=>e||null!=r,!1);pe($(W({},me),{holderName:l.holderNameRequired&&rr.holderName?rr.holderName:null,socialSecurityNumber:ur&&rr.socialSecurityNumber?rr.socialSecurityNumber:null,taxNumber:dr&&rr.taxNumber?rr.taxNumber:null,billingAddress:Be&&r?rr.billingAddress:null}))},[Ze,er,rr]);const{sortedErrorList:Ar,previousSortedErrors:jr,clearSRPanel:Cr}=D({errors:me,props:l,isValidating:re,retrieveLayout:fr,specifications:le,billingAddress:qe,sfp:ee});a(()=>{if(Ar){const e=B(Ar,jr,"field");null==e||e.forEach(e=>{const r=new T({component:l.type,type:K.validationError,target:q(e.field),validationErrorCode:e.errorCode,validationErrorMessage:M(e.errorCode,_)});l.onSubmitAnalytics(r)})}},[Ar]),a(()=>{const e=!!ye.holderName,r=Ne,t=!Be||!!ye.billingAddress,n=!dr||!!ye.taxNumber&&!!ye.encryptedPassword,o=!ur||!!ye.socialSecurityNumber,s=r&&e&&t&&n&&o,a=ee.current.mapErrorsToValidationRuleResult(),i=W({},me,a);l.onChange({data:be,valid:ye,errors:i,isValid:s,billingAddress:qe,selectedBrandValue:ke,storePaymentMethod:De,socialSecurityNumber:Te,installments:Ue})},[be,ye,me,ke,De,Ue]),a(()=>{if(we.length>0&&we){const e=we.map(e=>e.id),r=e[0],t=e.toString(),n=new T({component:l.type,type:K.displayed,target:U.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(n)}},[we]);const Fr=L(ke);a(()=>{if((null==Fr?void 0:Fr.length)&&(null==ke?void 0:ke.length)){const e=new T({component:l.type,type:K.selected,target:U.dualBrandButton,brand:ke});l.onSubmitAnalytics(e)}},[ke]);const Or=l.storedPaymentMethodId?C:F;return e(r,null,e(i,$(W({ref:ee},N(l)),{styles:W({},l.styles),koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=f("holderName","blur"),t=(null==r?void 0:r(e.autoCompleteName,null))?e.autoCompleteName:null;return void(t&&(nr("holderName",t),or("holderName",!0),sr("holderName",null)))}var t;l.autoFocus&&ae.current>0&&"handleOnFieldValid"===(null==r?void 0:r.event)&&(null==r?void 0:r.fieldType)===m&&e.valid.encryptedCardNumber&&Sr(),he(W({},be,e.data)),pe(W({},me,(t=e.errors)?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})),fe(W({},ye,e.valid)),ve(e.isSfpValid),Fe(e.cvcPolicy),Le(e.showSocialSecurityNumber),je(e.expiryDatePolicy)},onBrand:pr,onFocus:yr,onStateUpdate:gr,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?br:null,render:({setRootNode:r,setFocusOn:t},n)=>{var o;return e("div",{ref:r,className:E({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${null!==(o=l.fundingSource)&&void 0!==o?o:"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===ue}),role:"form"},Je&&e(R,null),e(Or,$(W({},A(l)),{data:be,valid:ye,errors:me,handleChangeFor:Xe,focusedElement:Se,setFocusOn:t,sfpState:n,cvcPolicy:Ce,hasInstallments:ar,showAmountsInInstallments:ir,handleInstallments:He,brandsIcons:l.brandsIcons,formData:Ze,formErrors:rr,formValid:er,expiryDatePolicy:Ae,dualBrandSelectElements:we,extensions:vr,selectedBrandValue:ke,showKCP:dr,showBrazilianSSN:ur,socialSecurityNumber:Te,handleOnStoreDetails:Ve,setAddressRef:oe,billingAddress:qe,billingAddressValidationRules:Re&&k(Ie.current),partialAddressSchema:Re,handleAddress:hr,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:ze,onFieldFocusAnalytics:cr,onFieldBlurAnalytics:mr})))}})),l.fastlaneConfiguration&&e(V,$(W({},l.fastlaneConfiguration),{currentDetectedBrand:$e,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type})),Je&&l.showPayButton&&l.payButton({status:ue,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:te({imageFolder:"components/"})(`${I}lock`)}))};G.defaultProps=l;export{G as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as n,useState as o,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{DATE_POLICY_REQUIRED as u,CVC_POLICY_REQUIRED as c,ENCRYPTED_CARD_NUMBER as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,cardInputFormatters as y,getRuleByNameAndMode as f}from"./validate.js";import b from"../../../internal/SecuredFields/binLookup/extensions.js";import h from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForSFP as N,getLayout as v,requiresDualBrandSelection as A,extractPropsForCardFields as j}from"./utils.js";import C from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as F}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as O}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as P,getFocusHandler as w,getAddressHandler as E}from"./handlers.js";import k from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as x}from"../../../internal/Address/validate.js";import B from"../../../../core/Context/useImage.js";import{getArrayDifferences as R}from"../../../../utils/arrayUtils.js";import I from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as D}from"../../../internal/Icon/constants.js";import V from"./useSRPanelForCardInputErrors.js";import q from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as M}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as _}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as L}from"../../../../core/Errors/constants.js";import{usePrevious as T}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as K,InfoEventType as U,UiTarget as H}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as z}from"../../../../core/Context/AmountProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as W}from"../../constants.js";function $(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function G(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){$(e,r,t[r])})}return e}function J(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}const Q=l=>{var $,Q,X,Y,Z,ee,re;const te=t(null),ne=t(!1),oe=B(),se=t(null),ae=e=>{se.current=e},ie=t({});Object.keys(ie.current).length||l.setComponentRef(ie.current);const le=t(0),de=t(!1),ue=n(()=>new C(l.specifications),[l.specifications]),{amount:ce}=z();ie.current.sfp=te;const[me,pe]=o("ready"),[ye,fe]=o({}),[be,he]=o(G({},l.holderNameRequired&&{holderName:!1})),[Se,ge]=o(G({},l.hasHolderName&&{holderName:null!==($=null===(Y=l.data)||void 0===Y?void 0:Y.holderName)&&void 0!==$?$:""})),[Ne,ve]=o(""),[Ae,je]=o(!1),[Ce,Fe]=o(u),[Oe,Pe]=o(c),[we,Ee]=o(null),[ke,xe]=o([]),[Be,Re]=o(l.storedPaymentMethodId?l.brand:""),Ie=l.billingAddressMode!==d.none&&l.billingAddressRequired,De=S(l.billingAddressMode),Ve=t(De&&(null===(ee=l.data)||void 0===ee||null===(Z=ee.billingAddress)||void 0===Z?void 0:Z.country)),[qe,Me]=o(!1),[_e,Le]=o(Ie&&null!==(Q=null===(re=l.data)||void 0===re?void 0:re.billingAddress)&&void 0!==Q?Q:null),[Te,Ke]=o(!1),[Ue,He]=o(""),[ze,We]=o({value:null}),[$e,Ge]=o(null),[Je,Qe]=o("card"),[Xe,Ye]=o(!1),{handleChangeFor:Ze,triggerValidation:er,data:rr,valid:tr,errors:nr,setSchema:or,setData:sr,setValid:ar,setErrors:ir}=h({schema:[],defaultData:l.data,formatters:y,rules:p}),lr=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:ce}),dr=null===(X=l.showInstallmentAmounts)||void 0===X||X,ur="kr"===(null!=we?we:l.countryCode),cr=!!l.configuration.koreanAuthenticationRequired&&ur,mr=Te&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,pr=(e,r)=>{l.onFocus({fieldType:e,event:r})},yr=(e,r)=>{l.onBlur({fieldType:e,event:r})},fr=s(e=>{Qe(e.brand),l.onBrand(e)},[]),br=w(ve,pr,yr),hr=()=>v(G({props:l,showKCP:cr,showBrazilianSSN:mr},l.billingAddressRequired&&{countrySpecificSchemas:ue.getAddressSchemaForCountry(null==_e?void 0:_e.country),billingAddressRequiredFields:l.billingAddressRequiredFields})),Sr=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;Ge(r)},[]),gr=E(sr,ar,ir),Nr=P(de,te,hr()),vr=s(e=>{Ar(e)},[Xe,Ye]),Ar=e=>{e.status&&("loading"==e.status?Ye(!1):Ye(!0))},jr=n(()=>b(l,{sfp:te},{dualBrandSelectElements:ke,setDualBrandSelectElements:xe,setSelectedBrandValue:Re,issuingCountryCode:we,setIssuingCountryCode:Ee},le),[ke,we]);ie.current.showValidation=()=>{ne.current=!0,null==Or||Or(),te.current.showValidation(),er(["holderName","socialSecurityNumber","taxNumber"]),(null==se?void 0:se.current)&&se.current.showValidation()},ie.current.processBinLookupResponse=(e,r)=>{jr.processBinLookup(e,r)},ie.current.setStatus=pe,a(()=>(ie.current.setFocusOn=te.current.setFocusOn,ie.current.updateStyles=te.current.updateStyles,ie.current.handleUnsupportedCard=te.current.handleUnsupportedCard,()=>{te.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...mr?["socialSecurityNumber"]:[],...cr?["taxNumber"]:[],...Ie?["billingAddress"]:[]];or(e)},[l.hasHolderName,mr,cr]),a(()=>{var e;ge(J(G({},Se),{holderName:null!==(e=rr.holderName)&&void 0!==e?e:"",taxNumber:rr.taxNumber})),He(rr.socialSecurityNumber),Ie&&Le(G({},rr.billingAddress)),he(J(G({},be),{holderName:!l.holderNameRequired||tr.holderName,socialSecurityNumber:!!tr.socialSecurityNumber&&tr.socialSecurityNumber,taxNumber:!!tr.taxNumber&&tr.taxNumber,billingAddress:!!tr.billingAddress&&tr.billingAddress}));const r=!!nr.billingAddress&&Object.entries(nr.billingAddress).reduce((e,[,r])=>e||null!=r,!1);fe(J(G({},ye),{holderName:l.holderNameRequired&&nr.holderName?nr.holderName:null,socialSecurityNumber:mr&&nr.socialSecurityNumber?nr.socialSecurityNumber:null,taxNumber:cr&&nr.taxNumber?nr.taxNumber:null,billingAddress:Ie&&r?nr.billingAddress:null}))},[rr,tr,nr]);const{sortedErrorList:Cr,previousSortedErrors:Fr,clearSRPanel:Or}=V({errors:ye,props:l,isValidating:ne,retrieveLayout:hr,specifications:ue,billingAddress:_e,sfp:te});a(()=>{if(Cr){const e=R(Cr,Fr,"field");null==e||e.forEach(e=>{const r=new K({component:l.type,type:U.validationError,target:M(e.field),validationErrorCode:e.errorCode,validationErrorMessage:_(e.errorCode,L)});l.onSubmitAnalytics(r)})}},[Cr]),a(()=>{const e=!!be.holderName,r=Ae,t=!Ie||!!be.billingAddress,n=!cr||!!be.taxNumber&&!!be.encryptedPassword,o=!mr||!!be.socialSecurityNumber,s=r&&e&&t&&n&&o,a=te.current.mapErrorsToValidationRuleResult(),i=G({},ye,a);l.onChange({data:Se,valid:be,errors:i,isValid:s,billingAddress:_e,selectedBrandValue:Be,storePaymentMethod:qe,socialSecurityNumber:Ue,installments:ze})},[Se,be,ye,Be,qe,ze]),a(()=>{if(ke.length>0&&ke){const e=ke.map(e=>e.id),r=e[0],t=e.toString();if(!!ke&&A(W,ke,"id")){const e=new K({component:l.type,type:U.displayed,target:H.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(e)}}},[ke]);const Pr=T(Be);a(()=>{if((null==Pr?void 0:Pr.length)&&(null==Be?void 0:Be.length)){const e=new K({component:l.type,type:U.selected,target:H.dualBrandButton,brand:Be});l.onSubmitAnalytics(e)}},[Be]);const wr=l.storedPaymentMethodId?F:O;return e(r,null,e(i,J(G({ref:te},N(l)),{styles:G({},l.styles),koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=f("holderName","blur"),t=(null==r?void 0:r(e.autoCompleteName,null))?e.autoCompleteName:null;return void(t&&(sr("holderName",t),ar("holderName",!0),ir("holderName",null)))}var t;l.autoFocus&&le.current>0&&"handleOnFieldValid"===(null==r?void 0:r.event)&&(null==r?void 0:r.fieldType)===m&&e.valid.encryptedCardNumber&&Nr(),ge(G({},Se,e.data)),fe(G({},ye,(t=e.errors)?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})),he(G({},be,e.valid)),je(e.isSfpValid),Pe(e.cvcPolicy),Ke(e.showSocialSecurityNumber),Fe(e.expiryDatePolicy)},onBrand:fr,onFocus:br,onStateUpdate:vr,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?Sr:null,render:({setRootNode:r,setFocusOn:t},n)=>{var o;return e("div",{ref:r,className:k({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${null!==(o=l.fundingSource)&&void 0!==o?o:"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===me}),role:"form"},Xe&&e(I,null),e(wr,J(G({},j(l)),{data:Se,valid:be,errors:ye,handleChangeFor:Ze,focusedElement:Ne,setFocusOn:t,sfpState:n,cvcPolicy:Oe,hasInstallments:lr,showAmountsInInstallments:dr,handleInstallments:We,brandsIcons:l.brandsIcons,formData:rr,formErrors:nr,formValid:tr,expiryDatePolicy:Ce,dualBrandSelectElements:ke,extensions:jr,selectedBrandValue:Be,showKCP:cr,showBrazilianSSN:mr,socialSecurityNumber:Ue,handleOnStoreDetails:Me,setAddressRef:ae,billingAddress:_e,billingAddressValidationRules:De&&x(Ve.current),partialAddressSchema:De,handleAddress:gr,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:$e,onFieldFocusAnalytics:pr,onFieldBlurAnalytics:yr})))}})),l.fastlaneConfiguration&&e(q,J(G({},l.fastlaneConfiguration),{currentDetectedBrand:Je,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type})),Xe&&l.showPayButton&&l.payButton({status:me,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:oe({imageFolder:"components/"})(`${D}lock`)}))};Q.defaultProps=l;export{Q as default};
2
2
  //# sourceMappingURL=CardInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, shouldShowInstallmentsComponent } from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const { amount } = useAmount();\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data?.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? (props.data?.billingAddress ?? null) : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = !!props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn?.(sfState.autoCompleteName, null) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...mapSfpErrorsToCardInputErrors(sfState.errors) });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = !!valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? !!valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {showCardUIElements && <FormInstruction />}\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","_ref","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"06FAqCA,MAAMA,EAAaC,IAyGmBA,IAAAA,EAAAA,EAAAA,EArEWA,EAgBwBA,EAAAA,EAGmBA,EAtD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C,EAAAA,EAAAA,EAAAA,CAAAA,EACOrP,EAAMoP,uBAAqB,CAC/BE,qBAAsB1K,GACtBkH,SAAU9L,EAAM8L,SAChBX,kBAAmBnL,EAAMmL,kBACzBX,KAAMxK,EAAMwK,QAInB1F,IACG9E,EAAMuP,eACNvP,EAAMwP,UAAU,CACZlO,UACAmO,QAASzP,EAAM0P,0BAA4B,UAAY,YACvDC,KAAMvP,GAAS,CAAEwP,YAAa,eAAxBxP,CAAyC,GAAGyP,aAMtE9P,EAAU+P,aAAeA"}
1
+ {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse, DualBrandSelectElement } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport {\n handlePartialAddressMode,\n extractPropsForCardFields,\n extractPropsForSFP,\n getLayout,\n shouldShowInstallmentsComponent,\n requiresDualBrandSelection\n} from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../constants';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const { amount } = useAmount();\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data?.holderName ?? '' })\n });\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState<DualBrandSelectElement[]>([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? (props.data?.billingAddress ?? null) : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = !!props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\n }, []);\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn?.(sfState.autoCompleteName, null) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...mapSfpErrorsToCardInputErrors(sfState.errors) });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = !!valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? !!valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr: string[] = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const showDualBrandSelector = dualBrandSelectElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandSelectElements, 'id')\n : false;\n\n // Only send analytics event about displaying dualBrand selector for countries that need to show a selection mechanism\n if (showDualBrandSelector) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState: SFPState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {showCardUIElements && <FormInstruction />}\n\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","_object_spread","holderNameRequired","holderName","data","setData","hasHolderName","_ref","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","_object_spread_props","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"yhGA6CA,MAAMA,EAAaC,IAyGmBA,IAAAA,EAAAA,EAAAA,EArEWA,EAgBwBA,EAAAA,GAGmBA,GAtDxF,MAAMC,GAAMC,EAA8B,MACpCC,GAAeD,GAAO,GACtBE,GAAWC,IAEXC,GAAoBJ,EAAO,MAC3BK,GAAgBC,IAClBF,GAAkBG,QAAUD,GAG1BE,GAAeR,EAAqB,IAErCS,OAAOC,KAAKF,GAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,GAAaD,SAGvC,MAAMM,GAAkBb,EAAO,GACzBc,GAAgBd,GAAO,GAEvBe,GAAiBC,EAAQ,IAAM,IAAIC,EAAenB,EAAMiB,gBAAiB,CAACjB,EAAMiB,kBAEhFG,OAAEA,IAAWC,IAGnBX,GAAaD,QAAQR,IAAMA,GAK3B,MAAOqB,GAAQC,IAAaC,EAAS,UAE9BC,GAAQC,IAAaF,EAA8B,CAAA,IACnDG,GAAOC,IAAYJ,EAA8BK,EAAA,CAAA,EAChD7B,EAAM8B,oBAAsB,CAAEC,YAAY,MAE3CC,GAAMC,IAAWT,EAA6BK,EAAA,CAAA,EAC7C7B,EAAMkC,eAAiB,CAAEH,WAAkC,QAAxBI,UAAEnC,EAAAA,EAAMgC,YAANhC,IAAAA,OAAAA,EAAAA,EAAY+B,kBAAU,IAAAI,EAAAA,EAAI,OAGhEC,GAAgBC,IAAqBb,EAAS,KAC9Cc,GAAYC,IAAiBf,GAAS,IACtCgB,GAAkBC,IAAuBjB,EAASkB,IAClDC,GAAWC,IAAgBpB,EAASqB,IACpCC,GAAoBC,IAAyBvB,EAAiB,OAE9DwB,GAAyBC,IAA8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AyBA,GACzByF,WAAYA,GACZvF,mBAAoBA,GAEpBsD,QAASA,GAETG,iBAAkBA,GAClBtC,qBAAsBA,GAEtB2K,qBAAsB/K,GAEtB1D,cAAeA,GACfuD,eAAgBA,GAChBmL,8BAA+BtL,IAAwBuL,EAAiCrL,GAAsBpD,SAC9GkD,qBAAsBA,GACtBuE,cAAeA,GACfiH,gBAAiBnP,EAAMmP,gBACvBC,kBAAmBpP,EAAMoP,kBACzBC,wBAAyBrP,EAAMqP,wBAE/B3K,gBAAiBA,GAEjBmC,sBAAuBA,GACvBM,qBAAsBA,WAMrCnH,EAAMsP,uBACHrC,EAACsC,EAAAA,EAAAA,EAAAA,CAAAA,EACOvP,EAAMsP,uBAAqB,CAC/BE,qBAAsB5K,GACtBkH,SAAU9L,EAAM8L,SAChBX,kBAAmBnL,EAAMmL,kBACzBX,KAAMxK,EAAMwK,QAInB1F,IACG9E,EAAMyP,eACNzP,EAAM0P,UAAU,CACZpO,UACAqO,QAAS3P,EAAM4P,0BAA4B,UAAY,YACvDC,KAAMzP,GAAS,CAAE0P,YAAa,eAAxB1P,CAAyC,GAAG2P,aAMtEhQ,EAAUiQ,aAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as n}from"../utils.js";import e from"../../../../../core/Context/useImage.js";import{BrandImage as o}from"../../../../internal/BrandImage/BrandImage.js";function t({brand:t,brandsConfiguration:c={}}){var d,i;const m=e(),s="card"===t?"nocard":t,u=null!==(d=null===(i=c[t])||void 0===i?void 0:i.icon)&&void 0!==d?d:a(s,m);return r(o,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:n(t),src:u})}export{t as default};
1
+ import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as n}from"../utils.js";import e from"../../../../../core/Context/useImage.js";import{BrandImage as o}from"../../../../internal/BrandImage/BrandImage.js";function t({brand:t,brandsConfiguration:c}){var d,i;const m=e(),s="card"===t?"nocard":t,l=null!==(d=null==c||null===(i=c[t])||void 0===i?void 0:i.icon)&&void 0!==d?d:a(s,m);return r(o,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:n(t),src:l})}export{t as default};
2
2
  //# sourceMappingURL=BrandIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration = {} }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n const imgClassName = `adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon`;\n\n return <BrandImage imgClassName={imgClassName} alt={getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","imageName","imageUrl","icon","_ref","getCardImageUrl","h","BrandImage","imgClassName","alt","getFullBrandName","src"],"mappings":"oRAMe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,EAAsB,CAAA,UAG5CA,EAFjB,MAAMC,EAAWC,IACXC,EAAsB,SAAVJ,EAAmB,SAAWA,EAC1CK,EAA2C,QAA3CA,EAAqC,QAA1BJ,EAAAA,EAAoBD,UAApBC,IAAAA,OAAAA,EAAAA,EAA4BK,YAAI,IAAAC,EAAAA,EAAIC,EAAgBJ,EAAWF,GAGhF,OAAOO,EAACC,EAAAA,CAAWC,aAFE,8EAE0BC,IAAKC,EAAiBb,GAAQc,IAAKT,GACtF"}
1
+ {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n const imgClassName = `adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon`;\n\n return <BrandImage imgClassName={imgClassName} alt={getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","imageName","imageUrl","icon","_ref","getCardImageUrl","h","BrandImage","imgClassName","alt","getFullBrandName","src"],"mappings":"oRAMe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,UAGtBA,EAFjB,MAAMC,EAAWC,IACXC,EAAsB,SAAVJ,EAAmB,SAAWA,EAC1CK,EAA6C,QAA7CA,EAAWJ,SAA4B,QAA5BA,EAAAA,EAAsBD,UAAtBC,IAAAA,SAAAA,EAA8BK,YAAI,IAAAC,EAAAA,EAAIC,EAAgBJ,EAAWF,GAGlF,OAAOO,EAACC,EAAAA,CAAWC,aAFE,8EAE0BC,IAAKC,EAAiBb,GAAQc,IAAKT,GACtF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import o from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as c,DATE_POLICY_HIDDEN as n,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:x,errors:C,focusedElement:f,hasCVC:b,cvcPolicy:_,expiryDatePolicy:v,onFocusField:g,showBrandIcon:E,valid:h,showContextualElement:F}){const{i18n:N}=d(),j=(e,r)=>e[r]?N.get(e[r]):null,B=null==p?void 0:p.filter(e=>!(null==i?void 0:i.includes(e.name))),D="amex"===m,V=D?N.get("creditCard.securityCode.contextualText.4digits"):N.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:j(C,c),focused:f===c,isValid:!!h.encryptedCardNumber,label:N.get("creditCard.cardNumber.label"),onFocusField:g,filled:!!C.encryptedCardNumber||!!h.encryptedCardNumber,showBrandIcon:E,dualBrandingElements:x}),e(u,{activeBrand:m,brands:B}),e("div",{className:o("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===n})},e(a,{classNameModifiers:["col-50"],error:j(C,l),focused:f===l,isValid:!!h.encryptedExpiryMonth&&!!h.encryptedExpiryYear,filled:!!C.encryptedExpiryDate||!!h.encryptedExpiryYear,label:N.get("creditCard.expiryDate.label"),onFocusField:g,expiryDatePolicy:v,showContextualElement:F,contextualText:N.get("creditCard.expiryDate.contextualText")}),b&&e(t,{classNameModifiers:["col-50"],error:j(C,s),focused:f===s,cvcPolicy:_,isValid:!!h.encryptedSecurityCode,filled:!!C.encryptedSecurityCode||!!h.encryptedSecurityCode,label:N.get("creditCard.securityCode.label"),onFocusField:g,frontCVC:D,showContextualElement:F,contextualText:V})))}export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as o,DATE_POLICY_HIDDEN as l,ENCRYPTED_EXPIRY_DATE as c,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:v,expiryDatePolicy:h,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>e[r]?j.get(e[r]):null,D=null==p?void 0:p.filter(e=>!(null==i?void 0:i.includes(e.name))),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:V(b,o),focused:g===o,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":h===l})},e(a,{classNameModifiers:["col-50"],error:V(b,c),focused:g===c,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:h,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],error:V(b,s),focused:g===s,cvcPolicy:v,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
2
2
  //# sourceMappingURL=CardFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"u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BAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQ6C,GACxBlB,QAAS1B,IAAmB4C,EAC5B1C,UAAWA,EACXyB,UAAWrB,EAAMuC,sBACjBf,SAAU/B,EAAO8C,yBAA2BvC,EAAMuC,sBAClDhB,MAAOrB,EAAKI,IAAI,iCAChBR,aAAcA,EACd0C,SAAU5B,EACVX,sBAAuBA,EACvBmC,eAAgBvB,KAMxC"}
1
+ {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n selectedBrandValue,\n dualBrandingChangeHandler,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n selectedBrandValue={selectedBrandValue}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","selectedBrandValue","dualBrandingChangeHandler","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"uiBAiBe,SAASA,GAAWC,MAC/BA,EAAKC,YACLA,EAAWC,oBACXA,EAAmBC,qBACnBA,EAAoBC,mBACpBA,EAAkBC,0BAClBA,EAAyBC,OACzBA,EAAMC,eACNA,EAAcC,OACdA,EAAMC,UACNA,EAASC,iBACTA,EAAgBC,aAChBA,EAAYC,cACZA,EAAaC,MACbA,EAAKC,sBACLA,IAEA,MAAMC,KAAEA,GAASC,IAEXC,EAAW,CAACX,EAAQY,IACfZ,EAAOY,GAAaH,EAAKI,IAAIb,EAAOY,IAAc,KAIvDE,EAAgBnB,eAAAA,EAAaoB,OAAOpB,KAAgBqB,aAAAA,EAAAA,EAA8BC,SAAStB,EAAYuB,QACvGC,EAAmB,SAAVzB,EACT0B,EAAoBD,EACpBV,EAAKI,IAAI,kDACTJ,EAAKI,IAAI,kDAEf,OACIQ,EAACC,MAAAA,CAAIC,UAAU,8BACXF,EAACG,EAAAA,CACG9B,MAAOA,EACPE,oBAAqBA,EACrB6B,MAAOd,EAASX,EAAQ0B,GACxBC,QAAS1B,IAAmByB,EAC5BE,UAAWrB,EAAMsB,oBACjBC,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACd0B,SAAU/B,EAAO6B,uBAAyBtB,EAAMsB,oBAChDvB,cAAeA,EACfT,qBAAsBA,EACtBC,mBAAoBA,EACpBC,0BAA2BA,IAG/BsB,EAACW,EAAAA,CAAgBC,YAAavC,EAAOwC,OAAQpB,IAE7CO,EAACC,MAAAA,CACGC,UAAWY,EAAW,gCAAiC,CACnD,yDAA0D/B,IAAqBgC,KAGnFf,EAACgB,EAAAA,CACGC,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQuC,GACxBZ,QAAS1B,IAAmBsC,EAC5BX,UAAWrB,EAAMiC,wBAA0BjC,EAAMkC,oBACjDV,SAAU/B,EAAO0C,uBAAyBnC,EAAMkC,oBAChDX,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACdD,iBAAkBA,EAClBI,sBAAuBA,EACvBmC,eAAgBlC,EAAKI,IAAI,0CAG5BX,GACGmB,EAACuB,EAAAA,CACGN,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQ6C,GACxBlB,QAAS1B,IAAmB4C,EAC5B1C,UAAWA,EACXyB,UAAWrB,EAAMuC,sBACjBf,SAAU/B,EAAO8C,yBAA2BvC,EAAMuC,sBAClDhB,MAAOrB,EAAKI,IAAI,iCAChBR,aAAcA,EACd0C,SAAU5B,EACVX,sBAAuBA,EACvBmC,eAAgBvB,KAMxC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import s from"./CardFields.js";import a from"./KCPAuthentication.js";import l from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import o from"../../../../internal/StoreDetails/StoreDetails.js";import i from"../../../../internal/Address/Address.js";import n from"./CardHolderName.js";import t from"./Installments/Installments.js";import d from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";import c from"../../../../internal/FormFields/RadioGroupExtended/RadioGroupExtended.js";import{mustHandleDualBrandingAccordingToEURegulations as u,mapDualBrandButtons as m}from"../utils.js";import p from"../../../../internal/FormFields/Fieldset/Fieldset.js";import{useCoreContext as h}from"../../../../../core/Context/CoreProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as b}from"../../../constants.js";const F=({data:F,valid:y,errors:N,handleChangeFor:S,sfpState:f,setFocusOn:A,cvcPolicy:C,focusedElement:g,hasInstallments:x,handleInstallments:B,showAmountsInInstallments:w,brandsIcons:v,formData:j,formErrors:D,formValid:I,expiryDatePolicy:E,dualBrandSelectElements:P,extensions:k,selectedBrandValue:O,showKCP:R,showBrazilianSSN:q,socialSecurityNumber:V,handleOnStoreDetails:M,billingAddress:T,handleAddress:L,setAddressRef:_,partialAddressSchema:z,onAddressLookup:H,onAddressSelected:G,addressSearchDebounceMs:K,billingAddressRequired:W,billingAddressRequiredFields:$,billingAddressAllowedCountries:J,billingAddressValidationRules:Q=null,brandsConfiguration:U,showStoreDetailsCheckbox:X,hasCVC:Y,hasHolderName:Z,holderNameRequired:ee,installmentOptions:re,placeholders:se,positionHolderNameOnTop:ae,showBrandIcon:le,showContextualElement:oe,iOSFocusedField:ie,disclaimerMessage:ne,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de})=>{const{i18n:ce}=h(),ue=e(n,{required:ee,placeholder:se.holderName,value:j.holderName,error:!!D.holderName&&ee,isValid:!!I.holderName,onBlur:S("holderName","blur"),onInput:S("holderName","input"),disabled:ie&&"holderName"!==ie,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),me=u(b,P,"id");return e(r,{status:f.status},Z&&ae&&ue,e(s,{showBrandIcon:le,showContextualElement:oe,brand:f.brand,brandsIcons:v,brandsConfiguration:U,focusedElement:g,onFocusField:A,hasCVC:Y,cvcPolicy:C,expiryDatePolicy:E,errors:f.errors,valid:f.valid,dualBrandingElements:P.length>0&&P}),Z&&!ae&&ue,me&&P.length>0&&P&&e(p,{classNameModifiers:["dual-brand-switcher"],label:ce.get("creditCard.dualBrand.title")},e("p",{className:"adyen-checkout-form-instruction"},ce.get("creditCard.dualBrand.description")),e(c,{name:"dualBrandSwitcher",value:O,items:m(P,U),onChange:k.handleDualBrandSelection,required:!0,showSelectedTick:!0})),R&&e(a,{onFocusField:A,focusedElement:g,encryptedPasswordState:{data:f.encryptedPassword,valid:!!f.valid&&f.valid.encryptedPassword,errors:!!f.errors&&f.errors.encryptedPassword},value:F.taxNumber,error:!!N.taxNumber,isValid:!!y.taxNumber,onBlur:S("taxNumber","blur"),onInput:S("taxNumber","input"),disabled:ie&&"kcpTaxNumberOrDOB"!==ie,placeholder:se.taxNumber,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),q&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(l,{onBlur:S("socialSecurityNumber","blur"),onInput:S("socialSecurityNumber","input"),error:null==N?void 0:N.socialSecurityNumber,valid:null==y?void 0:y.socialSecurityNumber,data:V,required:!0,disabled:ie&&"socialSecurityNumber"!==ie,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de})),X&&e(o,{onChange:M}),x&&e(t,{brand:f.brand,installmentOptions:re,onChange:B,type:w?"amount":"months"}),W&&e(i,{label:"billingAddress",data:T,onChange:L,allowedCountries:J,requiredFields:$,setComponentRef:_,validationRules:Q,specifications:z,iOSFocusedField:ie,onAddressLookup:H,showContextualElement:oe,onAddressSelected:G,addressSearchDebounceMs:K,onFieldFocusAnalytics:te,onFieldBlurAnalytics:de}),ne&&e(d,{message:ne.message.replace("%{linkText}",`%#${ne.linkText}%#`),urls:[ne.link]}))};export{F as CardFieldsWrapper};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import l from"./CardFields.js";import s from"./KCPAuthentication.js";import a from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import n from"../../../../internal/StoreDetails/StoreDetails.js";import o from"../../../../internal/Address/Address.js";import i from"./CardHolderName.js";import d from"./Installments/Installments.js";import t from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const u=({data:u,valid:c,errors:m,handleChangeFor:p,sfpState:h,setFocusOn:b,cvcPolicy:y,focusedElement:N,hasInstallments:A,handleInstallments:F,showAmountsInInstallments:S,brandsIcons:g,formData:f,formErrors:C,formValid:B,expiryDatePolicy:x,dualBrandSelectElements:v,extensions:w,selectedBrandValue:D,showKCP:I,showBrazilianSSN:j,socialSecurityNumber:E,handleOnStoreDetails:P,billingAddress:O,handleAddress:k,setAddressRef:V,partialAddressSchema:R,onAddressLookup:q,onAddressSelected:M,addressSearchDebounceMs:H,billingAddressRequired:L,billingAddressRequiredFields:T,billingAddressAllowedCountries:_,billingAddressValidationRules:z=null,brandsConfiguration:K,showStoreDetailsCheckbox:W,hasCVC:$,hasHolderName:G,holderNameRequired:J,installmentOptions:Q,placeholders:U,positionHolderNameOnTop:X,showBrandIcon:Y,showContextualElement:Z,iOSFocusedField:ee,disclaimerMessage:re,onFieldFocusAnalytics:le,onFieldBlurAnalytics:se})=>{var ae;const ne=e(i,{required:J,placeholder:U.holderName,value:f.holderName,error:!!C.holderName&&J,isValid:!!B.holderName,onBlur:p("holderName","blur"),onInput:p("holderName","input"),disabled:ee&&"holderName"!==ee,onFieldFocusAnalytics:le,onFieldBlurAnalytics:se});return e(r,{status:h.status},G&&X&&ne,e(l,{showBrandIcon:Y,showContextualElement:Z,brand:null!==(ae=h.brand)&&void 0!==ae?ae:"card",brandsIcons:g,brandsConfiguration:K,focusedElement:N,onFocusField:b,hasCVC:$,cvcPolicy:y,expiryDatePolicy:x,errors:h.errors,valid:h.valid,dualBrandingElements:v.length>0&&v,dualBrandingChangeHandler:w.handleDualBrandSelection,selectedBrandValue:D}),G&&!X&&ne,I&&e(s,{onFocusField:b,focusedElement:N,encryptedPasswordState:{data:h.encryptedPassword,valid:!!h.valid&&h.valid.encryptedPassword,errors:!!h.errors&&h.errors.encryptedPassword},value:u.taxNumber,error:!!m.taxNumber,isValid:!!c.taxNumber,onBlur:p("taxNumber","blur"),onInput:p("taxNumber","input"),disabled:ee&&"kcpTaxNumberOrDOB"!==ee,placeholder:U.taxNumber,onFieldFocusAnalytics:le,onFieldBlurAnalytics:se}),j&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(a,{onBlur:p("socialSecurityNumber","blur"),onInput:p("socialSecurityNumber","input"),error:null==m?void 0:m.socialSecurityNumber,valid:null==c?void 0:c.socialSecurityNumber,data:E,required:!0,disabled:ee&&"socialSecurityNumber"!==ee,onFieldFocusAnalytics:le,onFieldBlurAnalytics:se})),W&&e(n,{onChange:P}),A&&e(d,{brand:h.brand,installmentOptions:Q,onChange:F,type:S?"amount":"months"}),L&&e(o,{label:"billingAddress",data:O,onChange:k,allowedCountries:_,requiredFields:T,setComponentRef:V,validationRules:z,specifications:R,iOSFocusedField:ee,onAddressLookup:q,showContextualElement:Z,onAddressSelected:M,addressSearchDebounceMs:H,onFieldFocusAnalytics:le,onFieldBlurAnalytics:se}),re&&e(t,{message:re.message.replace("%{linkText}",`%#${re.linkText}%#`),urls:[re.link]}))};export{u as CardFieldsWrapper};
2
2
  //# sourceMappingURL=CardFieldsWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\nimport RadioGroupExtended from '../../../../internal/FormFields/RadioGroupExtended';\nimport { mapDualBrandButtons, mustHandleDualBrandingAccordingToEURegulations } from '../utils';\nimport Fieldset from '../../../../internal/FormFields/Fieldset';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../constants';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n showStoreDetailsCheckbox,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const { i18n } = useCoreContext();\n\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n // Only if the brands in DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM are present in the binLookup response should we handle dual branding based on EU regulations\n const showDualBrandSelectElements = mustHandleDualBrandingAccordingToEURegulations(\n DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM,\n dualBrandSelectElements,\n 'id'\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showDualBrandSelectElements && dualBrandSelectElements.length > 0 && dualBrandSelectElements && (\n <Fieldset classNameModifiers={['dual-brand-switcher']} label={i18n.get('creditCard.dualBrand.title')}>\n <p className={'adyen-checkout-form-instruction'}>{i18n.get('creditCard.dualBrand.description')}</p>\n <RadioGroupExtended\n name={'dualBrandSwitcher'}\n value={selectedBrandValue} // Set which button is in a selected (checked) state\n items={mapDualBrandButtons(dualBrandSelectElements, brandsConfiguration)}\n onChange={extensions.handleDualBrandSelection}\n required={true}\n showSelectedTick={true}\n />\n </Fieldset>\n )}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {showStoreDetailsCheckbox && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","i18n","useCoreContext","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","showDualBrandSelectElements","mustHandleDualBrandingAccordingToEURegulations","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","Fieldset","classNameModifiers","label","get","p","className","RadioGroupExtended","name","items","mapDualBrandButtons","onChange","handleDualBrandSelection","showSelectedTick","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","SocialSecurityNumberBrazil","StoreDetails","Installments","type","Address","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"0+BAgBO,MAAMA,EAAoB,EAG7BC,OACAC,QACAC,SACAC,kBACAC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BAEAC,cACAC,WACAC,aACAC,YACAC,mBACAC,0BACAC,aACAC,qBAEAC,UAEAC,mBACAC,uBAEAC,uBAEAC,iBACAC,gBACAC,gBACAC,uBACAC,kBACAC,oBACAC,0BAEAC,yBACAC,+BACAC,iCACAC,gCAAgC,KAChCC,sBACAC,2BACAC,SACAC,gBACAC,sBACAC,sBACAC,gBACAC,2BAEAC,iBACAC,yBAEAC,mBACAC,qBAEAC,yBACAC,4BAEA,MAAMC,KAAEA,IAASC,IAEXC,GACFC,EAACC,EAAAA,CACGC,SAAUf,GACVgB,YAAad,GAAae,WAC1BC,MAAO5C,EAAS2C,WAChBE,QAAS5C,EAAW0C,YAAcjB,GAClCoB,UAAW5C,EAAUyC,WACrBI,OAAQxD,EAAgB,aAAc,QACtCyD,QAASzD,EAAgB,aAA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EAACsC,MAAAA,CAAIZ,UAAU,8CACX1B,EAACuC,EAAAA,CACG/B,OAAQxD,EAAgB,uBAAwB,QAChDyD,QAASzD,EAAgB,uBAAwB,SACjDsD,MAAOvD,aAAAA,EAAAA,EAAQmB,qBACfpB,MAAOA,aAAAA,EAAAA,EAAOoB,qBACdrB,KAAMqB,EACNgC,UAAU,EACVQ,SAAUjB,IAAuC,yBAApBA,GAC7BE,sBAAuBA,GACvBC,qBAAsBA,MAKjCZ,GAA4BgB,EAACwC,EAAAA,CAAaT,SAAU5D,IAEpDd,GACG2C,EAACyC,EAAAA,CACGxB,MAAOhE,EAASgE,MAChB7B,mBAAoBA,GACpB2C,SAAUzE,EACVoF,KAAMnF,EAA4B,SAAW,WAIpDoB,GACGqB,EAAC2C,EAAAA,CACGpB,MAAM,iBACN1E,KAAMuB,EACN2D,SAAU1D,EACVuE,iBAAkB/D,EAClBgE,eAAgBjE,EAChBkE,gBAAiBxE,EACjByE,gBAAiBjE,EACjBkE,eAAgBzE,EAChBkB,gBAAiBA,GACjBjB,gBAAiBA,EACjBgB,sBAAuBA,GACvBf,kBAAmBA,EACnBC,wBAAyBA,EACzBiB,sBAAuBA,GACvBC,qBAAsBA,KAI7BF,IACGM,EAACiD,EAAAA,CACGC,QAASxD,GAAkBwD,QAAQC,QAAQ,cAAe,KAAKzD,GAAkB0D,cACjFC,KAAM,CAAC3D,GAAkB4D"}
1
+ {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n showStoreDetailsCheckbox,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand ?? 'card'}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n dualBrandingChangeHandler={extensions.handleDualBrandSelection}\n selectedBrandValue={selectedBrandValue}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {showStoreDetailsCheckbox && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","dualBrandingChangeHandler","handleDualBrandSelection","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","className","SocialSecurityNumberBrazil","StoreDetails","onChange","Installments","type","Address","label","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"ykBAWO,MAAMA,EAAoB,EAG7BC,OACAC,QACAC,SACAC,kBACAC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BAEAC,cACAC,WACAC,aACAC,YACAC,mBACAC,0BACAC,aACAC,qBAEAC,UAEAC,mBACAC,uBAEAC,uBAEAC,iBACAC,gBACAC,gBACAC,uBACAC,kBACAC,oBACAC,0BAEAC,yBACAC,+BACAC,iCACAC,gCAAgC,KAChCC,sBACAC,2BACAC,SACAC,gBACAC,qBACAC,qBACAC,eACAC,0BAEAC,gBACAC,wBAEAC,mBACAC,qBAEAC,yBACAC,4BAwBmB3C,IAAAA,GAtBnB,MAAM4C,GACFC,EAACC,EAAAA,CACGC,SAAUb,EACVc,YAAaZ,EAAaa,WAC1BC,MAAO1C,EAASyC,WAChBE,QAAS1C,EAAWwC,YAAcf,EAClCkB,UAAW1C,EAAUuC,WACrBI,OAAQtD,EAAgB,aAAc,QACtCuD,QAASvD,EAAgB,aAAc,SACvCwD,SAAUf,IAAuC,eAApBA,GAC7BE,sBAAuBA,GACvBC,qBAAsBA,KAI9B,OACIE,EAACW,EAAAA,CAAeC,OAAQzD,EAASyD,QAC5BxB,GAAiBI,GAA2BO,GAE7CC,EAACa,EAAAA,CACGpB,cAAeA,EACfC,sBAAuBA,EACvBoB,MAAqB,QAAd3D,GAAAA,EAAS2D,iBAAT3D,GAAAA,GAAkB,OACzBO,YAAaA,EACbuB,oBAAqBA,EACrB3B,eAAgBA,EAChByD,aAAc3D,EACd+B,OAAQA,EACR9B,UAAWA,EACXS,iBAAkBA,EAClBb,OAAQE,EAASF,OACjBD,MAAOG,EAASH,MAChBgE,qBAAsBjD,EAAwBkD,OAAS,GAAKlD,EAC5DmD,0BAA2BlD,EAAWmD,yBACtClD,mBAAoBA,IAGvBmB,IAAkBI,GAA2BO,GAE7C7B,GACG8B,EAACoB,EAAAA,CACGL,aAAc3D,EACdE,eAAgBA,EAChB+D,uB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@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../../_virtual/index.js";import n from"./BrandIcon.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as o}from"../../../../../core/Context/CoreProvider.js";import i from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as d}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as t}from"./FieldLabelAlternative.js";function c(c){const{i18n:s}=o(),{error:l="",isValid:u=!1,onFocusField:_=()=>{},dualBrandingElements:m}=c;return e(a,{label:c.label,focused:c.focused,filled:c.filled,classNameModifiers:["cardNumber"],onFocusField:()=>_(d),errorMessage:l,isValid:u,dir:"ltr",name:d,showValidIcon:!1,i18n:s,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:t,onInputContainerClick:()=>{_(d)}},e(i,{encryptedFieldType:d,className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":l,"adyen-checkout__input--focus":c.focused,"adyen-checkout__input--valid":u,"adyen-checkout__card__cardNumber__input--noBrand":!c.showBrandIcon})}),c.showBrandIcon&&!m&&e(n,{brandsConfiguration:c.brandsConfiguration,brand:c.brand}),m&&!l&&e("div",{className:r(["adyen-checkout__card__dual-branding__icons"])},m.map(r=>e(n,{key:r.id,brand:r.id,brandsConfiguration:c.brandsConfiguration}))))}export{c as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import r from"./BrandIcon.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import o from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as i}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as t}from"./FieldLabelAlternative.js";import{requiresDualBrandSelection as l}from"../utils.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as s}from"../../../constants.js";import c from"./DualBrandSelector.js";function u(u){const{i18n:m}=d(),{error:_="",isValid:p=!1,onFocusField:f=()=>{},dualBrandingElements:b,dualBrandingChangeHandler:g,brandsConfiguration:h,selectedBrandValue:y}=u,C=!!b&&l(s,b,"id"),B=C?m.get("creditCard.dualBrand.description"):void 0;return e(a,{label:u.label,focused:u.focused,filled:u.filled,classNameModifiers:["cardNumber"],onFocusField:()=>f(i),errorMessage:_,isValid:p,dir:"ltr",name:i,showValidIcon:!1,i18n:m,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:t,onInputContainerClick:()=>{f(i)},contextualText:B},e(o,{encryptedFieldType:i,className:n({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":_,"adyen-checkout__input--focus":u.focused,"adyen-checkout__input--valid":p,"adyen-checkout__card__cardNumber__input--noBrand":!u.showBrandIcon})}),u.showBrandIcon&&!b&&e(r,{brandsConfiguration:u.brandsConfiguration,brand:u.brand}),b&&!_&&e("div",{className:n(["adyen-checkout__card__dual-branding__icons"])},C?e(c,{dualBrandingElements:b,dualBrandingChangeHandler:g,brandsConfiguration:h,selectedBrandValue:y}):b.map(n=>e(r,{key:n.id,brand:n.id,brandsConfiguration:u.brandsConfiguration}))),e("span",{className:"adyen-checkout__card__dual-branding__sr-only","aria-live":"polite"},B))}export{u as default};
2
2
  //# sourceMappingURL=CardNumber.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CardNumber.scss';\n\nexport default function CardNumber(props: Readonly<CardNumberProps>) {\n const { i18n } = useCoreContext();\n const { error = '', isValid = false, onFocusField = () => {}, dualBrandingElements } = props;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_CARD_NUMBER);\n };\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} />}\n\n {dualBrandingElements && !error && (\n <div className={classNames(['adyen-checkout__card__dual-branding__icons'])}>\n {dualBrandingElements.map(element => (\n <BrandIcon key={element.id} brand={element.id} brandsConfiguration={props.brandsConfiguration} />\n ))}\n </div>\n )}\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brandsConfiguration","brand","div","map","element","key","id"],"mappings":"ueAWe,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MAAEA,EAAQ,GAAEC,QAAEA,GAAU,EAAKC,aAAEA,EAAe,OAAQC,qBAAEA,GAAyBN,EAMvF,OACIO,EAACC,EAAAA,CACGC,MAAOT,EAAMS,MACbC,QAASV,EAAMU,QACfC,OAAQX,EAAMW,OACdC,mBAAoB,CAAC,cACrBP,aAAc,IAAMA,EAAaQ,GACjCC,aAAcX,EACdC,QAASA,EACTW,IAAK,MACLC,KAAMH,EACNI,eAAe,EACfhB,KAAMA,EACNiB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BC,sBApBgB,KACpBjB,EAAaQ,KAqBTN,EAACgB,EAAAA,CACGC,mBAAoBX,EACpBY,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCvB,EAChC,+BAAgCH,EAAMU,QACtC,+BAAgCN,EAChC,oDAAqDJ,EAAM2B,kBAIlE3B,EAAM2B,gBAAkBrB,GAAwBC,EAACqB,EAAAA,CAAUC,oBAAqB7B,EAAM6B,oBAAqBC,MAAO9B,EAAM8B,QAExHxB,IAAyBH,GACtBI,EAACwB,MAAAA,CAAIN,UAAWC,EAAW,CAAC,gDACvBpB,EAAqB0B,IAAIC,GACtB1B,EAACqB,EAAAA,CAAUM,IAAKD,EAAQE,GAAIL,MAAOG,EAAQE,GAAIN,oBAAqB7B,EAAM6B,wBAMlG"}
1
+ {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CardNumber.scss';\nimport { requiresDualBrandSelection } from '../utils';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../constants';\nimport DualBrandSelector from './DualBrandSelector';\n\nexport default function CardNumber(props: Readonly<CardNumberProps>) {\n const { i18n } = useCoreContext();\n const {\n error = '',\n isValid = false,\n onFocusField = () => {},\n dualBrandingElements,\n dualBrandingChangeHandler,\n brandsConfiguration,\n selectedBrandValue\n } = props;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_CARD_NUMBER);\n };\n\n const showDualBrandSelector = dualBrandingElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandingElements, 'id')\n : false;\n\n // Unlike other fields we don't respect the 'showContextualElement' config prop (that the merchant can set to false)\n // We always show the contextual text for dual branding that requires selection\n const contextualText = showDualBrandSelector ? i18n.get('creditCard.dualBrand.description') : undefined;\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n onInputContainerClick={handleIconClick}\n contextualText={contextualText}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} />}\n\n {dualBrandingElements && !error && (\n <div className={classNames(['adyen-checkout__card__dual-branding__icons'])}>\n {showDualBrandSelector ? (\n <DualBrandSelector\n dualBrandingElements={dualBrandingElements}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n brandsConfiguration={brandsConfiguration}\n selectedBrandValue={selectedBrandValue}\n />\n ) : (\n dualBrandingElements.map(element => {\n return <BrandIcon key={element.id} brand={element.id} brandsConfiguration={props.brandsConfiguration} />;\n })\n )}\n </div>\n )}\n <span className=\"adyen-checkout__card__dual-branding__sr-only\" aria-live=\"polite\">\n {contextualText}\n </span>\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","dualBrandingChangeHandler","brandsConfiguration","selectedBrandValue","showDualBrandSelector","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","contextualText","get","undefined","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brand","div","DualBrandSelector","map","element","key","id","span","aria-live"],"mappings":"wpBAce,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MACFA,EAAQ,GAAEC,QACVA,GAAU,EAAKC,aACfA,EAAe,OAAQC,qBACvBA,EAAoBC,0BACpBA,EAAyBC,oBACzBA,EAAmBC,mBACnBA,GACAT,EAMEU,IAAwBJ,GACxBK,EAA2BC,EAA2CN,EAAsB,MAK5FO,EAAiBH,EAAwBT,EAAKa,IAAI,yCAAsCC,EAE9F,OACIC,EAACC,EAAAA,CACGC,MAAOlB,EAAMkB,MACbC,QAASnB,EAAMmB,QACfC,OAAQpB,EAAMoB,OACdC,mBAAoB,CAAC,cACrBhB,aAAc,IAAMA,EAAaiB,GACjCC,aAAcpB,EACdC,QAASA,EACToB,IAAK,MACLC,KAAMH,EACNI,eAAe,EACfzB,KAAMA,EACN0B,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BC,sBA5BgB,KACpB1B,EAAaiB,IA4BTT,eAAgBA,GAEhBG,EAACgB,EAAAA,CACGC,mBAAoBX,EACpBY,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgChC,EAChC,+BAAgCH,EAAMmB,QACtC,+BAAgCf,EAChC,oDAAqDJ,EAAMoC,kBAIlEpC,EAAMoC,gBAAkB9B,GAAwBU,EAACqB,EAAAA,CAAU7B,oBAAqBR,EAAMQ,oBAAqB8B,MAAOtC,EAAMsC,QAExHhC,IAAyBH,GACtBa,EAACuB,MAAAA,CAAIL,UAAWC,EAAW,CAAC,gDACvBzB,EACGM,EAACwB,EAAAA,CACGlC,qBAAsBA,EACtBC,0BAA2BA,EAC3BC,oBAAqBA,EACrBC,mBAAoBA,IAGxBH,EAAqBmC,IAAIC,GACd1B,EAACqB,EAAAA,CAAUM,IAAKD,EAAQE,GAAIN,MAAOI,EAAQE,GAAIpC,oBAAqBR,EAAMQ,wBAKjGQ,EAAC6B,OAAAA,CAAKX,UAAU,+CAA+CY,YAAU,UACpEjC,GAIjB"}
@@ -0,0 +1,2 @@
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useState as a}from"../../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../../_virtual/index.js";import{mapDualBrandButtons as t}from"../utils.js";import o from"./DualBrandSelector.module.scss.js";import{useCoreContext as n}from"../../../../../core/Context/CoreProvider.js";function l({dualBrandingElements:l,brandsConfiguration:d,dualBrandingChangeHandler:i,selectedBrandValue:s}){const{i18n:u}=n(),c=t(l,d),[m,p]=a(s),f=e=>{p(e),i(e)};return e("div",{className:o.dualBrandSelector,role:"group","aria-label":u.get("creditCard.dualBrand.description")},c.map(a=>e("button",{key:a.id,type:"button",className:r(o.dualBrandSelectorButton,{[o.dualBrandSelectorButtonSelected]:m===a.id}),onMouseDown:e=>e.preventDefault(),onClick:()=>f(a.id),onKeyDown:e=>((e,a)=>{"Enter"===e.key&&(e.preventDefault(),f(a))})(e,a.id),"aria-label":a.altName,"aria-pressed":m===a.id},e("img",{src:a.imageURL,alt:a.altName,className:o.dualBrandSelectorIcon}))))}export{l as default};
2
+ //# sourceMappingURL=DualBrandSelector.js.map