@adyen/adyen-web 6.0.0-alpha.2 → 6.0.0-alpha.3

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 (322) hide show
  1. package/README.md +166 -0
  2. package/dist/cjs/adyen.css +2 -2
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +1932 -1968
  6. package/dist/es/adyen.css +2 -2
  7. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  8. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  9. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  10. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  11. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  12. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  13. package/dist/es/components/ApplePay/defaultProps.js +1 -1
  14. package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
  15. package/dist/es/components/ApplePay/payment-request.js.map +1 -1
  16. package/dist/es/components/Boleto/components/BoletoInput/validate.js +1 -1
  17. package/dist/es/components/Boleto/components/BoletoInput/validate.js.map +1 -1
  18. package/dist/es/components/Card/Card.js +1 -1
  19. package/dist/es/components/Card/Card.js.map +1 -1
  20. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  21. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  22. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  23. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/components/CardHolderName.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  27. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  28. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  29. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  30. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  31. package/dist/es/components/Card/components/CardInput/validate.js +1 -1
  32. package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
  33. package/dist/es/components/CashAppPay/defaultProps.js +1 -1
  34. package/dist/es/components/CashAppPay/defaultProps.js.map +1 -1
  35. package/dist/es/components/Donation/Donation.js.map +1 -1
  36. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  37. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  38. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  39. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  40. package/dist/es/components/Econtext/Econtext.js +1 -1
  41. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  42. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  43. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  44. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  45. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  46. package/dist/es/components/Giropay/Giropay.js +1 -1
  47. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  48. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  49. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  50. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  51. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  52. package/dist/es/components/GooglePay/defaultProps.js +1 -1
  53. package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
  54. package/dist/es/components/GooglePay/requests.js.map +1 -1
  55. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  56. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  57. package/dist/es/components/Pix/Pix.js +1 -1
  58. package/dist/es/components/Pix/Pix.js.map +1 -1
  59. package/dist/es/components/Pix/PixInput/PixInput.js +1 -1
  60. package/dist/es/components/Pix/PixInput/PixInput.js.map +1 -1
  61. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  62. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  63. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  64. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  65. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  66. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  67. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  68. package/dist/es/components/ThreeDS2/components/utils.js +1 -1
  69. package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
  70. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  71. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  72. package/dist/es/components/internal/Address/Address.js +1 -1
  73. package/dist/es/components/internal/Address/Address.js.map +1 -1
  74. package/dist/es/components/internal/Address/validate.js +1 -1
  75. package/dist/es/components/internal/Address/validate.js.map +1 -1
  76. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  77. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  78. package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
  79. package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
  80. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  81. package/dist/es/components/internal/Img/Img.js +1 -1
  82. package/dist/es/components/internal/Img/Img.js.map +1 -1
  83. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  84. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  85. package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
  86. package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
  87. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  88. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  89. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  90. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  91. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  92. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  93. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  94. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  95. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  96. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
  97. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  98. package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
  99. package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
  100. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  101. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  102. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  103. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  105. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  106. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  107. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  108. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  109. package/dist/es/components/internal/UIElement/utils.js +1 -1
  110. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  111. package/dist/es/core/Analytics/Analytics.js +1 -1
  112. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  113. package/dist/es/core/Analytics/constants.js +1 -1
  114. package/dist/es/core/Analytics/constants.js.map +1 -1
  115. package/dist/es/core/Analytics/utils.js +1 -1
  116. package/dist/es/core/Analytics/utils.js.map +1 -1
  117. package/dist/es/core/Errors/constants.js +1 -1
  118. package/dist/es/core/Errors/constants.js.map +1 -1
  119. package/dist/es/core/Errors/utils.js +1 -1
  120. package/dist/es/core/Errors/utils.js.map +1 -1
  121. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  122. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  123. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  124. package/dist/es/core/Services/analytics/log-event.js +1 -1
  125. package/dist/es/core/core.js +1 -1
  126. package/dist/es/core/core.js.map +1 -1
  127. package/dist/es/core/utils.js +1 -1
  128. package/dist/es/core/utils.js.map +1 -1
  129. package/dist/es/index.d.ts +1932 -1968
  130. package/dist/es/language/locales/ar.json.js +1 -1
  131. package/dist/es/language/locales/cs-CZ.json.js +1 -1
  132. package/dist/es/language/locales/da-DK.json.js +1 -1
  133. package/dist/es/language/locales/de-DE.json.js +1 -1
  134. package/dist/es/language/locales/el-GR.json.js +1 -1
  135. package/dist/es/language/locales/en-US.json.js +1 -1
  136. package/dist/es/language/locales/es-ES.json.js +1 -1
  137. package/dist/es/language/locales/fi-FI.json.js +1 -1
  138. package/dist/es/language/locales/fr-FR.json.js +1 -1
  139. package/dist/es/language/locales/hr-HR.json.js +1 -1
  140. package/dist/es/language/locales/hu-HU.json.js +1 -1
  141. package/dist/es/language/locales/it-IT.json.js +1 -1
  142. package/dist/es/language/locales/ja-JP.json.js +1 -1
  143. package/dist/es/language/locales/ko-KR.json.js +1 -1
  144. package/dist/es/language/locales/nl-NL.json.js +1 -1
  145. package/dist/es/language/locales/no-NO.json.js +1 -1
  146. package/dist/es/language/locales/pl-PL.json.js +1 -1
  147. package/dist/es/language/locales/pt-BR.json.js +1 -1
  148. package/dist/es/language/locales/pt-PT.json.js +1 -1
  149. package/dist/es/language/locales/ro-RO.json.js +1 -1
  150. package/dist/es/language/locales/ru-RU.json.js +1 -1
  151. package/dist/es/language/locales/sk-SK.json.js +1 -1
  152. package/dist/es/language/locales/sl-SI.json.js +1 -1
  153. package/dist/es/language/locales/sv-SE.json.js +1 -1
  154. package/dist/es/language/locales/zh-CN.json.js +1 -1
  155. package/dist/es/language/locales/zh-TW.json.js +1 -1
  156. package/dist/es/utils/Formatters/formatters.js.map +1 -1
  157. package/dist/es/utils/Validator/defaultRules.js +1 -1
  158. package/dist/es/utils/Validator/defaultRules.js.map +1 -1
  159. package/dist/es/utils/base64.js +1 -1
  160. package/dist/es/utils/base64.js.map +1 -1
  161. package/dist/es/utils/getErrorMessage.js +1 -1
  162. package/dist/es/utils/getErrorMessage.js.map +1 -1
  163. package/dist/es-legacy/adyen.css +2 -2
  164. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  165. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  166. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  167. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  168. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  169. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  170. package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
  171. package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
  172. package/dist/es-legacy/components/ApplePay/payment-request.js.map +1 -1
  173. package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js +1 -1
  174. package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js.map +1 -1
  175. package/dist/es-legacy/components/Card/Card.js +1 -1
  176. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  177. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  178. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  179. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  180. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  181. package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js +1 -1
  182. package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
  183. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  184. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  185. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  186. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  187. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  188. package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
  189. package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
  190. package/dist/es-legacy/components/CashAppPay/defaultProps.js +1 -1
  191. package/dist/es-legacy/components/CashAppPay/defaultProps.js.map +1 -1
  192. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  193. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  194. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  195. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  196. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  197. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  198. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  199. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  200. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  201. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  202. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  203. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  204. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  205. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  206. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  207. package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
  208. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  209. package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
  210. package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
  211. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  212. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  213. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  214. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  215. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  216. package/dist/es-legacy/components/Pix/PixInput/PixInput.js +1 -1
  217. package/dist/es-legacy/components/Pix/PixInput/PixInput.js.map +1 -1
  218. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  219. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  220. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  221. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  222. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  223. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  224. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  225. package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
  226. package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
  227. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  228. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  229. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  230. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  231. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  232. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  233. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  234. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  235. package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
  236. package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
  237. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  238. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  239. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  240. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  241. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  242. package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
  243. package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
  244. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  245. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  246. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  247. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  248. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  249. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  250. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  251. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  252. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  253. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
  254. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  255. package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
  256. package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
  257. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  258. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  259. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  260. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  261. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  262. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  263. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  264. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  265. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  266. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  267. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  268. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  269. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  270. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  271. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  272. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  273. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  274. package/dist/es-legacy/core/Errors/constants.js +1 -1
  275. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  276. package/dist/es-legacy/core/Errors/utils.js +1 -1
  277. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  278. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  279. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  280. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  281. package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
  282. package/dist/es-legacy/core/core.js +1 -1
  283. package/dist/es-legacy/core/core.js.map +1 -1
  284. package/dist/es-legacy/core/utils.js +1 -1
  285. package/dist/es-legacy/core/utils.js.map +1 -1
  286. package/dist/es-legacy/language/locales/ar.json.js +1 -1
  287. package/dist/es-legacy/language/locales/cs-CZ.json.js +1 -1
  288. package/dist/es-legacy/language/locales/da-DK.json.js +1 -1
  289. package/dist/es-legacy/language/locales/de-DE.json.js +1 -1
  290. package/dist/es-legacy/language/locales/el-GR.json.js +1 -1
  291. package/dist/es-legacy/language/locales/en-US.json.js +1 -1
  292. package/dist/es-legacy/language/locales/es-ES.json.js +1 -1
  293. package/dist/es-legacy/language/locales/fi-FI.json.js +1 -1
  294. package/dist/es-legacy/language/locales/fr-FR.json.js +1 -1
  295. package/dist/es-legacy/language/locales/hr-HR.json.js +1 -1
  296. package/dist/es-legacy/language/locales/hu-HU.json.js +1 -1
  297. package/dist/es-legacy/language/locales/it-IT.json.js +1 -1
  298. package/dist/es-legacy/language/locales/ja-JP.json.js +1 -1
  299. package/dist/es-legacy/language/locales/ko-KR.json.js +1 -1
  300. package/dist/es-legacy/language/locales/nl-NL.json.js +1 -1
  301. package/dist/es-legacy/language/locales/no-NO.json.js +1 -1
  302. package/dist/es-legacy/language/locales/pl-PL.json.js +1 -1
  303. package/dist/es-legacy/language/locales/pt-BR.json.js +1 -1
  304. package/dist/es-legacy/language/locales/pt-PT.json.js +1 -1
  305. package/dist/es-legacy/language/locales/ro-RO.json.js +1 -1
  306. package/dist/es-legacy/language/locales/ru-RU.json.js +1 -1
  307. package/dist/es-legacy/language/locales/sk-SK.json.js +1 -1
  308. package/dist/es-legacy/language/locales/sl-SI.json.js +1 -1
  309. package/dist/es-legacy/language/locales/sv-SE.json.js +1 -1
  310. package/dist/es-legacy/language/locales/zh-CN.json.js +1 -1
  311. package/dist/es-legacy/language/locales/zh-TW.json.js +1 -1
  312. package/dist/es-legacy/utils/Formatters/formatters.js.map +1 -1
  313. package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
  314. package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
  315. package/dist/es-legacy/utils/base64.js +1 -1
  316. package/dist/es-legacy/utils/base64.js.map +1 -1
  317. package/dist/es-legacy/utils/getErrorMessage.js +1 -1
  318. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  319. package/dist/umd/adyen.css +2 -2
  320. package/dist/umd/adyen.js +2 -2
  321. package/dist/umd/adyen.js.map +1 -1
  322. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/configuration/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from '../types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '4.8.0';\n\nexport const DEFAULT_CARD_GROUP_TYPES = ['amex', 'mc', 'visa'];\n\nexport const NON_CREDIT_CARD_TYPE_SECURED_FIELDS = ['ach', GIFT_CARD]; // Maybe, sometime in the future will include 'sepa' & 'sepadirectdebit'\n\n// Credit card (CardInput) related securedFields (based on the data-cse attribute)\nexport const CREDIT_CARD_SF_FIELDS = [\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_PWD_FIELD\n // ENCRYPTED_PIN_FIELD,// probably redundant - it was an alt. name for KCP's encryptedPassword. But maybe has a role to play if we ever encrypt ibans.\n];\n\nexport const OTHER_SF_FIELDS = [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD, ENCRYPTED_BANK_LOCATION_FIELD]; // ACH fields\n\n/** A list of all the data-cse attributes that relate to securedFields (as found in card, giftcard or ach) */\nexport const ALL_SECURED_FIELDS = CREDIT_CARD_SF_FIELDS.concat(OTHER_SF_FIELDS);\n\n// Card components created as: checkout.create({BRAND}) e.g. checkout.create('bcmc')\n// - which are dedicated to a single, core, brand e.g. 'bcmc' BUT which can in effect handle multiple brands e.g. \"bcmc\", \"maestro\", \"visa\"\nexport const DEDICATED_CARD_COMPONENTS = ['bcmc'];\n\nexport const REQUIRED = 'required';\nexport const OPTIONAL = 'optional';\nexport const HIDDEN = 'hidden';\n\nexport const CVC_POLICY_REQUIRED: CVCPolicyType = REQUIRED;\nexport const CVC_POLICY_OPTIONAL: CVCPolicyType = OPTIONAL;\nexport const CVC_POLICY_HIDDEN: CVCPolicyType = HIDDEN;\n\nexport const DATE_POLICY_REQUIRED: DatePolicyType = REQUIRED;\nexport const DATE_POLICY_OPTIONAL: DatePolicyType = OPTIONAL;\nexport const DATE_POLICY_HIDDEN: DatePolicyType = HIDDEN;\n\nexport const DATA_ENCRYPTED_FIELD_ATTR = 'data-cse';\nexport const DATA_INFO = 'data-info';\nexport const DATA_UID = 'data-uid';\n\nexport const BRAND_ICON_UI_EXCLUSION_LIST = ['accel', 'pulse', 'star', 'nyce'];\n\nexport const BRAND_READABLE_NAME_MAP = {\n visa: 'VISA',\n mc: 'MasterCard',\n amex: 'American Express',\n discover: 'Discover',\n cup: 'China Union Pay',\n jcb: 'JCB',\n diners: 'Diners Club',\n maestro: 'Maestro',\n bcmc: 'Bancontact card',\n bijcard: 'de Bijenkorf Card'\n};\n\nexport const SF_FIELDS_MAP = {\n [ENCRYPTED_CARD_NUMBER]: 'cardNumber', // ph\n [ENCRYPTED_EXPIRY_DATE]: 'expiryDate', // ph\n [ENCRYPTED_SECURITY_CODE]: 'securityCode',\n [ENCRYPTED_EXPIRY_MONTH]: 'expiryMonth', // ph\n [ENCRYPTED_EXPIRY_YEAR]: 'expiryYear', // ph\n //\n [ENCRYPTED_PWD_FIELD]: 'password',\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: 'bankAccountNumber',\n [ENCRYPTED_BANK_LOCATION_FIELD]: 'bankLocationId',\n //\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: 'securityCodeThreeDigits', // ph\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: 'securityCodeFourDigits' // ph\n};\n\n/** time within which we expect to receive a \"configured\" message from a securedField iframe, once it has registered as having loaded */\nexport const SF_CONFIG_TIMEOUT = 6000;\n"],"names":["ENCRYPTED","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","ENCRYPTED_SECURITY_CODE_3_DIGITS","ENCRYPTED_SECURITY_CODE_4_DIGITS","GIFT_CARD","SF_VERSION","DEFAULT_CARD_GROUP_TYPES","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","CREDIT_CARD_SF_FIELDS","OTHER_SF_FIELDS","ALL_SECURED_FIELDS","concat","DEDICATED_CARD_COMPONENTS","REQUIRED","OPTIONAL","HIDDEN","CVC_POLICY_REQUIRED","CVC_POLICY_OPTIONAL","CVC_POLICY_HIDDEN","DATE_POLICY_REQUIRED","DATE_POLICY_OPTIONAL","DATE_POLICY_HIDDEN","DATA_ENCRYPTED_FIELD_ATTR","DATA_INFO","DATA_UID","BRAND_ICON_UI_EXCLUSION_LIST","BRAND_READABLE_NAME_MAP","visa","mc","amex","discover","cup","jcb","diners","maestro","bcmc","bijcard","SF_FIELDS_MAP","SF_CONFIG_TIMEOUT"],"mappings":"AAEO,MAAMA,EAAY,YAEZC,EAAwB,sBACxBC,EAAwB,sBACxBC,EAAyB,uBACzBC,EAAwB,sBACxBC,EAA0B,wBAC1BC,EAAsB,oBAEtBC,EAAoC,6BACpCC,EAAgC,0BAEhCC,EAAmC,+BACnCC,EAAmC,+BAEnCC,EAAY,WAEZC,EAAa,QAEbC,EAA2B,CAAC,OAAQ,KAAM,QAE1CC,EAAsC,CAAC,MAAOH,GAG9CI,EAAwB,CACjCd,EACAC,EACAC,EACAC,EACAC,EACAC,GAISU,EAAkB,CAACT,EAAmCC,GAGtDS,EAAqBF,EAAsBG,OAAOF,GAIlDG,EAA4B,CAAC,QAE7BC,EAAW,WACXC,EAAW,WACXC,EAAS,SAETC,EAAqCH,EACrCI,EAAqCH,EACrCI,EAAmCH,EAEnCI,EAAuCN,EACvCO,EAAuCN,EACvCO,EAAqCN,EAErCO,EAA4B,WAC5BC,EAAY,YACZC,EAAW,WAEXC,EAA+B,CAAC,QAAS,QAAS,OAAQ,QAE1DC,EAA0B,CACnCC,KAAM,OACNC,GAAI,aACJC,KAAM,mBACNC,SAAU,WACVC,IAAK,kBACLC,IAAK,MACLC,OAAQ,cACRC,QAAS,UACTC,KAAM,kBACNC,QAAS,qBAGAC,EAAgB,CACzB3C,CAACA,GAAwB,aACzBC,CAACA,GAAwB,aACzBG,CAACA,GAA0B,eAC3BF,CAACA,GAAyB,cAC1BC,CAACA,GAAwB,aAEzBE,CAACA,GAAsB,WACvBC,CAACA,GAAoC,oBACrCC,CAACA,GAAgC,iBAEjCC,CAACA,GAAmC,0BACpCC,CAACA,GAAmC,0BAI3BmC,EAAoB"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/configuration/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from '../types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '5.0.1';\n\nexport const DEFAULT_CARD_GROUP_TYPES = ['amex', 'mc', 'visa'];\n\nexport const NON_CREDIT_CARD_TYPE_SECURED_FIELDS = ['ach', GIFT_CARD]; // Maybe, sometime in the future will include 'sepa' & 'sepadirectdebit'\n\n// Credit card (CardInput) related securedFields (based on the data-cse attribute)\nexport const CREDIT_CARD_SF_FIELDS = [\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_PWD_FIELD\n // ENCRYPTED_PIN_FIELD,// probably redundant - it was an alt. name for KCP's encryptedPassword. But maybe has a role to play if we ever encrypt ibans.\n];\n\nexport const OTHER_SF_FIELDS = [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD, ENCRYPTED_BANK_LOCATION_FIELD]; // ACH fields\n\n/** A list of all the data-cse attributes that relate to securedFields (as found in card, giftcard or ach) */\nexport const ALL_SECURED_FIELDS = CREDIT_CARD_SF_FIELDS.concat(OTHER_SF_FIELDS);\n\n// Card components created as: checkout.create({BRAND}) e.g. checkout.create('bcmc')\n// - which are dedicated to a single, core, brand e.g. 'bcmc' BUT which can in effect handle multiple brands e.g. \"bcmc\", \"maestro\", \"visa\"\nexport const DEDICATED_CARD_COMPONENTS = ['bcmc'];\n\nexport const REQUIRED = 'required';\nexport const OPTIONAL = 'optional';\nexport const HIDDEN = 'hidden';\n\nexport const CVC_POLICY_REQUIRED: CVCPolicyType = REQUIRED;\nexport const CVC_POLICY_OPTIONAL: CVCPolicyType = OPTIONAL;\nexport const CVC_POLICY_HIDDEN: CVCPolicyType = HIDDEN;\n\nexport const DATE_POLICY_REQUIRED: DatePolicyType = REQUIRED;\nexport const DATE_POLICY_OPTIONAL: DatePolicyType = OPTIONAL;\nexport const DATE_POLICY_HIDDEN: DatePolicyType = HIDDEN;\n\nexport const DATA_ENCRYPTED_FIELD_ATTR = 'data-cse';\nexport const DATA_INFO = 'data-info';\nexport const DATA_UID = 'data-uid';\n\nexport const BRAND_ICON_UI_EXCLUSION_LIST = ['accel', 'pulse', 'star', 'nyce'];\n\nexport const BRAND_READABLE_NAME_MAP = {\n visa: 'VISA',\n mc: 'MasterCard',\n amex: 'American Express',\n discover: 'Discover',\n cup: 'China Union Pay',\n jcb: 'JCB',\n diners: 'Diners Club',\n maestro: 'Maestro',\n bcmc: 'Bancontact card',\n bijcard: 'de Bijenkorf Card'\n};\n\nexport const SF_FIELDS_MAP = {\n [ENCRYPTED_CARD_NUMBER]: 'cardNumber', // ph\n [ENCRYPTED_EXPIRY_DATE]: 'expiryDate', // ph\n [ENCRYPTED_SECURITY_CODE]: 'securityCode',\n [ENCRYPTED_EXPIRY_MONTH]: 'expiryMonth', // ph\n [ENCRYPTED_EXPIRY_YEAR]: 'expiryYear', // ph\n //\n [ENCRYPTED_PWD_FIELD]: 'password',\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: 'bankAccountNumber',\n [ENCRYPTED_BANK_LOCATION_FIELD]: 'bankLocationId',\n //\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: 'securityCodeThreeDigits', // ph\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: 'securityCodeFourDigits' // ph\n};\n\n/** time within which we expect to receive a \"configured\" message from a securedField iframe, once it has registered as having loaded */\nexport const SF_CONFIG_TIMEOUT = 6000;\n"],"names":["ENCRYPTED","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","ENCRYPTED_SECURITY_CODE_3_DIGITS","ENCRYPTED_SECURITY_CODE_4_DIGITS","GIFT_CARD","SF_VERSION","DEFAULT_CARD_GROUP_TYPES","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","CREDIT_CARD_SF_FIELDS","OTHER_SF_FIELDS","ALL_SECURED_FIELDS","concat","DEDICATED_CARD_COMPONENTS","REQUIRED","OPTIONAL","HIDDEN","CVC_POLICY_REQUIRED","CVC_POLICY_OPTIONAL","CVC_POLICY_HIDDEN","DATE_POLICY_REQUIRED","DATE_POLICY_OPTIONAL","DATE_POLICY_HIDDEN","DATA_ENCRYPTED_FIELD_ATTR","DATA_INFO","DATA_UID","BRAND_ICON_UI_EXCLUSION_LIST","BRAND_READABLE_NAME_MAP","visa","mc","amex","discover","cup","jcb","diners","maestro","bcmc","bijcard","SF_FIELDS_MAP","SF_CONFIG_TIMEOUT"],"mappings":"AAEO,MAAMA,EAAY,YAEZC,EAAwB,sBACxBC,EAAwB,sBACxBC,EAAyB,uBACzBC,EAAwB,sBACxBC,EAA0B,wBAC1BC,EAAsB,oBAEtBC,EAAoC,6BACpCC,EAAgC,0BAEhCC,EAAmC,+BACnCC,EAAmC,+BAEnCC,EAAY,WAEZC,EAAa,QAEbC,EAA2B,CAAC,OAAQ,KAAM,QAE1CC,EAAsC,CAAC,MAAOH,GAG9CI,EAAwB,CACjCd,EACAC,EACAC,EACAC,EACAC,EACAC,GAISU,EAAkB,CAACT,EAAmCC,GAGtDS,EAAqBF,EAAsBG,OAAOF,GAIlDG,EAA4B,CAAC,QAE7BC,EAAW,WACXC,EAAW,WACXC,EAAS,SAETC,EAAqCH,EACrCI,EAAqCH,EACrCI,EAAmCH,EAEnCI,EAAuCN,EACvCO,EAAuCN,EACvCO,EAAqCN,EAErCO,EAA4B,WAC5BC,EAAY,YACZC,EAAW,WAEXC,EAA+B,CAAC,QAAS,QAAS,OAAQ,QAE1DC,EAA0B,CACnCC,KAAM,OACNC,GAAI,aACJC,KAAM,mBACNC,SAAU,WACVC,IAAK,kBACLC,IAAK,MACLC,OAAQ,cACRC,QAAS,UACTC,KAAM,kBACNC,QAAS,qBAGAC,EAAgB,CACzB3C,CAACA,GAAwB,aACzBC,CAACA,GAAwB,aACzBG,CAACA,GAA0B,eAC3BF,CAACA,GAAyB,cAC1BC,CAACA,GAAwB,aAEzBE,CAACA,GAAsB,WACvBC,CAACA,GAAoC,oBACrCC,CAACA,GAAgC,iBAEjCC,CAACA,GAAmC,0BACpCC,CAACA,GAAmC,0BAI3BmC,EAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, StylesObject } from '../types';\nimport {\n ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,\n ENCRYPTED_BANK_LOCATION_FIELD,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS\n} from '../configuration/constants';\nimport { Placeholders } from '../../SFP/types';\n\n/**\n * Base interface for SecuredFieldSetupObject & IframeConfigObject\n *\n * These are the props that are passed from CSF.createSecuredFields when SecuredField.ts is initialised\n * but which also end up as props in the IframeConfigObject\n */\nexport interface SecuredFieldCommonProps {\n // originally extracted in createSecuredFields\n fieldType: string;\n extraFieldData: string;\n uid: string;\n // originally calculated in createSecuredFields, for single branded cards, based on initial assessment of brand info; else defaults to true\n cvcPolicy: CVCPolicyType;\n // originally set in createSecuredFields\n expiryDatePolicy: DatePolicyType;\n // originally read from CSF->this.state\n txVariant: string;\n // originally from CSF->this.config\n cardGroupTypes: string[];\n iframeUIConfig: IframeUIConfigObject;\n sfLogAtStart: boolean;\n trimTrailingSeparator: boolean;\n isCreditCardType: boolean;\n showWarnings: boolean;\n legacyInputMode: boolean;\n minimumExpiryDate: string;\n // originally from CSF->this.props\n implementationType: string;\n maskSecurityCode: boolean;\n disableIOSArrowKeys: boolean;\n}\n\n/**\n * The object sent when createSecuredFields initialises a new instance of SecuredField.ts\n *\n * Properties defined directly in *this* interface c.f. SecuredFieldCommonProps are ones\n * that are needed by SecuredField.ts but are *not* required in the IframeConfigObject\n */\nexport interface SecuredFieldSetupObject extends SecuredFieldCommonProps {\n loadingContext: string;\n holderEl: HTMLElement;\n iframeSrc: string;\n showContextualElement?: boolean;\n placeholders: Placeholders;\n}\n\n/**\n * Object sent via postMessage to a SecuredField iframe in order to configure that iframe\n *\n * Properties defined directly in *this* interface are ones that are calculated by SecuredField.ts\n * instead of just being read directly from the SecuredFieldSetupObject\n */\nexport interface IframeConfigObject extends SecuredFieldCommonProps {\n numKey: number;\n}\n\ninterface IframeUIConfigObject {\n sfStyles?: StylesObject;\n placeholders?: SFPlaceholdersObject;\n ariaConfig?: AriaConfig;\n}\n\nexport interface SFPlaceholdersObject {\n [ENCRYPTED_CARD_NUMBER]?: string;\n [ENCRYPTED_EXPIRY_DATE]?: string;\n [ENCRYPTED_EXPIRY_MONTH]?: string;\n [ENCRYPTED_EXPIRY_YEAR]?: string;\n [ENCRYPTED_SECURITY_CODE]?: string;\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]?: string;\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]?: string;\n [ENCRYPTED_PWD_FIELD]?: string;\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]?: string;\n [ENCRYPTED_BANK_LOCATION_FIELD]?: string;\n}\n\ninterface ContextualTexts {\n [ENCRYPTED_EXPIRY_DATE]?: string;\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]?: string;\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]?: string;\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]?: string;\n}\n\nexport type AriaConfig = {\n lang?: string;\n} & {\n [key: string]: AriaConfigObject; // e.g. encryptedCardNumber: {...}\n};\n\nexport interface AriaConfigObject {\n iframeTitle?: string;\n label?: string;\n contextualTexts?: ContextualTexts;\n error?: object;\n}\n\nabstract class AbstractSecuredField {\n public sfConfig: SecuredFieldCommonProps; // could be protected but needs to be public for tests to run\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {} as any as SecuredFieldCommonProps;\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","sfConfig","this","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback"],"mappings":"wHA8GA,MAAeA,EA4BX,WAAAC,GA3BAC,EAAOC,KAAAA,gBAAP,GACAD,EAAAE,KAAUC,sBAAV,GACAH,EAAAE,KAAUE,gBAAV,GACAJ,EAAAE,KAAUG,iBAAV,GACAL,EAAAE,KAAOI,2BAAP,GAEAN,EAAAE,KAAUK,gBAAV,GACAP,EAAAE,KAAUM,4BAAV,GACAR,EAAAE,KAAUO,eAAV,GACAT,EAAAE,KAAUQ,oBAAV,GACAV,EAAAE,KAAUS,iBAAV,GACAX,EAAAE,KAAUU,kBAAV,GACAZ,EAAAE,KAAUW,kBAAV,GACAb,EAAAE,KAAUY,yBAAV,GACAd,EAAAE,KAAUa,6BAAV,GACAf,EAAAE,KAAUc,4BAAV,GAEAhB,EAAAE,KAAUe,8BAAV,GACAjB,EAAAE,KAAUgB,wBAAV,GACAlB,EAAAE,KAAUiB,4BAAV,GACAnB,EAAAE,KAAUkB,4BAAV,GACApB,EAAAE,KAAUmB,uBAAV,GACArB,EAAAE,KAAUoB,0BAAV,GACAtB,EAAAE,KAAUqB,4BAAV,GACAvB,EAAAE,KAAUsB,0BAAV,GACAxB,EAAAE,KAAUuB,8BAAV,GAGIvB,KAAKD,SAAW,EACpB"}
1
+ {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: SecuredFieldCommonProps; // could be protected but needs to be public for tests to run\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {} as any as SecuredFieldCommonProps;\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","sfConfig","this","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback"],"mappings":"wHASA,MAAeA,EA4BX,WAAAC,GA3BAC,EAAOC,KAAAA,gBAAP,GACAD,EAAAE,KAAUC,sBAAV,GACAH,EAAAE,KAAUE,gBAAV,GACAJ,EAAAE,KAAUG,iBAAV,GACAL,EAAAE,KAAOI,2BAAP,GAEAN,EAAAE,KAAUK,gBAAV,GACAP,EAAAE,KAAUM,4BAAV,GACAR,EAAAE,KAAUO,eAAV,GACAT,EAAAE,KAAUQ,oBAAV,GACAV,EAAAE,KAAUS,iBAAV,GACAX,EAAAE,KAAUU,kBAAV,GACAZ,EAAAE,KAAUW,kBAAV,GACAb,EAAAE,KAAUY,yBAAV,GACAd,EAAAE,KAAUa,6BAAV,GACAf,EAAAE,KAAUc,4BAAV,GAEAhB,EAAAE,KAAUe,8BAAV,GACAjB,EAAAE,KAAUgB,wBAAV,GACAlB,EAAAE,KAAUiB,4BAAV,GACAnB,EAAAE,KAAUkB,4BAAV,GACApB,EAAAE,KAAUmB,uBAAV,GACArB,EAAAE,KAAUoB,0BAAV,GACAtB,EAAAE,KAAUqB,4BAAV,GACAvB,EAAAE,KAAUsB,0BAAV,GACAxB,EAAAE,KAAUuB,8BAAV,GAGIvB,KAAKD,SAAW,EACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { off, on, removeAllChildren, selectOne } from '../utilities/dom';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../configuration/constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField, { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from './AbstractSecuredField';\nimport { reject } from '../../utils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! ' +\n '(Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n\n // HORRIBLE HORRIBLE HACK to get round bug in TestCafe - see comment on 3rd test in packages/e2e/tests/cards/branding/branding.test.js\n if (process.env.NODE_ENV === 'development' && window.location.origin.indexOf('3024') > -1) {\n if (window['testCafeForceClick'] === true) {\n window['testCafeForceClick'] = false;\n this.onTouchstartCallback(feedbackObj);\n }\n }\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * //'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event) // NEW\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field\" or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","iframeContentWindow","contentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","console","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","event","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","errorType","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"u1DA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EAAA,GAAKwE,EAAuBjG,kBAMhD,MAAMT,UAAEA,EAASC,aAAEA,EAAYC,sBAAEA,GAA0BsG,EAgC3D,OA3BAnG,KAAKmC,eAAiBgE,EAAUhE,eAChCnC,KAAKc,SAAWqF,EAAUrF,SAK1Bd,KAAKkD,SAAU,EACflD,KAAKkB,oBAAsB,KAC3BlB,KAAK8B,OAAS0E,IACdxG,KAAK4F,aAAc,EACnB5F,KAAKqE,UAAW,EAChBrE,KAAKoF,UAAY,GACjBpF,KAAKuE,UAAY4B,EAAU5B,UAC3BvE,KAAKkE,iBAAmBiC,EAAUjC,iBAc3BlE,KAAKP,KAAKC,EAAMC,EAAWC,EAAcC,EACpD"}
1
+ {"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { off, on, removeAllChildren, selectOne } from '../utilities/dom';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../configuration/constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField from './AbstractSecuredField';\nimport { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from '../types';\nimport { reject } from '../../utils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! ' +\n '(Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n\n // HORRIBLE HORRIBLE HACK to get round bug in TestCafe - see comment on 3rd test in packages/e2e/tests/cards/branding/branding.test.js\n if (process.env.NODE_ENV === 'development' && window.location.origin.indexOf('3024') > -1) {\n if (window['testCafeForceClick'] === true) {\n window['testCafeForceClick'] = false;\n this.onTouchstartCallback(feedbackObj);\n }\n }\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * //'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event) // NEW\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field\" or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","iframeContentWindow","contentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","console","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","event","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","errorType","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"u1DA8BA,MAAMA,UAAqBC,EA8DvBC,IAAAA,CAAKC,EAAgBC,EAAmBC,EAA4BC,GAIhE,MAAMC,EAAkCC,EAAkBC,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWT,EAAMG,GAElHG,KAAKC,SAASG,eAAeC,WAAaP,EAG1CE,KAAKC,SAASG,eAAeR,aAAeU,EAAoBN,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWP,GAKlH,MAAMW,EAAe,CACjBC,IAAKb,EACLc,MAAOX,EAAoBE,KAAKC,SAASE,WAAWO,YACpDC,OAAQ,UAGNC,EAA8BC,EAAaN,GAGjDP,KAAKc,SAASC,YAAYH,GAG1B,MAAMI,EAA4BC,EAAUjB,KAAKc,SAAU,cAa3D,OAXIE,IACAhB,KAAKkB,oBAAsBF,EAAOG,cAGlCnB,K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,CAEA,uBAAInD,GACA,OAAOlB,KAAK2F,oBAChB,CACA,uBAAIzE,CAAoBoE,GACpBtF,KAAK2F,qBAAuBL,CAChC,CAEA,eAAIM,GACA,OAAO5F,KAAK6F,YAChB,CACA,eAAID,CAAYN,GACZtF,KAAK6F,aAAeP,CACxB,CAEA,UAAIxD,GACA,OAAO9B,KAAK8F,OAChB,CACA,UAAIhE,CAAOwD,GACPtF,KAAK8F,QAAUR,CACnB,CAGA,wBAAIlE,GACA,OAAOpB,KAAK+F,qBAChB,CACA,wBAAI3E,CAAqBkE,GACrBtF,KAAK+F,sBAAwBT,EAAMU,KAAKhG,KAC5C,CAEA,uBAAIwB,GACA,OAAOxB,KAAKiG,oBAChB,CACA,uBAAIzE,CAAoB8D,GACpBtF,KAAKiG,qBAAuBX,EAAMU,KAAKhG,KAC3C,CAreAkG,WAAAA,CAAYC,EAAoCzG,GAC5C0G,QAMA,MAMMC,EAAyBC,EANC,CAAC,iBAAkB,WAAY,YAAa,wBAAyB,iBAMhDC,KAAKJ,GAG1DnG,KAAKC,SAAW2B,EAETyE,EAAAA,CAAAA,EAAAA,GAAAA,CAEHjG,eAAgByB,EAAA,GAAKwE,EAAuBjG,kBAMhD,MAAMT,UAAEA,EAASC,aAAEA,EAAYC,sBAAEA,GAA0BsG,EAgC3D,OA3BAnG,KAAKmC,eAAiBgE,EAAUhE,eAChCnC,KAAKc,SAAWqF,EAAUrF,SAK1Bd,KAAKkD,SAAU,EACflD,KAAKkB,oBAAsB,KAC3BlB,KAAK8B,OAAS0E,IACdxG,KAAK4F,aAAc,EACnB5F,KAAKqE,UAAW,EAChBrE,KAAKoF,UAAY,GACjBpF,KAAKuE,UAAY4B,EAAU5B,UAC3BvE,KAAKkE,iBAAmBiC,EAAUjC,iBAc3BlE,KAAKP,KAAKC,EAAMC,EAAWC,EAAcC,EACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"processAriaConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.ts"],"sourcesContent":["import { addErrorTranslationsToObject } from '../../../../../../core/Errors/utils';\nimport addContextTranslationsToObject from '../../utilities/addContextTranslations';\nimport { AriaConfigObject, AriaConfig } from '../AbstractSecuredField';\nimport Language from '../../../../../../language/Language';\nimport { SF_FIELDS_MAP } from '../../configuration/constants';\n\n/**\n * Creates an ariaConfig object with 'iframeTitle' and 'label' properties, whose values are retrieved from the translations object.\n * (These values either come from the translation file or have been overwritten by the merchant in a translations config object.)\n * We then add an error object containing the possible errors for any securedField read from the translation file and stored under error-codes\n */\nexport function processAriaConfig(txVariant: string, fieldType: string, i18n: Language, showContextuaElement): AriaConfig {\n // txVariant can be the scheme name (VISA, Mastercard...) so we put all of them under creditCard\n const type = ['ach', 'giftcard'].includes(txVariant) ? txVariant : 'creditCard';\n\n // Get translation for iframeTitle\n const iframeTitle: string = i18n.get(`${type}.${fieldType}.aria.iframeTitle`);\n\n // Get translation for aria label using *same* key that is used to label the element - important a11y consideration for (securedField) iframe\n const label: string = i18n.get(`${type}.${SF_FIELDS_MAP[fieldType]}.label`);\n\n // Get lang property\n const lang = i18n.locale;\n\n // Create a new object with the iframeTitle & label values from translation file\n const ariaFieldConfigObj: AriaConfigObject = { iframeTitle, label };\n\n // Add error translations object\n let enhancedAriaFieldConfigObj = addErrorTranslationsToObject(ariaFieldConfigObj, i18n, fieldType);\n\n // If allowed, add the translated contextual texts\n if (showContextuaElement) {\n enhancedAriaFieldConfigObj = addContextTranslationsToObject(enhancedAriaFieldConfigObj, i18n, txVariant, fieldType);\n }\n\n // Create a new aria config object keeping the old entries and adding a new one for this field\n // N.B. need to do this deconstruction of the original aria config object to break existing refs & avoid getting an \"accumulated\" object\n return {\n ...(lang && { lang }),\n [fieldType]: enhancedAriaFieldConfigObj\n } as AriaConfig;\n}\n"],"names":["processAriaConfig","txVariant","fieldType","i18n","showContextuaElement","type","includes","iframeTitle","get","label","SF_FIELDS_MAP","lang","locale","enhancedAriaFieldConfigObj","addErrorTranslationsToObject","addContextTranslationsToObject","_object_spread_props"],"mappings":"gxBAWO,SAASA,EAAkBC,EAAmBC,EAAmBC,EAAgBC,GAEpF,MAAMC,EAAO,CAAC,MAAO,YAAYC,SAASL,GAAaA,EAAY,aAG7DM,EAAsBJ,EAAKK,IAAI,GAAGH,KAAQH,sBAG1CO,EAAgBN,EAAKK,IAAI,GAAGH,KAAQK,EAAcR,YAGlDS,EAAOR,EAAKS,OAMlB,IAAIC,EAA6BC,EAHY,CAAEP,cAAaE,SAGsBN,EAAMD,GASxF,OANIE,IACAS,EAA6BE,EAA+BF,EAA4BV,EAAMF,EAAWC,IAKtGc,4UACCL,GAAQ,CAAEA,SAAK,CACnBT,CAACA,GAAYW,GAErB"}
1
+ {"version":3,"file":"processAriaConfig.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.ts"],"sourcesContent":["import { addErrorTranslationsToObject } from '../../../../../../core/Errors/utils';\nimport addContextTranslationsToObject from '../../utilities/addContextTranslations';\nimport Language from '../../../../../../language/Language';\nimport { SF_FIELDS_MAP } from '../../configuration/constants';\nimport { AriaConfig, AriaConfigObject } from '../../types';\n\n/**\n * Creates an ariaConfig object with 'iframeTitle' and 'label' properties, whose values are retrieved from the translations object.\n * (These values either come from the translation file or have been overwritten by the merchant in a translations config object.)\n * We then add an error object containing the possible errors for any securedField read from the translation file and stored under error-codes\n */\nexport function processAriaConfig(txVariant: string, fieldType: string, i18n: Language, showContextuaElement): AriaConfig {\n // txVariant can be the scheme name (VISA, Mastercard...) so we put all of them under creditCard\n const type = ['ach', 'giftcard'].includes(txVariant) ? txVariant : 'creditCard';\n\n // Get translation for iframeTitle\n const iframeTitle: string = i18n.get(`${type}.${fieldType}.aria.iframeTitle`);\n\n // Get translation for aria label using *same* key that is used to label the element - important a11y consideration for (securedField) iframe\n const label: string = i18n.get(`${type}.${SF_FIELDS_MAP[fieldType]}.label`);\n\n // Get lang property\n const lang = i18n.locale;\n\n // Create a new object with the iframeTitle & label values from translation file\n const ariaFieldConfigObj: AriaConfigObject = { iframeTitle, label };\n\n // Add error translations object\n let enhancedAriaFieldConfigObj: AriaConfigObject = addErrorTranslationsToObject(ariaFieldConfigObj, i18n, fieldType);\n\n // If allowed, add the translated contextual texts\n if (showContextuaElement) {\n enhancedAriaFieldConfigObj = addContextTranslationsToObject(enhancedAriaFieldConfigObj, i18n, txVariant, fieldType);\n }\n\n // Create a new aria config object keeping the old entries and adding a new one for this field\n // N.B. need to do this deconstruction of the original aria config object to break existing refs & avoid getting an \"accumulated\" object\n return {\n ...(lang && { lang }),\n [fieldType]: enhancedAriaFieldConfigObj\n } as AriaConfig;\n}\n"],"names":["processAriaConfig","txVariant","fieldType","i18n","showContextuaElement","type","includes","iframeTitle","get","label","SF_FIELDS_MAP","lang","locale","enhancedAriaFieldConfigObj","addErrorTranslationsToObject","addContextTranslationsToObject","_object_spread_props"],"mappings":"gxBAWO,SAASA,EAAkBC,EAAmBC,EAAmBC,EAAgBC,GAEpF,MAAMC,EAAO,CAAC,MAAO,YAAYC,SAASL,GAAaA,EAAY,aAG7DM,EAAsBJ,EAAKK,IAAI,GAAGH,KAAQH,sBAG1CO,EAAgBN,EAAKK,IAAI,GAAGH,KAAQK,EAAcR,YAGlDS,EAAOR,EAAKS,OAMlB,IAAIC,EAA+CC,EAHN,CAAEP,cAAaE,SAGwCN,EAAMD,GAS1G,OANIE,IACAS,EAA6BE,EAA+BF,EAA4BV,EAAMF,EAAWC,IAKtGc,4UACCL,GAAQ,CAAEA,SAAK,CACnBT,CAACA,GAAYW,GAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"processPlaceholders.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.ts"],"sourcesContent":["import { SFPlaceholdersObject } from '../AbstractSecuredField';\nimport { Placeholders } from '../../../SFP/types';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../../configuration/constants';\nimport { Placeholders as AchPlaceholders } from '../../../../../Ach/components/AchInput/types';\nimport { Placeholders as GiftcardPlaceholders } from '../../../../../Giftcard/components/types';\nimport { Placeholders as CardPlaceholders } from '../../../../../Card/components/CardInput/types';\n\n/**\n * Create placeholders with a value from merchant's configuration\n *\n * Based on txVariant & fieldType, maps the entries in the passed placeholders object to create a field specific placeholder object\n */\nexport function processPlaceholders(txVariant: string, fieldType: string, placeholders: Placeholders): SFPlaceholdersObject {\n switch (txVariant) {\n case 'ach':\n return { [fieldType]: (placeholders as AchPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n case GIFT_CARD:\n return { [fieldType]: (placeholders as GiftcardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n default:\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n return {\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: (placeholders as CardPlaceholders).securityCodeThreeDigits ?? '',\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: (placeholders as CardPlaceholders).securityCodeFourDigits ?? ''\n };\n\n default:\n return { [fieldType]: (placeholders as CardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n }\n }\n}\n"],"names":["processPlaceholders","txVariant","fieldType","placeholders","_placeholders_SF_FIELDS_MAP_fieldType","SF_FIELDS_MAP","GIFT_CARD","_placeholders_SF_FIELDS_MAP_fieldType1","_placeholders_securityCodeThreeDigits","_placeholders_securityCodeFourDigits","_placeholders_SF_FIELDS_MAP_fieldType2","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","securityCodeThreeDigits","ENCRYPTED_SECURITY_CODE_4_DIGITS","securityCodeFourDigits"],"mappings":"yLAkBO,SAASA,EAAoBC,EAAmBC,EAAmBC,GACtE,OAAQF,GACJ,IAAK,MACqB,IAAAG,EAAtB,MAAO,CAAEF,CAACA,GAAuE,QAA3DE,EAAAD,EAAkCE,EAAcH,eAAhDE,EAAAA,EAA+D,IAEzF,KAAKE,EACqB,IAAAC,EAAtB,MAAO,CAAEL,CAACA,GAA4E,QAAhEK,EAAAJ,EAAuCE,EAAcH,eAArDK,EAAAA,EAAoE,IAE9F,YAIoDC,EACAC,EAIlBC,EAR9B,OAAQR,IACCS,EACM,CACHC,CAACA,GAAmC,QAAAJ,EAAAL,EAAmCU,+BAAnC,IAAAL,EAAAA,EAA8D,GAClGM,CAACA,GAAmC,QAAAL,EAAAN,EAAmCY,8BAAnC,IAAAN,EAAAA,EAA6D,IAI9F,CAAEP,CAACA,GAAwE,QAA5DQ,EAAAP,EAAmCE,EAAcH,eAAjDQ,EAAAA,EAAgE,IAG1G"}
1
+ {"version":3,"file":"processPlaceholders.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.ts"],"sourcesContent":["import { SFPlaceholdersObject } from '../../types';\nimport { Placeholders } from '../../../SFP/types';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../../configuration/constants';\nimport { Placeholders as AchPlaceholders } from '../../../../../Ach/components/AchInput/types';\nimport { Placeholders as GiftcardPlaceholders } from '../../../../../Giftcard/components/types';\nimport { Placeholders as CardPlaceholders } from '../../../../../Card/components/CardInput/types';\n\n/**\n * Create placeholders with a value from merchant's configuration\n *\n * Based on txVariant & fieldType, maps the entries in the passed placeholders object to create a field specific placeholder object\n */\nexport function processPlaceholders(txVariant: string, fieldType: string, placeholders: Placeholders): SFPlaceholdersObject {\n switch (txVariant) {\n case 'ach':\n return { [fieldType]: (placeholders as AchPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n case GIFT_CARD:\n return { [fieldType]: (placeholders as GiftcardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n\n default:\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n return {\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: (placeholders as CardPlaceholders).securityCodeThreeDigits ?? '',\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: (placeholders as CardPlaceholders).securityCodeFourDigits ?? ''\n };\n\n default:\n return { [fieldType]: (placeholders as CardPlaceholders)[SF_FIELDS_MAP[fieldType]] ?? '' };\n }\n }\n}\n"],"names":["processPlaceholders","txVariant","fieldType","placeholders","_placeholders_SF_FIELDS_MAP_fieldType","SF_FIELDS_MAP","GIFT_CARD","_placeholders_SF_FIELDS_MAP_fieldType1","_placeholders_securityCodeThreeDigits","_placeholders_securityCodeFourDigits","_placeholders_SF_FIELDS_MAP_fieldType2","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","securityCodeThreeDigits","ENCRYPTED_SECURITY_CODE_4_DIGITS","securityCodeFourDigits"],"mappings":"yLAkBO,SAASA,EAAoBC,EAAmBC,EAAmBC,GACtE,OAAQF,GACJ,IAAK,MACqB,IAAAG,EAAtB,MAAO,CAAEF,CAACA,GAAuE,QAA3DE,EAAAD,EAAkCE,EAAcH,eAAhDE,EAAAA,EAA+D,IAEzF,KAAKE,EACqB,IAAAC,EAAtB,MAAO,CAAEL,CAACA,GAA4E,QAAhEK,EAAAJ,EAAuCE,EAAcH,eAArDK,EAAAA,EAAoE,IAE9F,YAIoDC,EACAC,EAIlBC,EAR9B,OAAQR,IACCS,EACM,CACHC,CAACA,GAAmC,QAAAJ,EAAAL,EAAmCU,+BAAnC,IAAAL,EAAAA,EAA8D,GAClGM,CAACA,GAAmC,QAAAL,EAAAN,EAAmCY,8BAAnC,IAAAN,EAAAA,EAA6D,IAI9F,CAAEP,CAACA,GAAwE,QAA5DQ,EAAAP,EAAmCE,EAAcH,eAAjDQ,EAAAA,EAAgE,IAG1G"}
@@ -1 +1 @@
1
- {"version":3,"file":"addContextTranslations.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/utilities/addContextTranslations.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../configuration/constants';\n\n/**\n * Based on txVariant & fieldType, add a field specific contextualTexts object to the passed object\n */\nexport default (originalObj, i18n, txVariant, fieldType) => {\n const nuObj = { ...originalObj };\n\n const contextualTexts = {};\n\n switch (txVariant) {\n case 'ach':\n // TODO - when we know the required texts\n break;\n case GIFT_CARD:\n // TODO - when we know the required texts\n break;\n default:\n // Use field type to only add the texts specific to the creditCard securedField\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n contextualTexts[ENCRYPTED_SECURITY_CODE_3_DIGITS] = i18n.get('creditCard.securityCode.contextualText.3digits');\n contextualTexts[ENCRYPTED_SECURITY_CODE_4_DIGITS] = i18n.get('creditCard.securityCode.contextualText.4digits');\n break;\n\n default: {\n const translationKey = `creditCard.${SF_FIELDS_MAP[fieldType]}.contextualText`;\n const translation = i18n.get(translationKey);\n if (translation !== translationKey) {\n contextualTexts[fieldType] = translation;\n }\n }\n }\n }\n\n if (Object.keys(contextualTexts).length) {\n nuObj.contextualTexts = contextualTexts;\n }\n\n return nuObj;\n};\n"],"names":["addContextTranslationsToObject","originalObj","i18n","txVariant","fieldType","nuObj","_object_spread","contextualTexts","GIFT_CARD","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","get","ENCRYPTED_SECURITY_CODE_4_DIGITS","translationKey","SF_FIELDS_MAP","translation","Object","keys","length"],"mappings":"8SAWA,IAAAA,EAAe,CAACC,EAAaC,EAAMC,EAAWC,KAC1C,MAAMC,wUAAQC,CAAKL,CAAAA,EAAAA,GAEbM,EAAkB,CAAA,EAExB,OAAQJ,GACJ,IAAK,MAGL,KAAKK,EAED,MACJ,QAEI,GAAQJ,IACCK,EACDF,EAAgBG,GAAoCR,EAAKS,IAAI,kDAC7DJ,EAAgBK,GAAoCV,EAAKS,IAAI,sDAGxD,CACL,MAAME,EAAiB,cAAcC,EAAcV,oBAC7CW,EAAcb,EAAKS,IAAIE,GACzBE,IAAgBF,IAChBN,EAAgBH,GAAaW,EAErC,EAQZ,OAJIC,OAAOC,KAAKV,GAAiBW,SAC7Bb,EAAME,gBAAkBA,GAGrBF,CACX"}
1
+ {"version":3,"file":"addContextTranslations.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/utilities/addContextTranslations.ts"],"sourcesContent":["import {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_SECURITY_CODE_3_DIGITS,\n ENCRYPTED_SECURITY_CODE_4_DIGITS,\n GIFT_CARD,\n SF_FIELDS_MAP\n} from '../configuration/constants';\nimport { AriaConfigObject } from '../types';\nimport type Language from '../../../../../language';\n\n/**\n * Based on txVariant & fieldType, add a field specific contextualTexts object to the passed object\n */\nexport default (originalObj: AriaConfigObject, i18n: Language, txVariant: string, fieldType: string): AriaConfigObject => {\n const nuObj: AriaConfigObject = { ...originalObj };\n\n const contextualTexts = {};\n\n switch (txVariant) {\n case 'ach':\n // TODO - when we know the required texts\n break;\n case GIFT_CARD:\n // TODO - when we know the required texts\n break;\n default:\n // Use field type to only add the texts specific to the creditCard securedField\n switch (fieldType) {\n case ENCRYPTED_SECURITY_CODE:\n contextualTexts[ENCRYPTED_SECURITY_CODE_3_DIGITS] = i18n.get('creditCard.securityCode.contextualText.3digits');\n contextualTexts[ENCRYPTED_SECURITY_CODE_4_DIGITS] = i18n.get('creditCard.securityCode.contextualText.4digits');\n break;\n\n default: {\n const translationKey = `creditCard.${SF_FIELDS_MAP[fieldType]}.contextualText`;\n const translation = i18n.get(translationKey);\n if (translation !== translationKey) {\n contextualTexts[fieldType] = translation;\n }\n }\n }\n }\n\n if (Object.keys(contextualTexts).length) {\n nuObj.contextualTexts = contextualTexts;\n }\n\n return nuObj;\n};\n"],"names":["addContextTranslationsToObject","originalObj","i18n","txVariant","fieldType","nuObj","_object_spread","contextualTexts","GIFT_CARD","ENCRYPTED_SECURITY_CODE","ENCRYPTED_SECURITY_CODE_3_DIGITS","get","ENCRYPTED_SECURITY_CODE_4_DIGITS","translationKey","SF_FIELDS_MAP","translation","Object","keys","length"],"mappings":"8SAaA,IAAAA,EAAe,CAACC,EAA+BC,EAAgBC,EAAmBC,KAC9E,MAAMC,wUAA0BC,CAAKL,CAAAA,EAAAA,GAE/BM,EAAkB,CAAA,EAExB,OAAQJ,GACJ,IAAK,MAGL,KAAKK,EAED,MACJ,QAEI,GAAQJ,IACCK,EACDF,EAAgBG,GAAoCR,EAAKS,IAAI,kDAC7DJ,EAAgBK,GAAoCV,EAAKS,IAAI,sDAGxD,CACL,MAAME,EAAiB,cAAcC,EAAcV,oBAC7CW,EAAcb,EAAKS,IAAIE,GACzBE,IAAgBF,IAChBN,EAAgBH,GAAaW,EAErC,EAQZ,OAJIC,OAAOC,KAAKV,GAAiBW,SAC7Bb,EAAME,gBAAkBA,GAGrBF,CACX"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../external/classnames/index.js";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o({classNameModifiers:o,selectedValue:r,disabled:c=!1,options:a,onChange:l}){return a&&0!==a.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":c},...o.map((e=>`adyen-checkout__segmented-control--${e}`))),role:"group"},a.map((({label:o,value:a,htmlProps:s})=>e("button",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){n(e,t,o[t])}))}return e}({disabled:c,key:a,onClick:e=>l(a,e),className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":r===a}),type:"button"},s),o)))):null}export{o as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../external/classnames/index.js";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o({classNameModifiers:o=[],selectedValue:r,disabled:c=!1,options:a,onChange:l}){return a&&0!==a.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":c},...o.map((e=>`adyen-checkout__segmented-control--${e}`))),role:"group"},a.map((({label:o,value:a,htmlProps:s})=>e("button",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){n(e,t,o[t])}))}return e}({disabled:c,key:a,onClick:e=>l(a,e),className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":r===a}),type:"button"},s),r===a&&e("span",{className:"adyen-checkout-checkmark"}),o)))):null}export{o as default};
2
2
  //# sourceMappingURL=SegmentedControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\n\ninterface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: Array<{ label: string; value: T; htmlProps?: any }>;\n onChange(value: T, event: MouseEvent): void;\n}\n\nfunction SegmentedControl<T>({ classNameModifiers, selectedValue, disabled = false, options, onChange }: SegmentedControlProps<T>) {\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div\n className={cx(\n 'adyen-checkout__segmented-control',\n { 'adyen-checkout__segmented-control--disabled': disabled },\n ...classNameModifiers.map(modifier => `adyen-checkout__segmented-control--${modifier}`)\n )}\n role=\"group\"\n >\n {options.map(({ label, value, htmlProps }) => (\n <button\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n type=\"button\"\n {...htmlProps}\n >\n {label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default SegmentedControl;\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","htmlProps","button","key","onClick","event","type"],"mappings":"qPAYA,SAASA,GAAoBC,mBAAEA,EAAkBC,cAAEA,EAAaC,SAAEA,GAAW,EAAKC,QAAEA,EAAOC,SAAEA,IACzF,OAAKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,KAAIC,GAAY,sCAAsCA,OAEhFC,KAAK,SAEJT,EAAQO,KAAI,EAAGG,QAAOC,QAAOC,eAC1BT,EAACU,+UAAAA,CAAAA,CACGd,SAAUA,EACVe,IAAKH,EACLI,QAAUC,GAAsBf,EAASU,EAAOK,GAChDX,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EM,KAAK,UACDL,GAEHF,MAvBN,IA4Bf"}
1
+ {"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\n\nexport interface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: Array<{ label: string; value: T; htmlProps?: any }>;\n onChange(value: T, event: MouseEvent): void;\n}\n\nfunction SegmentedControl<T>({ classNameModifiers = [], selectedValue, disabled = false, options, onChange }: SegmentedControlProps<T>) {\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div\n className={cx(\n 'adyen-checkout__segmented-control',\n { 'adyen-checkout__segmented-control--disabled': disabled },\n ...classNameModifiers.map(modifier => `adyen-checkout__segmented-control--${modifier}`)\n )}\n role=\"group\"\n >\n {options.map(({ label, value, htmlProps }) => (\n <button\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n type=\"button\"\n {...htmlProps}\n >\n {selectedValue === value && <span className=\"adyen-checkout-checkmark\"></span>}\n {label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default SegmentedControl;\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","htmlProps","button","key","onClick","event","type","span"],"mappings":"qPAYA,SAASA,GAAoBC,mBAAEA,EAAqB,GAAEC,cAAEA,EAAaC,SAAEA,GAAW,EAAKC,QAAEA,EAAOC,SAAEA,IAC9F,OAAKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,KAAIC,GAAY,sCAAsCA,OAEhFC,KAAK,SAEJT,EAAQO,KAAI,EAAGG,QAAOC,QAAOC,eAC1BT,EAACU,+UAAAA,CAAAA,CACGd,SAAUA,EACVe,IAAKH,EACLI,QAAUC,GAAsBf,EAASU,EAAOK,GAChDX,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EM,KAAK,UACDL,GAEHd,IAAkBa,GAASR,EAACe,OAAAA,CAAKb,UAAU,6BAC3CK,MAxBN,IA6Bf"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import e from"../BaseElement/BaseElement.js";import s from"../PayButton/PayButton.js";import{assertIsDropin as i,getRegulatoryDefaults as n,sanitizeResponse as o,verifyPaymentDidNotFail as r,cleanupFinalResult as a}from"./utils.js";import l from"../../../core/Errors/AdyenCheckoutError.js";import{hasOwnProperty as h}from"../../../utils/hasOwnProperty.js";import{ANALYTICS_SUBMIT_STR as d}from"../../../core/Analytics/constants.js";function c(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter((function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable})))),i.forEach((function(e){c(t,e,s[e])}))}return t}function m(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,i)}return s}(Object(e)).forEach((function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))})),t}class u extends e{buildElementProps(t){const e=p({showPayButton:!0},this.core.getCorePropsForComponent(),!!(null==t?void 0:t.isStoredPaymentMethod)?{}:this.core.paymentMethodsResponse.find((null==t?void 0:t.type)||this.constructor.type),t),s=i(this);this.props=this.formatProps(p({},this.constructor.defaultProps,n(this.core.options.countryCode,s),e))}storeElementRefOnCore(t){(null==t?void 0:t.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(t){this.state=p({},this.state,t),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}setElementStatus(t,e){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(t,e),this}setStatus(t,e){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(t,e),this}onChange(){var t,e;const s=this.isValid,i={data:this.data,errors:this.state.errors,valid:this.state.valid,isValid:s};return null===(t=(e=this.props).onChange)||void 0===t||t.call(e,i,this.elementRef),i}setUpAnalytics(t){var e;const s=null===(e=this.props.session)||void 0===e?void 0:e.id;return this.props.modules.analytics.setUp(p({},t,s&&{sessionId:s}))}submitAnalytics(t){try{let e=this.constructor.analyticsType;e||(e="scheme"===this.constructor.type||"bcmc"===this.constructor.type?this.constructor.type:this.props.type),this.props.modules.analytics.sendAnalytics(e,t)}catch(t){console.warn("Failed to submit the analytics event")}}submit(){this.isValid?this.makePaymentsCall().then(o).then(r).then(this.handleResponse).catch(this.handleFailedResult):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise(((t,e)=>this.props.beforeSubmit(this.data,this.elementRef,{resolve:t,reject:e}))):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new l("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){return new Promise(((t,e)=>{this.submitAnalytics({type:d}),this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:t,reject:e})}))}async submitUsingSessionsFlow(t){this.submitAnalytics({type:d});try{return await this.core.session.submitPayment(t)}catch(t){return this.handleError(t),Promise.reject(t)}}onComplete(t){this.props.onComplete&&this.props.onComplete(t,this.elementRef)}handleAdditionalDetails(t){this.makeAdditionalDetailsCall(t).then(o).then(r).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(t){return this.setElementStatus("loading"),this.props.onAdditionalDetails?new Promise(((e,s)=>{this.props.onAdditionalDetails(t,this.elementRef,{resolve:e,reject:s})})):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(t.data):void this.handleError(new l("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(t){try{return await this.core.session.submitDetails(t)}catch(t){return this.handleError(t),Promise.reject(t)}}handleAction(t,e={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(t,m(p({},this.elementRef.props,e),{onAdditionalDetails:this.handleAdditionalDetails}));return s?(this.unmount(),s.mount(this._node)):null}handleResponse(t){var e,s;const i=o(t);i.action?this.elementRef.handleAction(i.action):(null===(s=i.order)||void 0===s||null===(e=s.remainingAmount)||void 0===e?void 0:e.value)>0?this.handleOrder(i):this.handleSuccessResult(i)}updateParent(t={}){return this.elementRef.core.update(t)}get isValid(){return!1}get icon(){const t=this.props.paymentMethodType||this.type;var e;return null!==(e=this.props.icon)&&void 0!==e?e:this.resources.getImage()(t)}get displayName(){var t,e;const s=null===(e=this.core.paymentMethodsResponse)||void 0===e||null===(t=e.paymentMethods)||void 0===t?void 0:t.find((t=>t.type===this.type));return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(t){return new Promise(((e,s)=>{if(!this.props.onPaymentMethodsRequest)return s(new Error("onPaymentMethodsRequest is not implemented"));this.props.onPaymentMethodsRequest({order:{orderData:t.orderData,pspReference:t.pspReference},locale:this.core.options.locale},{resolve:e,reject:s})})).catch((t=>{this.handleError(new l("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:t}))})).then((e=>this.core.update(m(p({},e&&{paymentMethodsResponse:e}),{order:t,amount:t.remainingAmount}))))}constructor(e,n){super(e,n),c(this,"componentRef",void 0),c(this,"resources",void 0),c(this,"elementRef",void 0),c(this,"handleError",(t=>{this.setElementStatus("ready"),this.props.onError&&this.props.onError(t,this.elementRef)})),c(this,"handleOrder",(t=>{const{order:e}=t;(this.core.session?this.core.update({order:e}):this.handleAdvanceFlowPaymentMethodsUpdate(e)).then((()=>{var t,s;null===(t=(s=this.props).onOrderUpdated)||void 0===t||t.call(s,{order:e})}))})),c(this,"handleFailedResult",(t=>{var e,s;i(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),a(t),null===(e=(s=this.props).onPaymentFailed)||void 0===e||e.call(s,t,this.elementRef)})),c(this,"handleSuccessResult",(t=>{var e,s;i(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),a(t),null===(e=(s=this.props).onPaymentCompleted)||void 0===e||e.call(s,t,this.elementRef)})),c(this,"setComponentRef",(t=>{this.componentRef=t})),c(this,"payButton",(e=>t(s,m(p({},e),{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,onClick:this.submit})))),this.constructor.type&&this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.elementRef=n&&n.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props)}}c(u,"type",void 0),c(u,"txVariants",[]);export{u as UIElement,u as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import e from"../BaseElement/BaseElement.js";import s from"../PayButton/PayButton.js";import{assertIsDropin as i,getRegulatoryDefaults as n,sanitizeResponse as o,verifyPaymentDidNotFail as r,cleanupFinalResult as a}from"./utils.js";import l from"../../../core/Errors/AdyenCheckoutError.js";import{hasOwnProperty as h}from"../../../utils/hasOwnProperty.js";import{ANALYTICS_SUBMIT_STR as d}from"../../../core/Analytics/constants.js";function c(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter((function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable})))),i.forEach((function(e){c(t,e,s[e])}))}return t}function m(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,i)}return s}(Object(e)).forEach((function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))})),t}class u extends e{buildElementProps(t){const e=p({showPayButton:!0},this.core.getCorePropsForComponent(),!!(null==t?void 0:t.isStoredPaymentMethod)?{}:this.core.paymentMethodsResponse.find((null==t?void 0:t.type)||this.constructor.type),t),s=i(this);this.props=this.formatProps(p({},this.constructor.defaultProps,n(this.core.options.countryCode,s),e))}storeElementRefOnCore(t){(null==t?void 0:t.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(t){this.state=p({},this.state,t),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}setElementStatus(t,e){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(t,e),this}setStatus(t,e){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(t,e),this}onChange(){var t,e;const s=this.isValid,i={data:this.data,errors:this.state.errors,valid:this.state.valid,isValid:s};return null===(t=(e=this.props).onChange)||void 0===t||t.call(e,i,this.elementRef),i}setUpAnalytics(t){var e;const s=null===(e=this.props.session)||void 0===e?void 0:e.id;return this.props.modules.analytics.setUp(p({},t,s&&{sessionId:s}))}submitAnalytics(t){try{let e=this.constructor.analyticsType;e||(e="scheme"===this.constructor.type||"bcmc"===this.constructor.type?this.constructor.type:this.props.type),this.props.modules.analytics.sendAnalytics(e,t)}catch(t){console.warn("Failed to submit the analytics event")}}submit(){this.isValid?this.makePaymentsCall().then(o).then(r).then(this.handleResponse).catch(this.handleFailedResult):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise(((t,e)=>this.props.beforeSubmit(this.data,this.elementRef,{resolve:t,reject:e}))):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new l("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){return new Promise(((t,e)=>{this.submitAnalytics({type:d}),this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:t,reject:e})}))}async submitUsingSessionsFlow(t){this.submitAnalytics({type:d});try{return await this.core.session.submitPayment(t)}catch(t){return this.handleError(t),Promise.reject(t)}}onComplete(t){this.props.onComplete&&this.props.onComplete(t,this.elementRef)}handleAdditionalDetails(t){this.makeAdditionalDetailsCall(t).then(o).then(r).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(t){return this.setElementStatus("loading"),this.props.onAdditionalDetails?new Promise(((e,s)=>{this.props.onAdditionalDetails(t,this.elementRef,{resolve:e,reject:s})})):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(t.data):void this.handleError(new l("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(t){try{return await this.core.session.submitDetails(t)}catch(t){return this.handleError(t),Promise.reject(t)}}handleAction(t,e={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(t,m(p({},this.elementRef.props,e),{onAdditionalDetails:this.handleAdditionalDetails}));return s?(this.unmount(),s.mount(this._node)):null}handleResponse(t){var e,s;const i=o(t);i.action?this.elementRef.handleAction(i.action):(null===(s=i.order)||void 0===s||null===(e=s.remainingAmount)||void 0===e?void 0:e.value)>0?this.handleOrder(i):this.handleSuccessResult(i)}updateParent(t={}){return this.elementRef.core.update(t)}get isValid(){return!1}get icon(){const t=this.props.paymentMethodType||this.type;var e;return null!==(e=this.props.icon)&&void 0!==e?e:this.resources.getImage()(t)}get displayName(){var t,e;const s=null===(e=this.core.paymentMethodsResponse)||void 0===e||null===(t=e.paymentMethods)||void 0===t?void 0:t.find((t=>t.type===this.type));return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(t,e){return new Promise(((e,s)=>{if(!this.props.onPaymentMethodsRequest)return s(new Error("onPaymentMethodsRequest is not implemented"));this.props.onPaymentMethodsRequest(m(p({},t&&{order:{orderData:t.orderData,pspReference:t.pspReference}}),{locale:this.core.options.locale}),{resolve:e,reject:s})})).catch((t=>{this.handleError(new l("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:t}))})).then((s=>this.core.update(m(p({},s&&{paymentMethodsResponse:s}),{order:t,amount:t?t.remainingAmount:e}))))}constructor(e,n){super(e,n),c(this,"componentRef",void 0),c(this,"resources",void 0),c(this,"elementRef",void 0),c(this,"handleError",(t=>{this.setElementStatus("ready"),this.props.onError&&this.props.onError(t,this.elementRef)})),c(this,"handleOrder",(t=>{const{order:e}=t;(this.core.session?this.core.update({order:e}):this.handleAdvanceFlowPaymentMethodsUpdate(e)).then((()=>{var t,s;null===(t=(s=this.props).onOrderUpdated)||void 0===t||t.call(s,{order:e})}))})),c(this,"handleFailedResult",(t=>{var e,s;i(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),a(t),null===(e=(s=this.props).onPaymentFailed)||void 0===e||e.call(s,t,this.elementRef)})),c(this,"handleSuccessResult",(t=>{var e,s;i(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),a(t),null===(e=(s=this.props).onPaymentCompleted)||void 0===e||e.call(s,t,this.elementRef)})),c(this,"setComponentRef",(t=>{this.componentRef=t})),c(this,"payButton",(e=>t(s,m(p({},e),{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,onClick:this.submit})))),this.constructor.type&&this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.elementRef=n&&n.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props)}}c(u,"type",void 0),c(u,"txVariants",[]);export{u as UIElement,u as default};
2
2
  //# sourceMappingURL=UIElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore } from '../../../core/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport type { ComponentMethodsRef, IUIElement, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n AdditionalDetailsStateData,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentResponse\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\n\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> implements IUIElement {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n // Only register UIElements that have the 'type' set. Drop-in for example does not have.\n if (this.constructor['type']) {\n this.core.register(this.constructor as NewableComponent);\n }\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n const paymentMethodsResponseProps = isStoredPaymentMethod\n ? {}\n : this.core.paymentMethodsResponse.find(componentProps?.type || this.constructor['type']);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodsResponseProps,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): object {\n const isValid = this.isValid;\n const state = { data: this.data, errors: this.state.errors, valid: this.state.valid, isValid };\n\n this.props.onChange?.(state, this.elementRef);\n\n return state;\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n try {\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules.analytics.sendAnalytics(component, analyticsObj);\n } catch (error) {\n console.warn('Failed to submit the analytics event');\n }\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall().then(sanitizeResponse).then(verifyPaymentDidNotFail).then(this.handleResponse).catch(this.handleFailedResult);\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error) {\n this.handleError(error);\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzODIzRDY4REFDQzk0QjlGRjgzMDVEQyJ98uZI4thGveOByYbomCeeP2Gy2rzs99FOBoDYVeWIUjyM+gfnW89DdJZAhxe74Tv0TnL5DRQYPCTRQPOoLbQ21NaeSho70FNE+n8X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wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsStateData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsStateData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error) {\n this.handleError(error);\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement<P> | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = sanitizeResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protect _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n private async handleAdvanceFlowPaymentMethodsUpdate(order: Order) {\n return new Promise<PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return reject(new Error('onPaymentMethodsRequest is not implemented'));\n }\n\n this.props.onPaymentMethodsRequest(\n {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n },\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order.remainingAmount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","buildElementProps","componentProps","finalProps","_object_spread","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","constructor","isDropin","assertIsDropin","props","formatProps","getRegulatoryDefaults","options","countryCode","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","isValid","data","errors","valid","call","setUpAnalytics","setUpAnalyticsObj","_this_props_session","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","component","sendAnalytics","error","console","warn","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","_object_spread_props","unmount","mount","_node","rawResponse","response","order","remainingAmount","value","handleOrder","handleSuccessResult","updateParent","update","icon","paymentMethodType","_this_props_icon","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","_this_core_paymentMethodsResponse","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","cause","amount","checkout","super","_define_property","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"g4CA4BO,MAAeA,UAA6DC,EAyC5DC,iBAAAA,CAAkBC,GACjC,MAMMC,EAAaC,EAAA,CACfC,eAAe,GAPKC,KAAKC,KAAKC,8BACFN,aAAAA,EAAAA,EAAgBO,uBAE1C,GACAH,KAAKC,KAAKG,uBAAuBC,MAAKT,eAAAA,EA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AsBf,KAAKU,MACpC,EAhCA8G,EAPkB/H,EAOJa,YAAOsI,GAKrBpB,EAZkB/H,EAYJoJ,aAAuB"}
1
+ {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore } from '../../../core/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport type { ComponentMethodsRef, IUIElement, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n AdditionalDetailsStateData,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentResponse\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\n\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> implements IUIElement {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n // Only register UIElements that have the 'type' set. Drop-in for example does not have.\n if (this.constructor['type']) {\n this.core.register(this.constructor as NewableComponent);\n }\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n const paymentMethodsResponseProps = isStoredPaymentMethod\n ? {}\n : this.core.paymentMethodsResponse.find(componentProps?.type || this.constructor['type']);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodsResponseProps,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): object {\n const isValid = this.isValid;\n const state = { data: this.data, errors: this.state.errors, valid: this.state.valid, isValid };\n\n this.props.onChange?.(state, this.elementRef);\n\n return state;\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n try {\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules.analytics.sendAnalytics(component, analyticsObj);\n } catch (error) {\n console.warn('Failed to submit the analytics event');\n }\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall().then(sanitizeResponse).then(verifyPaymentDidNotFail).then(this.handleResponse).catch(this.handleFailedResult);\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error) {\n this.handleError(error);\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2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k4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsStateData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsStateData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error) {\n this.handleError(error);\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement<P> | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = sanitizeResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protect _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return reject(new Error('onPaymentMethodsRequest is not implemented'));\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","buildElementProps","componentProps","finalProps","_object_spread","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","constructor","isDropin","assertIsDropin","props","formatProps","getRegulatoryDefaults","options","countryCode","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","isValid","data","errors","valid","call","setUpAnalytics","setUpAnalyticsObj","_this_props_session","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","component","sendAnalytics","error","console","warn","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","_object_spread_props","unmount","mount","_node","rawResponse","response","order","remainingAmount","value","handleOrder","handleSuccessResult","updateParent","update","icon","paymentMethodType","_this_props_icon","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","_this_core_paymentMethodsResponse","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","cause","checkout","super","_define_property","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"g4CA6BO,MAAeA,UAA6DC,EAyC5DC,iBAAAA,CAAkBC,GACjC,MAMMC,EAAaC,EAAA,CACfC,eAAe,GAPKC,KAAKC,KAAKC,8BACFN,aAAAA,EAAAA,EAAgBO,uBAE1C,GACAH,KAAKC,KAAKG,uBAAuBC,MAAKT,eAAAA,EAAgBU,OAAQN,KAAKO,YAAmB,MAMrFX,GAGDY,EAAWC,EAAeT,MAEhCA,KAAKU,MAAQV,KAAKW,YAAYb,EAAA,CAAA,EACvBE,KAAKO,yBACLK,EAAsBZ,KAAKC,KAAKY,QAAQC,YAAaN,GACrDX,GAEX,CAEUkB,qBAAAA,CAAsBL,IACvBA,aAAAA,EAAAA,EAAOF,WACRR,KAAKC,KAAKe,sBAAsBhB,KAExC,CAEOiB,WAAAA,GACH,OAAOC,QAAQC,SACnB,CAEOC,QAAAA,CAASC,GACZrB,KAAKsB,MAAQxB,KAAKE,KAAKsB,MAAUD,GACjCrB,KAAKuB,UACT,CAEOC,cAAAA,GAEH,OADIxB,KAAKyB,cAAgBzB,KAAKyB,aAAaD,gBAAgBxB,KAAKyB,aAAaD,iBACtExB,IACX,CAEO0B,gBAAAA,CAAiBC,EAAyBjB,GAC7C,IAAAkB,EACA,OADe,QAAfA,EAAA5B,KAAK6B,sBAALD,GAAAA,EAAiBE,UAAUH,EAAQjB,GAC5BV,IACX,CAEO8B,SAA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AK3I,MACvCA,KAAK8E,aAAe9E,KAAK8E,aAAa6D,KAAK3I,MAC3CA,KAAK6F,YAAc7F,KAAK6F,YAAY8C,KAAK3I,MACzCA,KAAKyE,wBAA0BzE,KAAKyE,wBAAwBkE,KAAK3I,MACjEA,KAAK4D,eAAiB5D,KAAK4D,eAAe+E,KAAK3I,MAC/CA,KAAK0B,iBAAmB1B,KAAK0B,iBAAiBiH,KAAK3I,MACnDA,KAAKgD,gBAAkBhD,KAAKgD,gBAAgB2F,KAAK3I,MACjDA,KAAKwD,iBAAmBxD,KAAKwD,iBAAiBmF,KAAK3I,MACnDA,KAAK0E,0BAA4B1E,KAAK0E,0BAA0BiE,KAAK3I,MACrEA,KAAKmE,wBAA0BnE,KAAKmE,wBAAwBwE,KAAK3I,MAEjEA,KAAK6B,WAAcnB,GAASA,EAAMmB,YAAe7B,KACjDA,KAAKoG,UAAYpG,KAAKU,MAAMmC,QAAU7C,KAAKU,MAAMmC,QAAQuD,eAAYwC,EAErE5I,KAAKe,sBAAsBf,KAAKU,MACpC,EAhCA8G,EAPkB/H,EAOJa,YAAOsI,GAKrBpB,EAZkB/H,EAYJoJ,aAAuB"}
@@ -1,2 +1,2 @@
1
- const e=["action","resultCode","sessionData","order","sessionResult","donationToken","error"];function o(o){const n=[],t=Object.keys(o).reduce(((t,r)=>(e.includes(r)?t[r]=o[r]:n.push(r),t)),{});return n.length&&console.warn(`The following properties should not be passed to the client: ${n.join(", ")}`),t}function n(e){e&&(delete e.order,delete e.action,e.donationToken&&0!==e.donationToken.length||delete e.donationToken)}function t(e){return["Cancelled","Error","Refused"].includes(e.resultCode)?Promise.reject(e):Promise.resolve(e)}function r(e){if(!e)return!1;return"object"==typeof e.activePaymentMethod&&"function"==typeof e.closeActivePaymentMethod}function i(e,o){return"FI"===e&&o?{openFirstPaymentMethod:!1,openFirstStoredPaymentMethod:!1}:{}}export{r as assertIsDropin,n as cleanupFinalResult,i as getRegulatoryDefaults,o as sanitizeResponse,t as verifyPaymentDidNotFail};
1
+ const e=["action","resultCode","sessionData","order","sessionResult","donationToken","error"];function n(n){const o=[],t=Object.keys(n).reduce(((t,r)=>(e.includes(r)?t[r]=n[r]:o.push(r),t)),{});return o.length&&console.warn(`The following properties should not be passed to the client: ${o.join(", ")}`),t}function o(e){e&&(delete e.order,delete e.action,e.donationToken&&0!==e.donationToken.length||delete e.donationToken)}function t(e){return["Cancelled","Error","Refused"].includes(e.resultCode)?Promise.reject(e):Promise.resolve(e)}function r(e){if(!e)return!1;return"object"==typeof e.activePaymentMethod&&"function"==typeof e.closeActivePaymentMethod}function s(e,n){return"FI"===e&&n?{openFirstPaymentMethod:!1,openFirstStoredPaymentMethod:!1}:{}}function i(e){return e&&e.orderData&&e.pspReference?{orderData:e.orderData,pspReference:e.pspReference}:null}export{r as assertIsDropin,o as cleanupFinalResult,s as getRegulatoryDefaults,i as sanitizeOrder,n as sanitizeResponse,t as verifyPaymentDidNotFail};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/UIElement/utils.ts"],"sourcesContent":["import { UIElementStatus } from './types';\nimport { RawPaymentResponse, PaymentResponseData } from '../../../types/global-types';\nimport { IDropin } from '../../Dropin/types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult', 'donationToken', 'error'];\n\nexport function sanitizeResponse(response: RawPaymentResponse): PaymentResponseData {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponseData;\n}\n\n/**\n * Remove not relevant properties in the final payment result object\n *\n * @param paymentResponse\n */\nexport function cleanupFinalResult(paymentResponse?: PaymentResponseData): void {\n if (!paymentResponse) return;\n\n delete paymentResponse.order;\n delete paymentResponse.action;\n if (!paymentResponse.donationToken || paymentResponse.donationToken.length === 0) {\n delete paymentResponse.donationToken;\n }\n}\n\nexport function resolveFinalResult(result: PaymentResponseData): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function verifyPaymentDidNotFail(response: PaymentResponseData): Promise<PaymentResponseData> {\n if (['Cancelled', 'Error', 'Refused'].includes(response.resultCode)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve(response);\n}\n\nexport function assertIsDropin(element: any): element is IDropin {\n if (!element) return false;\n\n const isDropin = typeof element.activePaymentMethod === 'object' && typeof element.closeActivePaymentMethod === 'function';\n return isDropin;\n}\n\nexport function getRegulatoryDefaults(countryCode: string, isDropin: boolean): Record<string, any> {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return isDropin\n ? {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n }\n : {};\n default:\n return {};\n }\n}\n"],"names":["ALLOWED_PROPERTIES","sanitizeResponse","response","removedProperties","sanitizedObject","Object","keys","reduce","acc","cur","includes","push","length","console","warn","join","cleanupFinalResult","paymentResponse","order","action","donationToken","verifyPaymentDidNotFail","resultCode","Promise","reject","resolve","assertIsDropin","element","activePaymentMethod","closeActivePaymentMethod","getRegulatoryDefaults","countryCode","isDropin","openFirstPaymentMethod","openFirstStoredPaymentMethod"],"mappings":"AAIA,MAAMA,EAAqB,CAAC,SAAU,aAAc,cAAe,QAAS,gBAAiB,gBAAiB,SAEvG,SAASC,EAAiBC,GAC7B,MAAMC,EAAoB,GAEpBC,EAAkBC,OAAOC,KAAKJ,GAAUK,QAAO,CAACC,EAAKC,KAClDT,EAAmBU,SAASD,GAG7BD,EAAIC,GAAOP,EAASO,GAFpBN,EAAkBQ,KAAKF,GAIpBD,IACR,CAAC,GAIJ,OAFIL,EAAkBS,QAAQC,QAAQC,KAAK,gEAAgEX,EAAkBY,KAAK,SAE3HX,CACX,CAOO,SAASY,EAAmBC,GAC1BA,WAEEA,EAAgBC,aAChBD,EAAgBE,OAClBF,EAAgBG,eAA0D,IAAzCH,EAAgBG,cAAcR,eACzDK,EAAgBG,cAE/B,CAiBO,SAASC,EAAwBnB,GACpC,MAAI,CAAC,YAAa,QAAS,WAAWQ,SAASR,EAASoB,YAC7CC,QAAQC,OAAOtB,GAGnBqB,QAAQE,QAAQvB,EAC3B,CAEO,SAASwB,EAAeC,GAC3B,IAAKA,EAAS,OAAO,EAGrB,MADwD,iBAAhCA,EAAQC,qBAAgF,mBAArCD,EAAQE,wBAEvF,CAEO,SAASC,EAAsBC,EAAqBC,GACvD,MAES,OAFDD,GAGOC,EACD,CACIC,wBAAwB,EACxBC,8BAA8B,GAIjC,EAEnB"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/UIElement/utils.ts"],"sourcesContent":["import { UIElementStatus } from './types';\nimport { RawPaymentResponse, PaymentResponseData, Order } from '../../../types/global-types';\nimport { IDropin } from '../../Dropin/types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult', 'donationToken', 'error'];\n\nexport function sanitizeResponse(response: RawPaymentResponse): PaymentResponseData {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponseData;\n}\n\n/**\n * Remove not relevant properties in the final payment result object\n *\n * @param paymentResponse\n */\nexport function cleanupFinalResult(paymentResponse?: PaymentResponseData): void {\n if (!paymentResponse) return;\n\n delete paymentResponse.order;\n delete paymentResponse.action;\n if (!paymentResponse.donationToken || paymentResponse.donationToken.length === 0) {\n delete paymentResponse.donationToken;\n }\n}\n\nexport function resolveFinalResult(result: PaymentResponseData): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function verifyPaymentDidNotFail(response: PaymentResponseData): Promise<PaymentResponseData> {\n if (['Cancelled', 'Error', 'Refused'].includes(response.resultCode)) {\n return Promise.reject(response);\n }\n\n return Promise.resolve(response);\n}\n\nexport function assertIsDropin(element: any): element is IDropin {\n if (!element) return false;\n\n const isDropin = typeof element.activePaymentMethod === 'object' && typeof element.closeActivePaymentMethod === 'function';\n return isDropin;\n}\n\nexport function getRegulatoryDefaults(countryCode: string, isDropin: boolean): Record<string, any> {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return isDropin\n ? {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n }\n : {};\n default:\n return {};\n }\n}\n\nexport function sanitizeOrder(order: Order) {\n if (!order || !order.orderData || !order.pspReference) return null;\n return {\n orderData: order.orderData,\n pspReference: order.pspReference\n };\n}\n"],"names":["ALLOWED_PROPERTIES","sanitizeResponse","response","removedProperties","sanitizedObject","Object","keys","reduce","acc","cur","includes","push","length","console","warn","join","cleanupFinalResult","paymentResponse","order","action","donationToken","verifyPaymentDidNotFail","resultCode","Promise","reject","resolve","assertIsDropin","element","activePaymentMethod","closeActivePaymentMethod","getRegulatoryDefaults","countryCode","isDropin","openFirstPaymentMethod","openFirstStoredPaymentMethod","sanitizeOrder","orderData","pspReference"],"mappings":"AAIA,MAAMA,EAAqB,CAAC,SAAU,aAAc,cAAe,QAAS,gBAAiB,gBAAiB,SAEvG,SAASC,EAAiBC,GAC7B,MAAMC,EAAoB,GAEpBC,EAAkBC,OAAOC,KAAKJ,GAAUK,QAAO,CAACC,EAAKC,KAClDT,EAAmBU,SAASD,GAG7BD,EAAIC,GAAOP,EAASO,GAFpBN,EAAkBQ,KAAKF,GAIpBD,IACR,CAAC,GAIJ,OAFIL,EAAkBS,QAAQC,QAAQC,KAAK,gEAAgEX,EAAkBY,KAAK,SAE3HX,CACX,CAOO,SAASY,EAAmBC,GAC1BA,WAEEA,EAAgBC,aAChBD,EAAgBE,OAClBF,EAAgBG,eAA0D,IAAzCH,EAAgBG,cAAcR,eACzDK,EAAgBG,cAE/B,CAiBO,SAASC,EAAwBnB,GACpC,MAAI,CAAC,YAAa,QAAS,WAAWQ,SAASR,EAASoB,YAC7CC,QAAQC,OAAOtB,GAGnBqB,QAAQE,QAAQvB,EAC3B,CAEO,SAASwB,EAAeC,GAC3B,IAAKA,EAAS,OAAO,EAGrB,MADwD,iBAAhCA,EAAQC,qBAAgF,mBAArCD,EAAQE,wBAEvF,CAEO,SAASC,EAAsBC,EAAqBC,GACvD,MAES,OAFDD,GAGOC,EACD,CACIC,wBAAwB,EACxBC,8BAA8B,GAIjC,EAEnB,CAEO,SAASC,EAAcjB,GAC1B,OAAKA,GAAUA,EAAMkB,WAAclB,EAAMmB,aAClC,CACHD,UAAWlB,EAAMkB,UACjBC,aAAcnB,EAAMmB,cAHsC,IAKlE"}
@@ -1,2 +1,2 @@
1
- import e from"../Services/analytics/log-event.js";import t from"../Services/analytics/collect-id.js";import n from"./EventsQueue.js";import{ANALYTICS_EVENT_INFO as o,ANALYTICS_INFO_TIMER_INTERVAL as l,ANALYTICS_EVENT_LOG as c,ANALYTICS_EVENT_ERROR as a,ANALYTICS_PATH as r}from"./constants.js";import{debounce as i}from"../../utils/debounce.js";import{createAnalyticsObject as s}from"./utils.js";import{analyticsPreProcessor as u}from"./analyticsPreProcessor.js";function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){m(e,t,n[t])}))}return e}let d=null,p=!1,f=null;const b=({loadingContext:m,locale:b,clientKey:g,analytics:j,amount:v,analyticsContext:h,bundleType:P})=>{const A=y({},{enabled:!0,telemetry:!0,checkoutAttemptId:null},j),{telemetry:O,enabled:k}=A;!0===O&&!0===k&&A.checkoutAttemptId&&(d=A.checkoutAttemptId);const w=e({loadingContext:m,locale:b}),x=t({analyticsContext:h,clientKey:g,locale:b,amount:v,analyticsPath:r,bundleType:P}),C=n({analyticsContext:h,clientKey:g,analyticsPath:r}),E=()=>d?C.run(d):Promise.resolve(null),I={setUp:async e=>{const{enabled:t,payload:n,telemetry:o}=A;if(!0===t){if(!0===o&&!d)try{const t=await x(y({},e,n&&y({},n)));d=t}catch(e){console.warn("Fetching checkoutAttemptId failed."+(e?` Error=${e}`:""))}p||(w(e),p=!0)}},getCheckoutAttemptId:()=>d,getEventsQueue:()=>C,createAnalyticsEvent:({event:e,data:t})=>{((e,t)=>{const n=e===o?e:`${e}s`;C.add(`${n}`,t),e===o&&(clearTimeout(f),f=setTimeout(E,l)),e!==c&&e!==a||(clearTimeout(f),i(E)())})(e,s(y({event:e},t)))},getEnabled:()=>A.enabled,sendAnalytics:null};return I.sendAnalytics=u(I),I};export{b as default};
1
+ import t from"../Services/analytics/log-event.js";import e from"../Services/analytics/collect-id.js";import n from"./EventsQueue.js";import{ANALYTICS_EVENT_INFO as o,ANALYTICS_INFO_TIMER_INTERVAL as l,ANALYTICS_EVENT_LOG as c,ANALYTICS_EVENT_ERROR as r,ANALYTICS_PATH as a}from"./constants.js";import{debounce as s}from"../../utils/debounce.js";import{createAnalyticsObject as i}from"./utils.js";import{analyticsPreProcessor as u}from"./analyticsPreProcessor.js";function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),o.forEach((function(e){m(t,e,n[e])}))}return t}let d=null,p=!1,f=null;const b=({loadingContext:m,locale:b,clientKey:g,analytics:j,amount:v,analyticsContext:h,bundleType:P})=>{const A=y({},{enabled:!0,telemetry:!0,checkoutAttemptId:null},j),{telemetry:O,enabled:k}=A;!0===O&&!0===k&&A.checkoutAttemptId&&(d=A.checkoutAttemptId);const w=t({loadingContext:m,locale:b}),x=e({analyticsContext:h,clientKey:g,locale:b,amount:v,analyticsPath:a,bundleType:P}),C=n({analyticsContext:h,clientKey:g,analyticsPath:a}),E=()=>d?C.run(d):Promise.resolve(null),I={setUp:async t=>{const{enabled:e,payload:n,telemetry:o}=A;if(!0===e){if(!0===o&&!d)try{const e=await x(y({},t,n&&y({},n)));d=e}catch(t){console.warn("Fetching checkoutAttemptId failed."+(t?` Error=${t}`:""))}p||(w(t),p=!0)}},getCheckoutAttemptId:()=>d,getEventsQueue:()=>C,createAnalyticsEvent:({event:t,data:e})=>{const n=i(y({event:t},e));return((t,e)=>{const n=t===o?t:`${t}s`;C.add(`${n}`,e),t===o&&(clearTimeout(f),f=setTimeout(E,l)),t!==c&&t!==r||(clearTimeout(f),s(E)())})(t,n),n},getEnabled:()=>A.enabled,sendAnalytics:null};return I.sendAnalytics=u(I),I};export{b as default};
2
2
  //# sourceMappingURL=Analytics.js.map