@adyen/adyen-web 6.34.0 → 6.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/cjs/adyen.css +4 -5
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +86 -44
  6. package/dist/es/adyen.css +4 -5
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  9. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  10. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  11. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  12. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  18. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  20. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  22. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  23. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  24. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  25. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  27. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  28. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  29. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  30. package/dist/es/components/Card/constants.js.map +1 -1
  31. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  32. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  33. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  34. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  35. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  36. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  37. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  38. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  39. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  40. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  41. package/dist/es/components/Econtext/Econtext.js +1 -1
  42. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  43. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  44. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  45. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  46. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  47. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  48. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  49. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  50. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  51. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  52. package/dist/es/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  53. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  54. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  55. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  56. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  57. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  58. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  59. package/dist/es/components/internal/FormFields/InputDate/utils.js +1 -1
  60. package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
  61. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  62. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  63. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  64. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  65. package/dist/es/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  66. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  67. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  68. package/dist/es/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  69. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  70. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  71. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  72. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  73. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  74. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  75. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  76. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  77. package/dist/es/core/Analytics/Analytics.js +1 -1
  78. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  79. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  80. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  81. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  82. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  83. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  84. package/dist/es/core/config.js +1 -1
  85. package/dist/es/core/config.js.map +1 -1
  86. package/dist/es/core/core.js +1 -1
  87. package/dist/es/core/core.js.map +1 -1
  88. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  89. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  90. package/dist/es/external/preact/dist/preact.js +1 -1
  91. package/dist/es/external/preact/dist/preact.js.map +1 -1
  92. package/dist/es/index.d.ts +86 -44
  93. package/dist/es/language/utils.js +1 -1
  94. package/dist/es/language/utils.js.map +1 -1
  95. package/dist/es/utils/Script.js.map +1 -1
  96. package/dist/es/utils/createSdkData.js +1 -1
  97. package/dist/es/utils/createSdkData.js.map +1 -1
  98. package/dist/es/utils/debounce.js.map +1 -1
  99. package/dist/es/utils/getErrorMessage.js +1 -1
  100. package/dist/es/utils/getErrorMessage.js.map +1 -1
  101. package/dist/es/utils/hookUtils.js.map +1 -1
  102. package/dist/es/utils/promiseTimeout.js.map +1 -1
  103. package/dist/es-legacy/adyen.css +4 -5
  104. package/dist/es-legacy/adyen.css.map +1 -1
  105. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  106. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  107. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  108. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  109. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  110. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  111. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  112. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  113. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  114. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  115. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  116. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  117. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  118. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +2 -0
  119. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -0
  120. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js +2 -0
  121. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.module.scss.js.map +1 -0
  122. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  123. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  124. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  125. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  126. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  127. package/dist/es-legacy/components/Card/constants.js.map +1 -1
  128. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  129. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  130. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  131. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  132. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  133. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  134. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  135. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  136. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  137. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  138. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  139. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  140. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  141. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  142. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  143. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  144. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  145. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  146. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  147. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  148. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  149. package/dist/es-legacy/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  150. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  151. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  152. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  153. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  154. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  155. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  156. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js +1 -1
  157. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
  158. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  159. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  160. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  161. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js +1 -1
  162. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  163. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  164. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  165. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  166. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js +1 -1
  167. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  168. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  169. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  170. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  171. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  172. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  173. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  174. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  175. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  176. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  177. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  178. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  179. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  180. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  181. package/dist/es-legacy/core/config.js +1 -1
  182. package/dist/es-legacy/core/config.js.map +1 -1
  183. package/dist/es-legacy/core/core.js +1 -1
  184. package/dist/es-legacy/core/core.js.map +1 -1
  185. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  186. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  187. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  188. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  189. package/dist/es-legacy/language/utils.js +1 -1
  190. package/dist/es-legacy/language/utils.js.map +1 -1
  191. package/dist/es-legacy/utils/Script.js.map +1 -1
  192. package/dist/es-legacy/utils/createSdkData.js +1 -1
  193. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  194. package/dist/es-legacy/utils/debounce.js.map +1 -1
  195. package/dist/es-legacy/utils/getErrorMessage.js +1 -1
  196. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  197. package/dist/es-legacy/utils/hookUtils.js.map +1 -1
  198. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  199. package/package.json +27 -27
  200. package/styles/adyen.css +4 -5
  201. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  202. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  203. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  204. package/dist/es/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
  205. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js +0 -2
  206. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioButtonIcon.js.map +0 -1
  207. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js +0 -2
  208. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{debounce as t,DEFAULT_DEBOUNCE_TIME_MS as e}from"../../utils/debounce.js";import{processAnalyticsData as s}from"./utils.js";import{AnalyticsEventCategory as i}from"./events/AbstractAnalyticsEvent.js";import n from"../../utils/Storage.js";import{LIBRARY_BUNDLE_TYPE as o,LIBRARY_VERSION as a}from"../config.js";function r(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const c=e;class d{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(t){this._checkoutAttemptId=t}async setUp({sessionId:t,checkoutStage:e,locale:i}={}){try{const n=this.storage.get(),r=function(t){if(!t?.timestamp)return!1;const e=Date.now()-9e5;return t.timestamp>e}(n),{applicationInfo:c,checkoutAttemptId:d}=s(this.analyticsData)??{},h=r?n?.id:d,l={version:a,buildType:o,channel:"Web",platform:"Web",locale:i,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:e||"checkout",level:this.enabled?"all":"initial",...c&&{applicationInfo:c},...t&&{sessionId:t},...h&&{checkoutAttemptId:h}};this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(l),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:r?n.timestamp:Date.now()})}catch(t){this.enabled=!1,console.warn("Analytics: Error setting up",t)}}sendAnalytics(t){if(this.enabled)try{this.addEventToQueue(t)}catch(t){console.warn("Analytics: Error adding event to queue",t)}}async sendFlavor(t){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(t):this.pendingFlavor||(this.pendingFlavor=t))}async dispatchFlavor(t){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(t,this.checkoutAttemptId)}catch(t){console.warn("Analytics: Error reporting flavor",t)}}}flush(){this.sendEvents()}addEventToQueue(t){this.eventsQueue.add(t),t.getEventCategory()===i.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled)return;if(!this.eventsQueue.hasEvents)return;const t={channel:"Web",platform:"Web",info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(t,this.checkoutAttemptId)}catch(t){console.warn("Analytics: Error sending events",t)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const t=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(t)}this.sendEvents()}constructor({service:e,eventQueue:s,enabled:i,analyticsData:o}){r(this,"analyticsData",void 0),r(this,"service",void 0),r(this,"eventsQueue",void 0),r(this,"storage",new n("checkout-attempt-id","sessionStorage")),r(this,"debouncedSendInfoEvents",void 0),r(this,"debouncedSendEvents",void 0),r(this,"_checkoutAttemptId",void 0),r(this,"enabled",!0),r(this,"isFlavorReported",!1),r(this,"pendingFlavor",void 0),this.service=e,this.eventsQueue=s,this.debouncedSendInfoEvents=t(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=t(this.sendEvents.bind(this),c),void 0!==i&&(this.enabled=i),o&&(this.analyticsData=o)}}export{d as default};
1
+ import{debounce as t,DEFAULT_DEBOUNCE_TIME_MS as e}from"../../utils/debounce.js";import{processAnalyticsData as s}from"./utils.js";import{AnalyticsEventCategory as i}from"./events/AbstractAnalyticsEvent.js";import n from"../../utils/Storage.js";import{PLATFORM as o,CHANNEL as a,LIBRARY_BUNDLE_TYPE as r,LIBRARY_VERSION as c}from"../config.js";function d(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const h=e;class l{get checkoutAttemptId(){return this._checkoutAttemptId}set checkoutAttemptId(t){this._checkoutAttemptId=t}async setUp({sessionId:t,checkoutStage:e,locale:i}={}){try{const n=this.storage.get(),d=function(t){if(!t?.timestamp)return!1;const e=Date.now()-9e5;return t.timestamp>e}(n),{applicationInfo:h,checkoutAttemptId:l}=s(this.analyticsData)??{},u=d?n?.id:l,v={version:c,buildType:r,channel:a.WEB,platform:o,locale:i,referrer:window.location.href,screenWidth:window.screen.width,checkoutStage:e||"checkout",level:this.enabled?"all":"initial",...h&&{applicationInfo:h},...t&&{sessionId:t},...u&&{checkoutAttemptId:u}};this.checkoutAttemptId=await this.service.requestCheckoutAttemptId(v),this.dispatchPendingAnalytics(),this.storage.set({id:this.checkoutAttemptId,timestamp:d?n.timestamp:Date.now()})}catch(t){this.enabled=!1,console.warn("Analytics: Error setting up",t)}}sendAnalytics(t){if(this.enabled)try{this.addEventToQueue(t)}catch(t){console.warn("Analytics: Error adding event to queue",t)}}async sendFlavor(t){this.isFlavorReported||(this.checkoutAttemptId?await this.dispatchFlavor(t):this.pendingFlavor||(this.pendingFlavor=t))}async dispatchFlavor(t){if(!this.isFlavorReported&&this.checkoutAttemptId){this.isFlavorReported=!0;try{await this.service.reportIntegrationFlavor(t,this.checkoutAttemptId)}catch(t){console.warn("Analytics: Error reporting flavor",t)}}}flush(){this.sendEvents()}addEventToQueue(t){this.eventsQueue.add(t),t.getEventCategory()===i.info?this.debouncedSendInfoEvents():this.debouncedSendEvents()}async sendEvents(){if(!this.checkoutAttemptId||!this.enabled)return;if(!this.eventsQueue.hasEvents)return;const t={channel:a.WEB,platform:o,info:this.eventsQueue.infoEvents,errors:this.eventsQueue.errorEvents,logs:this.eventsQueue.logEvents};this.eventsQueue.clear();try{await this.service.sendEvents(t,this.checkoutAttemptId)}catch(t){console.warn("Analytics: Error sending events",t)}}dispatchPendingAnalytics(){if(!this.isFlavorReported&&this.pendingFlavor){const t=this.pendingFlavor;this.pendingFlavor=void 0,this.dispatchFlavor(t)}this.sendEvents()}constructor({service:e,eventQueue:s,enabled:i,analyticsData:o}){d(this,"analyticsData",void 0),d(this,"service",void 0),d(this,"eventsQueue",void 0),d(this,"storage",new n("checkout-attempt-id","sessionStorage")),d(this,"debouncedSendInfoEvents",void 0),d(this,"debouncedSendEvents",void 0),d(this,"_checkoutAttemptId",void 0),d(this,"enabled",!0),d(this,"isFlavorReported",!1),d(this,"pendingFlavor",void 0),this.service=e,this.eventsQueue=s,this.debouncedSendInfoEvents=t(this.sendEvents.bind(this),1e4),this.debouncedSendEvents=t(this.sendEvents.bind(this),h),void 0!==i&&(this.enabled=i),o&&(this.analyticsData=o)}}export{l as default};
2
2
  //# sourceMappingURL=Analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Analytics.js","sources":["../../../../src/core/Analytics/Analytics.ts"],"sourcesContent":["import { debounce, DEFAULT_DEBOUNCE_TIME_MS } from '../../utils/debounce';\nimport { processAnalyticsData } from './utils';\nimport { AbstractAnalyticsEvent, AnalyticsEventCategory } from './events/AbstractAnalyticsEvent';\nimport Storage from '../../utils/Storage';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from '../config';\nimport { AnalyticsEventQueue } from './AnalyticsEventQueue';\nimport type { AnalyticsOptions } from './types';\nimport type { AnalyticsEventPayload, IAnalyticsService, RequestAttemptIdPayload } from './AnalyticsService';\n\nexport interface AnalyticsProps {\n service: IAnalyticsService;\n eventQueue: AnalyticsEventQueue;\n enabled?: boolean;\n analyticsData?: AnalyticsOptions['analyticsData'];\n}\n\nexport interface IAnalytics {\n checkoutAttemptId?: string;\n setUp({ sessionId, checkoutStage, locale }: { sessionId?: string; checkoutStage?: 'precheckout' | 'checkout'; locale?: string }): Promise<void>;\n sendFlavor(flavor: 'dropin' | 'components'): Promise<void>;\n sendAnalytics(event: AbstractAnalyticsEvent): void;\n flush(): void;\n}\n\nexport interface CheckoutAttemptIdSessionStorage {\n id: string;\n timestamp: number;\n}\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction isSessionCreatedUnderFifteenMinutes(session: CheckoutAttemptIdSessionStorage | null): boolean {\n const FIFTEEN_MINUTES_IN_MS = 15 * 60 * 1000;\n if (!session?.timestamp) return false;\n const fifteenMinutesAgo = Date.now() - FIFTEEN_MINUTES_IN_MS;\n return session.timestamp > fifteenMinutesAgo;\n}\n\nconst ANALYTICS_INFO_DEBOUNCE_DELAY = process.env.NODE_ENV === 'development' ? 5_000 : 10_000;\nconst ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY = DEFAULT_DEBOUNCE_TIME_MS;\n\nclass Analytics implements IAnalytics {\n private readonly analyticsData?: AnalyticsOptions['analyticsData'];\n private readonly service: IAnalyticsService;\n private readonly eventsQueue: AnalyticsEventQueue;\n private readonly storage = new Storage<CheckoutAttemptIdSessionStorage>('checkout-attempt-id', 'sessionStorage');\n private readonly debouncedSendInfoEvents: () => void;\n private readonly debouncedSendEvents: () => void;\n\n private _checkoutAttemptId?: string;\n private enabled: boolean = true;\n private isFlavorReported = false;\n private pendingFlavor?: 'dropin' | 'components';\n\n constructor({ service, eventQueue, enabled, analyticsData }: AnalyticsProps) {\n this.service = service;\n this.eventsQueue = eventQueue;\n\n this.debouncedSendInfoEvents = debounce(this.sendEvents.bind(this), ANALYTICS_INFO_DEBOUNCE_DELAY);\n this.debouncedSendEvents = debounce(this.sendEvents.bind(this), ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY);\n\n if (enabled !== undefined) this.enabled = enabled;\n if (analyticsData) this.analyticsData = analyticsData;\n }\n\n public get checkoutAttemptId(): string | undefined {\n return this._checkoutAttemptId;\n }\n\n private set checkoutAttemptId(checkoutAttemptId: string) {\n this._checkoutAttemptId = checkoutAttemptId;\n }\n\n public async setUp({\n sessionId,\n checkoutStage,\n locale\n }: { sessionId?: string; locale?: string; checkoutStage?: 'precheckout' | 'checkout' } = {}): Promise<void> {\n try {\n const checkoutAttemptIdSession = this.storage.get();\n const isSessionReusable = isSessionCreatedUnderFifteenMinutes(checkoutAttemptIdSession);\n\n const { applicationInfo, checkoutAttemptId: checkoutAttemptIdFromPayByLink } = processAnalyticsData(this.analyticsData) ?? {};\n\n const availableCheckoutAttemptId: string | undefined = isSessionReusable ? checkoutAttemptIdSession?.id : checkoutAttemptIdFromPayByLink;\n\n const payload: RequestAttemptIdPayload = {\n version: LIBRARY_VERSION,\n buildType: LIBRARY_BUNDLE_TYPE,\n channel: 'Web',\n platform: 'Web',\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n checkoutStage: checkoutStage || 'checkout',\n level: this.enabled ? 'all' : 'initial',\n ...(applicationInfo && { applicationInfo }),\n ...(sessionId && { sessionId }),\n ...(availableCheckoutAttemptId && { checkoutAttemptId: availableCheckoutAttemptId })\n };\n\n this.checkoutAttemptId = await this.service.requestCheckoutAttemptId(payload);\n\n this.dispatchPendingAnalytics();\n\n this.storage.set({\n id: this.checkoutAttemptId,\n timestamp: isSessionReusable ? checkoutAttemptIdSession.timestamp : Date.now()\n });\n } catch (error: unknown) {\n this.enabled = false;\n console.warn('Analytics: Error setting up', error);\n }\n }\n\n public sendAnalytics(event: AbstractAnalyticsEvent): void {\n if (!this.enabled) {\n return;\n }\n\n try {\n this.addEventToQueue(event);\n } catch (error: unknown) {\n console.warn('Analytics: Error adding event to queue', error);\n }\n }\n\n /**\n * Sends the integration flavor to the analytics service.\n * If the checkout attempt ID is not available, it will be stored and sent when it becomes available.\n *\n * @param flavor The integration flavor to send.\n * @returns A promise that resolves when the flavor is sent.\n */\n public async sendFlavor(flavor: 'dropin' | 'components'): Promise<void> {\n if (this.isFlavorReported) return;\n\n if (!this.checkoutAttemptId) {\n if (!this.pendingFlavor) this.pendingFlavor = flavor;\n return;\n }\n\n await this.dispatchFlavor(flavor);\n }\n\n private async dispatchFlavor(flavor: 'dropin' | 'components'): Promise<void> {\n if (this.isFlavorReported) return;\n if (!this.checkoutAttemptId) return;\n\n this.isFlavorReported = true;\n\n try {\n await this.service.reportIntegrationFlavor(flavor, this.checkoutAttemptId);\n } catch (error) {\n console.warn('Analytics: Error reporting flavor', error);\n }\n }\n\n public flush(): void {\n void this.sendEvents();\n }\n\n /**\n * Info events don't have high priority, therefore we add a delay in order to dispatch a batch of events\n * Log/Error events are sent almost immediately. There is a debounce mechanism in place but the delay is very minimal\n *\n * @param event\n * @private\n */\n private addEventToQueue(event: AbstractAnalyticsEvent): void {\n this.eventsQueue.add(event);\n\n if (event.getEventCategory() === AnalyticsEventCategory.info) {\n this.debouncedSendInfoEvents();\n } else {\n this.debouncedSendEvents();\n }\n }\n\n private async sendEvents(): Promise<void> {\n if (!this.checkoutAttemptId || !this.enabled) {\n return;\n }\n\n if (!this.eventsQueue.hasEvents) {\n return;\n }\n\n const payload: AnalyticsEventPayload = {\n channel: 'Web',\n platform: 'Web',\n info: this.eventsQueue.infoEvents,\n errors: this.eventsQueue.errorEvents,\n logs: this.eventsQueue.logEvents\n };\n\n this.eventsQueue.clear();\n\n try {\n await this.service.sendEvents(payload, this.checkoutAttemptId);\n } catch (error) {\n console.warn('Analytics: Error sending events', error);\n }\n }\n\n /**\n * Report the integration flavor and send queued analyic events once the attempt ID is available\n */\n private dispatchPendingAnalytics(): void {\n if (!this.isFlavorReported && this.pendingFlavor) {\n const flavor = this.pendingFlavor;\n this.pendingFlavor = undefined;\n void this.dispatchFlavor(flavor);\n }\n\n void this.sendEvents();\n }\n}\n\nexport default Analytics;\n"],"names":["ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY","DEFAULT_DEBOUNCE_TIME_MS","Analytics","checkoutAttemptId","this","_checkoutAttemptId","setUp","sessionId","checkoutStage","locale","checkoutAttemptIdSession","storage","get","isSessionReusable","session","timestamp","fifteenMinutesAgo","Date","now","isSessionCreatedUnderFifteenMinutes","applicationInfo","checkoutAttemptIdFromPayByLink","processAnalyticsData","analyticsData","availableCheckoutAttemptId","id","payload","version","LIBRARY_VERSION","buildType","LIBRARY_BUNDLE_TYPE","channel","platform","referrer","window","location","href","screenWidth","screen","width","level","enabled","service","requestCheckoutAttemptId","dispatchPendingAnalytics","set","error","console","warn","sendAnalytics","event","addEventToQueue","sendFlavor","flavor","isFlavorReported","dispatchFlavor","pendingFlavor","reportIntegrationFlavor","flush","sendEvents","eventsQueue","add","getEventCategory","AnalyticsEventCategory","info","debouncedSendInfoEvents","debouncedSendEvents","hasEvents","infoEvents","errors","errorEvents","logs","logEvents","clear","undefined","constructor","eventQueue","_define_property","Storage","debounce","bind"],"mappings":"qbAwCA,MACMA,EAA0CC,EAEhD,MAAMC,EAwBF,qBAAWC,GACP,OAAOC,KAAKC,kBAChB,CAEA,qBAAYF,CAAkBA,GAC1BC,KAAKC,mBAAqBF,CAC9B,CAEA,WAAaG,EAAMC,UACfA,EAASC,cACTA,EAAaC,OACbA,GACqF,CAAA,GACrF,IACI,MAAMC,EAA2BN,KAAKO,QAAQC,MACxCC,EAjDlB,SAA6CC,GAEzC,IAAKA,GAASC,UAAW,OAAO,EAChC,MAAMC,EAAoBC,KAAKC,MAFD,IAG9B,OAAOJ,EAAQC,UAAYC,CAC/B,CA4CsCG,CAAoCT,IAExDU,gBAAEA,EAAiBjB,kBAAmBkB,GAAmCC,EAAqBlB,KAAKmB,gBAAkB,CAAA,EAErHC,EAAiDX,EAAoBH,GAA0Be,GAAKJ,EAEpGK,EAAmC,CACrCC,QAASC,EACTC,UAAWC,EACXC,QAAS,MACTC,SAAU,MACVvB,SACAwB,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,MAC3B/B,cAAeA,GAAiB,WAChCgC,MAAOpC,KAAKqC,QAAU,MAAQ,aAC1BrB,GAAmB,CAAEA,sBACrBb,GAAa,CAAEA,gBACfiB,GAA8B,CAAErB,kBAAmBqB,IAG3DpB,KAAKD,wBAA0BC,KAAKsC,QAAQC,yBAAyBjB,GAErEtB,KAAKwC,2BAELxC,KAAKO,QAAQkC,IAAI,CACbpB,GAAIrB,KAAKD,kBACTY,UAAWF,EAAoBH,EAAyBK,UAAYE,KAAKC,OAEjF,CAAE,MAAO4B,GACL1C,KAAKqC,SAAU,EACfM,QAAQC,KAAK,8BAA+BF,EAChD,CACJ,CAEOG,aAAAA,CAAcC,GACjB,GAAK9C,KAAKqC,QAIV,IACIrC,KAAK+C,gB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AAiBmB,wBACjBsD,EAAAzE,KAAiBsC,kBACjBmC,EAAAzE,KAAiBwD,sBACjBiB,EAAAzE,KAAiBO,UAAU,IAAImE,EAAyC,sBAAuB,mBAC/FD,EAAAzE,KAAiB6D,kCACjBY,EAAAzE,KAAiB8D,8BAEjBW,EAAAzE,KAAQC,6BACRwE,EAAAzE,KAAQqC,WAAmB,GAC3BoC,EAAAzE,KAAQkD,oBAAmB,GAC3BuB,EAAAzE,KAAQoD,wBAGJpD,KAAKsC,QAAUA,EACftC,KAAKwD,YAAcgB,EAEnBxE,KAAK6D,wBAA0Bc,EAAS3E,KAAKuD,WAAWqB,KAAK5E,MApBkB,KAqB/EA,KAAK8D,oBAAsBa,EAAS3E,KAAKuD,WAAWqB,KAAK5E,MAAOJ,QAEhD0E,IAAZjC,IAAuBrC,KAAKqC,QAAUA,GACtClB,IAAenB,KAAKmB,cAAgBA,EAC5C"}
1
+ {"version":3,"file":"Analytics.js","sources":["../../../../src/core/Analytics/Analytics.ts"],"sourcesContent":["import { debounce, DEFAULT_DEBOUNCE_TIME_MS } from '../../utils/debounce';\nimport { processAnalyticsData } from './utils';\nimport { AbstractAnalyticsEvent, AnalyticsEventCategory } from './events/AbstractAnalyticsEvent';\nimport Storage from '../../utils/Storage';\nimport { CHANNEL, LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION, PLATFORM } from '../config';\nimport { AnalyticsEventQueue } from './AnalyticsEventQueue';\nimport type { AnalyticsOptions } from './types';\nimport type { AnalyticsEventPayload, IAnalyticsService, RequestAttemptIdPayload } from './AnalyticsService';\n\nexport interface AnalyticsProps {\n service: IAnalyticsService;\n eventQueue: AnalyticsEventQueue;\n enabled?: boolean;\n analyticsData?: AnalyticsOptions['analyticsData'];\n}\n\nexport interface IAnalytics {\n checkoutAttemptId?: string;\n setUp({ sessionId, checkoutStage, locale }: { sessionId?: string; checkoutStage?: 'precheckout' | 'checkout'; locale?: string }): Promise<void>;\n sendFlavor(flavor: 'dropin' | 'components'): Promise<void>;\n sendAnalytics(event: AbstractAnalyticsEvent): void;\n flush(): void;\n}\n\nexport interface CheckoutAttemptIdSessionStorage {\n id: string;\n timestamp: number;\n}\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction isSessionCreatedUnderFifteenMinutes(session: CheckoutAttemptIdSessionStorage | null): boolean {\n const FIFTEEN_MINUTES_IN_MS = 15 * 60 * 1000;\n if (!session?.timestamp) return false;\n const fifteenMinutesAgo = Date.now() - FIFTEEN_MINUTES_IN_MS;\n return session.timestamp > fifteenMinutesAgo;\n}\n\nconst ANALYTICS_INFO_DEBOUNCE_DELAY = process.env.NODE_ENV === 'development' ? 5_000 : 10_000;\nconst ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY = DEFAULT_DEBOUNCE_TIME_MS;\n\nclass Analytics implements IAnalytics {\n private readonly analyticsData?: AnalyticsOptions['analyticsData'];\n private readonly service: IAnalyticsService;\n private readonly eventsQueue: AnalyticsEventQueue;\n private readonly storage = new Storage<CheckoutAttemptIdSessionStorage>('checkout-attempt-id', 'sessionStorage');\n private readonly debouncedSendInfoEvents: () => void;\n private readonly debouncedSendEvents: () => void;\n\n private _checkoutAttemptId?: string;\n private enabled: boolean = true;\n private isFlavorReported = false;\n private pendingFlavor?: 'dropin' | 'components';\n\n constructor({ service, eventQueue, enabled, analyticsData }: AnalyticsProps) {\n this.service = service;\n this.eventsQueue = eventQueue;\n\n this.debouncedSendInfoEvents = debounce(this.sendEvents.bind(this), ANALYTICS_INFO_DEBOUNCE_DELAY);\n this.debouncedSendEvents = debounce(this.sendEvents.bind(this), ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY);\n\n if (enabled !== undefined) this.enabled = enabled;\n if (analyticsData) this.analyticsData = analyticsData;\n }\n\n public get checkoutAttemptId(): string | undefined {\n return this._checkoutAttemptId;\n }\n\n private set checkoutAttemptId(checkoutAttemptId: string) {\n this._checkoutAttemptId = checkoutAttemptId;\n }\n\n public async setUp({\n sessionId,\n checkoutStage,\n locale\n }: { sessionId?: string; locale?: string; checkoutStage?: 'precheckout' | 'checkout' } = {}): Promise<void> {\n try {\n const checkoutAttemptIdSession = this.storage.get();\n const isSessionReusable = isSessionCreatedUnderFifteenMinutes(checkoutAttemptIdSession);\n\n const { applicationInfo, checkoutAttemptId: checkoutAttemptIdFromPayByLink } = processAnalyticsData(this.analyticsData) ?? {};\n\n const availableCheckoutAttemptId: string | undefined = isSessionReusable ? checkoutAttemptIdSession?.id : checkoutAttemptIdFromPayByLink;\n\n const payload: RequestAttemptIdPayload = {\n version: LIBRARY_VERSION,\n buildType: LIBRARY_BUNDLE_TYPE,\n channel: CHANNEL.WEB,\n platform: PLATFORM,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n checkoutStage: checkoutStage || 'checkout',\n level: this.enabled ? 'all' : 'initial',\n ...(applicationInfo && { applicationInfo }),\n ...(sessionId && { sessionId }),\n ...(availableCheckoutAttemptId && { checkoutAttemptId: availableCheckoutAttemptId })\n };\n\n this.checkoutAttemptId = await this.service.requestCheckoutAttemptId(payload);\n\n this.dispatchPendingAnalytics();\n\n this.storage.set({\n id: this.checkoutAttemptId,\n timestamp: isSessionReusable ? checkoutAttemptIdSession.timestamp : Date.now()\n });\n } catch (error: unknown) {\n this.enabled = false;\n console.warn('Analytics: Error setting up', error);\n }\n }\n\n public sendAnalytics(event: AbstractAnalyticsEvent): void {\n if (!this.enabled) {\n return;\n }\n\n try {\n this.addEventToQueue(event);\n } catch (error: unknown) {\n console.warn('Analytics: Error adding event to queue', error);\n }\n }\n\n /**\n * Sends the integration flavor to the analytics service.\n * If the checkout attempt ID is not available, it will be stored and sent when it becomes available.\n *\n * @param flavor The integration flavor to send.\n * @returns A promise that resolves when the flavor is sent.\n */\n public async sendFlavor(flavor: 'dropin' | 'components'): Promise<void> {\n if (this.isFlavorReported) return;\n\n if (!this.checkoutAttemptId) {\n if (!this.pendingFlavor) this.pendingFlavor = flavor;\n return;\n }\n\n await this.dispatchFlavor(flavor);\n }\n\n private async dispatchFlavor(flavor: 'dropin' | 'components'): Promise<void> {\n if (this.isFlavorReported) return;\n if (!this.checkoutAttemptId) return;\n\n this.isFlavorReported = true;\n\n try {\n await this.service.reportIntegrationFlavor(flavor, this.checkoutAttemptId);\n } catch (error) {\n console.warn('Analytics: Error reporting flavor', error);\n }\n }\n\n public flush(): void {\n void this.sendEvents();\n }\n\n /**\n * Info events don't have high priority, therefore we add a delay in order to dispatch a batch of events\n * Log/Error events are sent almost immediately. There is a debounce mechanism in place but the delay is very minimal\n *\n * @param event\n * @private\n */\n private addEventToQueue(event: AbstractAnalyticsEvent): void {\n this.eventsQueue.add(event);\n\n if (event.getEventCategory() === AnalyticsEventCategory.info) {\n this.debouncedSendInfoEvents();\n } else {\n this.debouncedSendEvents();\n }\n }\n\n private async sendEvents(): Promise<void> {\n if (!this.checkoutAttemptId || !this.enabled) {\n return;\n }\n\n if (!this.eventsQueue.hasEvents) {\n return;\n }\n\n const payload: AnalyticsEventPayload = {\n channel: CHANNEL.WEB,\n platform: PLATFORM,\n info: this.eventsQueue.infoEvents,\n errors: this.eventsQueue.errorEvents,\n logs: this.eventsQueue.logEvents\n };\n\n this.eventsQueue.clear();\n\n try {\n await this.service.sendEvents(payload, this.checkoutAttemptId);\n } catch (error) {\n console.warn('Analytics: Error sending events', error);\n }\n }\n\n /**\n * Report the integration flavor and send queued analyic events once the attempt ID is available\n */\n private dispatchPendingAnalytics(): void {\n if (!this.isFlavorReported && this.pendingFlavor) {\n const flavor = this.pendingFlavor;\n this.pendingFlavor = undefined;\n void this.dispatchFlavor(flavor);\n }\n\n void this.sendEvents();\n }\n}\n\nexport default Analytics;\n"],"names":["ANALYTICS_ERROR_AND_LOGS_DEBOUNCE_DELAY","DEFAULT_DEBOUNCE_TIME_MS","Analytics","checkoutAttemptId","this","_checkoutAttemptId","setUp","sessionId","checkoutStage","locale","checkoutAttemptIdSession","storage","get","isSessionReusable","session","timestamp","fifteenMinutesAgo","Date","now","isSessionCreatedUnderFifteenMinutes","applicationInfo","checkoutAttemptIdFromPayByLink","processAnalyticsData","analyticsData","availableCheckoutAttemptId","id","payload","version","LIBRARY_VERSION","buildType","LIBRARY_BUNDLE_TYPE","channel","CHANNEL","WEB","platform","PLATFORM","referrer","window","location","href","screenWidth","screen","width","level","enabled","service","requestCheckoutAttemptId","dispatchPendingAnalytics","set","error","console","warn","sendAnalytics","event","addEventToQueue","sendFlavor","flavor","isFlavorReported","dispatchFlavor","pendingFlavor","reportIntegrationFlavor","flush","sendEvents","eventsQueue","add","getEventCategory","AnalyticsEventCategory","info","debouncedSendInfoEvents","debouncedSendEvents","hasEvents","infoEvents","errors","errorEvents","logs","logEvents","clear","undefined","constructor","eventQueue","_define_property","Storage","debounce","bind"],"mappings":"gdAwCA,MACMA,EAA0CC,EAEhD,MAAMC,EAwBF,qBAAWC,GACP,OAAOC,KAAKC,kBAChB,CAEA,qBAAYF,CAAkBA,GAC1BC,KAAKC,mBAAqBF,CAC9B,CAEA,WAAaG,EAAMC,UACfA,EAASC,cACTA,EAAaC,OACbA,GACqF,CAAA,GACrF,IACI,MAAMC,EAA2BN,KAAKO,QAAQC,MACxCC,EAjDlB,SAA6CC,GAEzC,IAAKA,GAASC,UAAW,OAAO,EAChC,MAAMC,EAAoBC,KAAKC,MAFD,IAG9B,OAAOJ,EAAQC,UAAYC,CAC/B,CA4CsCG,CAAoCT,IAExDU,gBAAEA,EAAiBjB,kBAAmBkB,GAAmCC,EAAqBlB,KAAKmB,gBAAkB,CAAA,EAErHC,EAAiDX,EAAoBH,GAA0Be,GAAKJ,EAEpGK,EAAmC,CACrCC,QAASC,EACTC,UAAWC,EACXC,QAASC,EAAQC,IACjBC,SAAUC,EACV1B,SACA2B,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,MAC3BlC,cAAeA,GAAiB,WAChCmC,MAAOvC,KAAKwC,QAAU,MAAQ,aAC1BxB,GAAmB,C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AYa,QAEjB,UACUxE,KAAKyC,QAAQiB,WAAWpC,EAAStB,KAAKD,kBAChD,CAAE,MAAO8C,GACLC,QAAQC,KAAK,kCAAmCF,EACpD,CACJ,CAKA,wBAAAF,GACI,IAAK3C,KAAKqD,kBAAoBrD,KAAKuD,cAAe,CAC9C,MAAMH,EAASpD,KAAKuD,cACpBvD,KAAKuD,mBAAgBkB,EAChBzE,KAAKsD,eAAeF,EAC7B,CAEKpD,KAAK0D,YACd,CAlKA,WAAAgB,EAAYjC,QAAEA,EAAOkC,WAAEA,EAAUnC,QAAEA,EAAOrB,cAAEA,IAZ5CyD,EAAA5E,KAAiBmB,wBACjByD,EAAA5E,KAAiByC,kBACjBmC,EAAA5E,KAAiB2D,sBACjBiB,EAAA5E,KAAiBO,UAAU,IAAIsE,EAAyC,sBAAuB,mBAC/FD,EAAA5E,KAAiBgE,kCACjBY,EAAA5E,KAAiBiE,8BAEjBW,EAAA5E,KAAQC,6BACR2E,EAAA5E,KAAQwC,WAAmB,GAC3BoC,EAAA5E,KAAQqD,oBAAmB,GAC3BuB,EAAA5E,KAAQuD,wBAGJvD,KAAKyC,QAAUA,EACfzC,KAAK2D,YAAcgB,EAEnB3E,KAAKgE,wBAA0Bc,EAAS9E,KAAK0D,WAAWqB,KAAK/E,MApBkB,KAqB/EA,KAAKiE,oBAAsBa,EAAS9E,KAAK0D,WAAWqB,KAAK/E,MAAOJ,QAEhD6E,IAAZjC,IAAuBxC,KAAKwC,QAAUA,GACtCrB,IAAenB,KAAKmB,cAAgBA,EAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsService.js","sources":["../../../../src/core/Analytics/AnalyticsService.ts"],"sourcesContent":["import AdyenCheckoutError from '../Errors/AdyenCheckoutError';\nimport { AbstractAnalyticsEvent } from './events/AbstractAnalyticsEvent';\nimport { HttpOptions, httpPost } from '../Services/http';\nimport type { ApplicationInfo } from './types';\n\nexport interface IAnalyticsService {\n requestCheckoutAttemptId(payload: RequestAttemptIdPayload): Promise<string>;\n sendEvents(payload: AnalyticsEventPayload, checkoutAttemptId: string): Promise<void>;\n reportIntegrationFlavor(flavor: 'dropin' | 'components', checkoutAttemptId: string): Promise<void>;\n}\n\nexport interface RequestAttemptIdPayload {\n version: string;\n channel: 'Web';\n platform: 'Web';\n locale: string;\n checkoutStage: 'precheckout' | 'checkout';\n referrer: string;\n screenWidth: number;\n buildType: string;\n level: 'initial' | 'all';\n sessionId?: string;\n checkoutAttemptId?: string;\n applicationInfo?: ApplicationInfo;\n}\n\nexport interface AnalyticsEventPayload {\n channel: 'Web';\n platform: 'Web';\n info: Array<AbstractAnalyticsEvent>;\n errors: Array<AbstractAnalyticsEvent>;\n logs: Array<AbstractAnalyticsEvent>;\n}\n\nexport interface AnalyticsFlavorPayload {\n flavor: 'dropin' | 'components';\n checkoutAttemptId: string;\n}\n\nconst ANALYTICS_PATH = 'v3/analytics';\n\nclass AnalyticsService implements IAnalyticsService {\n private readonly clientKey: string;\n private readonly analyticsContext: string;\n\n constructor({ clientKey, analyticsContext }: { clientKey: string; analyticsContext: string }) {\n this.clientKey = clientKey;\n this.analyticsContext = analyticsContext;\n }\n\n public async requestCheckoutAttemptId(payload: RequestAttemptIdPayload) {\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}?clientKey=${this.clientKey}`\n };\n\n try {\n const { checkoutAttemptId } = await httpPost<{ checkoutAttemptId: string }>(httpOptions, payload);\n return checkoutAttemptId;\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'requestCheckoutAttemptId() - failed to get checkout attempt ID', { cause: error });\n }\n }\n\n public async sendEvents(payload: AnalyticsEventPayload, checkoutAttemptId: string): Promise<void> {\n if (!checkoutAttemptId) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'sendEvents() - checkoutAttemptId is required');\n }\n\n // No events to be sent\n if (!payload.info.length && !payload.errors.length && !payload.logs.length) {\n return Promise.resolve();\n }\n\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}/${checkoutAttemptId}?clientKey=${this.clientKey}`\n };\n\n try {\n await httpPost(httpOptions, payload);\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'sendEvents() - failed to send events', { cause: error });\n }\n }\n\n public async reportIntegrationFlavor(flavor: 'dropin' | 'components', checkoutAttemptId: string): Promise<void> {\n if (!flavor || !checkoutAttemptId) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'reportIntegrationFlavor() - flavor or checkoutAttemptId is required');\n }\n\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}?clientKey=${this.clientKey}`\n };\n\n const payload: AnalyticsFlavorPayload = {\n flavor,\n checkoutAttemptId\n };\n\n try {\n await httpPost(httpOptions, payload);\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'reportIntegrationFlavor() - failed to send flavor', { cause: error });\n }\n }\n}\n\nexport { AnalyticsService };\n"],"names":["ANALYTICS_PATH","AnalyticsService","requestCheckoutAttemptId","payload","httpOptions","loadingContext","this","analyticsContext","path","clientKey","checkoutAttemptId","httpPost","error","AdyenCheckoutError","cause","sendEvents","info","length","errors","logs","Promise","resolve","reportIntegrationFlavor","flavor","constructor","_define_property"],"mappings":"sNAuCA,MAAMA,EAAiB,eAEvB,MAAMC,EASF,8BAAaC,CAAyBC,GAClC,MAAMC,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,eAA4BM,KAAKG,aAG9C,IACI,MAAMC,kBAAEA,SAA4BC,EAAwCP,EAAaD,GACzF,OAAOO,CACX,CAAE,MAAOE,GACL,MAAM,IAAIC,EAAmB,gBAAiB,iEAAkE,CAAEC,MAAOF,GAC7H,CACJ,CAEA,gBAAaG,CAAWZ,EAAgCO,GACpD,IAAKA,EACD,MAAM,IAAIG,EAAmB,uBAAwB,gDAIzD,IAAKV,EAAQa,KAAKC,SAAWd,EAAQe,OAAOD,SAAWd,EAAQgB,KAAKF,OAChE,OAAOG,QAAQC,UAGnB,MAAMjB,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,KAAkBU,eAA+BJ,KAAKG,aAGnE,UACUE,EAASP,EAAaD,EAChC,CAAE,MAAOS,GACL,MAAM,IAAIC,EAAmB,gBAAiB,uCAAwC,CAAEC,MAAOF,GACnG,CACJ,CAEA,6BAAaU,CAAwBC,EAAiCb,GAClE,IAAKa,IAAWb,EACZ,MAAM,IAAIG,EAAmB,uBAAwB,uEAGzD,MAAMT,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,eAA4BM,KAAKG,aAGxCN,EAAkC,CACpCoB,SACAb,qBAGJ,UACUC,EAASP,EAAaD,EAChC,CAAE,MAAOS,GACL,MAAM,IAAIC,EAAmB,gBAAiB,oDAAqD,CAAEC,MAAOF,GAChH,CACJ,CA7DA,WAAAY,EAAYf,UAAEA,EAASF,iBAAEA,IAHzBkB,EAAAnB,KAAiBG,oBACjBgB,EAAAnB,KAAiBC,2BAGbD,KAAKG,UAAYA,EACjBH,KAAKC,iBAAmBA,CAC5B"}
1
+ {"version":3,"file":"AnalyticsService.js","sources":["../../../../src/core/Analytics/AnalyticsService.ts"],"sourcesContent":["import AdyenCheckoutError from '../Errors/AdyenCheckoutError';\nimport { AbstractAnalyticsEvent } from './events/AbstractAnalyticsEvent';\nimport { HttpOptions, httpPost } from '../Services/http';\nimport type { ApplicationInfo } from './types';\nimport { CHANNEL } from '../config';\n\nexport interface IAnalyticsService {\n requestCheckoutAttemptId(payload: RequestAttemptIdPayload): Promise<string>;\n sendEvents(payload: AnalyticsEventPayload, checkoutAttemptId: string): Promise<void>;\n reportIntegrationFlavor(flavor: 'dropin' | 'components', checkoutAttemptId: string): Promise<void>;\n}\n\nexport interface RequestAttemptIdPayload {\n version: string;\n channel: CHANNEL;\n platform: string;\n locale: string;\n checkoutStage: 'precheckout' | 'checkout';\n referrer: string;\n screenWidth: number;\n buildType: string;\n level: 'initial' | 'all';\n sessionId?: string;\n checkoutAttemptId?: string;\n applicationInfo?: ApplicationInfo;\n}\n\nexport interface AnalyticsEventPayload {\n channel: CHANNEL;\n platform: string;\n info: Array<AbstractAnalyticsEvent>;\n errors: Array<AbstractAnalyticsEvent>;\n logs: Array<AbstractAnalyticsEvent>;\n}\n\nexport interface AnalyticsFlavorPayload {\n flavor: 'dropin' | 'components';\n checkoutAttemptId: string;\n}\n\nconst ANALYTICS_PATH = 'v3/analytics';\n\nclass AnalyticsService implements IAnalyticsService {\n private readonly clientKey: string;\n private readonly analyticsContext: string;\n\n constructor({ clientKey, analyticsContext }: { clientKey: string; analyticsContext: string }) {\n this.clientKey = clientKey;\n this.analyticsContext = analyticsContext;\n }\n\n public async requestCheckoutAttemptId(payload: RequestAttemptIdPayload) {\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}?clientKey=${this.clientKey}`\n };\n\n try {\n const { checkoutAttemptId } = await httpPost<{ checkoutAttemptId: string }>(httpOptions, payload);\n return checkoutAttemptId;\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'requestCheckoutAttemptId() - failed to get checkout attempt ID', { cause: error });\n }\n }\n\n public async sendEvents(payload: AnalyticsEventPayload, checkoutAttemptId: string): Promise<void> {\n if (!checkoutAttemptId) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'sendEvents() - checkoutAttemptId is required');\n }\n\n // No events to be sent\n if (!payload.info.length && !payload.errors.length && !payload.logs.length) {\n return Promise.resolve();\n }\n\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}/${checkoutAttemptId}?clientKey=${this.clientKey}`\n };\n\n try {\n await httpPost(httpOptions, payload);\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'sendEvents() - failed to send events', { cause: error });\n }\n }\n\n public async reportIntegrationFlavor(flavor: 'dropin' | 'components', checkoutAttemptId: string): Promise<void> {\n if (!flavor || !checkoutAttemptId) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'reportIntegrationFlavor() - flavor or checkoutAttemptId is required');\n }\n\n const httpOptions: HttpOptions = {\n loadingContext: this.analyticsContext,\n path: `${ANALYTICS_PATH}?clientKey=${this.clientKey}`\n };\n\n const payload: AnalyticsFlavorPayload = {\n flavor,\n checkoutAttemptId\n };\n\n try {\n await httpPost(httpOptions, payload);\n } catch (error: unknown) {\n throw new AdyenCheckoutError('NETWORK_ERROR', 'reportIntegrationFlavor() - failed to send flavor', { cause: error });\n }\n }\n}\n\nexport { AnalyticsService };\n"],"names":["ANALYTICS_PATH","AnalyticsService","requestCheckoutAttemptId","payload","httpOptions","loadingContext","this","analyticsContext","path","clientKey","checkoutAttemptId","httpPost","error","AdyenCheckoutError","cause","sendEvents","info","length","errors","logs","Promise","resolve","reportIntegrationFlavor","flavor","constructor","_define_property"],"mappings":"sNAwCA,MAAMA,EAAiB,eAEvB,MAAMC,EASF,8BAAaC,CAAyBC,GAClC,MAAMC,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,eAA4BM,KAAKG,aAG9C,IACI,MAAMC,kBAAEA,SAA4BC,EAAwCP,EAAaD,GACzF,OAAOO,CACX,CAAE,MAAOE,GACL,MAAM,IAAIC,EAAmB,gBAAiB,iEAAkE,CAAEC,MAAOF,GAC7H,CACJ,CAEA,gBAAaG,CAAWZ,EAAgCO,GACpD,IAAKA,EACD,MAAM,IAAIG,EAAmB,uBAAwB,gDAIzD,IAAKV,EAAQa,KAAKC,SAAWd,EAAQe,OAAOD,SAAWd,EAAQgB,KAAKF,OAChE,OAAOG,QAAQC,UAGnB,MAAMjB,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,KAAkBU,eAA+BJ,KAAKG,aAGnE,UACUE,EAASP,EAAaD,EAChC,CAAE,MAAOS,GACL,MAAM,IAAIC,EAAmB,gBAAiB,uCAAwC,CAAEC,MAAOF,GACnG,CACJ,CAEA,6BAAaU,CAAwBC,EAAiCb,GAClE,IAAKa,IAAWb,EACZ,MAAM,IAAIG,EAAmB,uBAAwB,uEAGzD,MAAMT,EAA2B,CAC7BC,eAAgBC,KAAKC,iBACrBC,KAAM,GAAGR,eAA4BM,KAAKG,aAGxCN,EAAkC,CACpCoB,SACAb,qBAGJ,UACUC,EAASP,EAAaD,EAChC,CAAE,MAAOS,GACL,MAAM,IAAIC,EAAmB,gBAAiB,oDAAqD,CAAEC,MAAOF,GAChH,CACJ,CA7DA,WAAAY,EAAYf,UAAEA,EAASF,iBAAEA,IAHzBkB,EAAAnB,KAAiBG,oBACjBgB,EAAAnB,KAAiBC,2BAGbD,KAAKG,UAAYA,EACjBH,KAAKC,iBAAmBA,CAC5B"}
@@ -1,2 +1,2 @@
1
- import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";import{mapErrorCodesForAnalytics as o}from"../utils.js";function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var i=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,r]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof r?t[o]="function":Array.isArray(r)?t[o]=r.join(", ").substring(0,128):t[o]="object"==typeof r&&null!==r?JSON.stringify(r).substring(0,128):r);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),r(this,"type",void 0),r(this,"configData",void 0),r(this,"target",void 0),r(this,"issuer",void 0),r(this,"isExpress",void 0),r(this,"expressPage",void 0),r(this,"isStoredPaymentMethod",void 0),r(this,"brand",void 0),r(this,"selectedValue",void 0),r(this,"validationErrorCode",void 0),r(this,"validationErrorMessage",void 0),r(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),"rendered"===this.type&&(this.configData=this.createAnalyticsConfigData(e?.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,i as UiTarget};
1
+ import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";import{mapErrorCodesForAnalytics as o}from"../utils.js";function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var r=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,i]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof i?t[o]="function":Array.isArray(i)?t[o]=i.join(", ").substring(0,128):t[o]="object"==typeof i&&null!==i?JSON.stringify(i).substring(0,128):i);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),i(this,"type",void 0),i(this,"configData",void 0),i(this,"target",void 0),i(this,"issuer",void 0),i(this,"isExpress",void 0),i(this,"expressPage",void 0),i(this,"isStoredPaymentMethod",void 0),i(this,"brand",void 0),i(this,"selectedValue",void 0),i(this,"validationErrorCode",void 0),i(this,"validationErrorMessage",void 0),i(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),"rendered"!==this.type&&"displayed"!==this.type||(this.configData=this.createAnalyticsConfigData(e?.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,r as UiTarget};
2
2
  //# sourceMappingURL=AnalyticsInfoEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (this.type === InfoEventType.rendered) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRAmBO,IAAAA,EAAKA,SAAAA,GAAAA,2fAAAA,CAeZ,CAfYA,CAeZ,CAAA,GAEOC,EAAKA,SAAAA,GAAAA,OACyBA,EAAA,QAAA,UAEgDA,EAAA,SAAA,WAE7BA,EAAA,SAAA,WAEAA,EAAA,gBAAA,kBAE1BA,EAAA,MAAA,QAEEA,EAAA,QAAA,UAEUA,EAAA,WAAA,aAEAA,EAAA,UAAA,YAE2CA,EAAA,MAAA,QAEdA,EAAA,SAAA,+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,YAAyBrB,KAAKqB,UAAYR,EAAMQ,WACtDR,EAAMS,cAAatB,KAAKsB,YAAcT,EAAMS,aAC5CT,EAAMW,QAAOxB,KAAKwB,MAAQX,EAAMW,OAChCX,EAAMe,SAAQ5B,KAAK4B,OAASf,EAAMe,QAClCf,EAAMY,gBAAezB,KAAKyB,cAAgBZ,EAAMY,eAChDZ,EAAMa,sBAAqB1B,KAAK0B,oBAAsBb,EAAMa,qBAC5Db,EAAMc,yBAAwB3B,KAAK2B,uBAAyBd,EAAMc,wBACzD,aAAT3B,KAAKiB,OACLjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,GAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBI,EAA0B9B,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
1
+ {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (this.type === InfoEventType.rendered || this.type === InfoEventType.displayed) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRAmBO,IAAAA,EAAKA,SAAAA,GAAAA,2fAAAA,CAeZ,CAfYA,CAeZ,CAAA,GAEOC,EAAKA,SAAAA,GAAAA,OACyBA,EAAA,QAAA,UAEgDA,EAAA,SAAA,WAE7BA,EAAA,SAAA,WAEAA,EAAA,gBAAA,kBAE1BA,EAAA,MAAA,QAEEA,EAAA,QAAA,UAEUA,EAAA,WAAA,aAEAA,EAAA,UAAA,YAE2CA,EAAA,MAAA,QAEdA,EAAA,SAAA,+gBAnB3DA,CAmCZ,CAnCYA,CAmCZ,CAAA,GAEO,MAAMC,UAA2BC,EAuDpC,4BAAYC,GAmBR,MAAO,CAlBgB,8BAEnB,aACA,WACA,WACA,wBACA,kBACA,mBACA,OAEgB,OAAQ,aAAc,eAAgB,QAAS,kBAAmB,0BAM5D,UAAW,OAGzC,CAMQC,yBAAAA,CAA0BC,GAC9B,IAAKA,EAAQ,MAAO,CAAA,EAEpB,MACMC,EAAiC,CAAA,EAEvC,IACI,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQL,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AA4C,cAATjB,KAAKiB,OAC7CjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,GAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBI,EAA0B9B,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
@@ -1,2 +1,2 @@
1
- function t(t){return!this.length||this.indexOf(t.type)>-1}function e(t){return!this.length||this.indexOf(t.type)<0}function n(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const i=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function p(t){return!!t&&!!t.type&&i.includes(t.type)}export{t as filterAllowedPaymentMethods,n as filterEcomStoredPaymentMethods,e as filterRemovedPaymentMethods,p as filterSupportedStoredPaymentMethods};
1
+ function t(t){return!this.length||this.includes(t.type)}function e(t){return!this.length||!this.includes(t.type)}function n(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const i=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto","paybybank_pix","eft_directdebit_CA"];function p(t){return!!t&&!!t.type&&i.includes(t.type)}export{t as filterAllowedPaymentMethods,n as filterEcomStoredPaymentMethods,e as filterRemovedPaymentMethods,p as filterSupportedStoredPaymentMethods};
2
2
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sources":["../../../../../src/core/ProcessResponse/PaymentMethods/filters.ts"],"sourcesContent":["export function filterAllowedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) > -1;\n}\n\nexport function filterRemovedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) < 0;\n}\n\nexport function filterEcomStoredPaymentMethods(pm) {\n return !!pm && !!pm.supportedShopperInteractions && pm.supportedShopperInteractions.includes('Ecommerce');\n}\n\nconst supportedStoredPaymentMethods = [\n 'scheme',\n 'blik',\n 'twint',\n 'ach',\n 'cashapp',\n 'paybybank_AIS_DD',\n 'payto',\n 'paybybank_pix',\n 'eft_directdebit_CA'\n];\n\nexport function filterSupportedStoredPaymentMethods(pm) {\n return !!pm && !!pm.type && supportedStoredPaymentMethods.includes(pm.type);\n}\n"],"names":["filterAllowedPaymentMethods","pm","this","length","indexOf","type","filterRemovedPaymentMethods","filterEcomStoredPaymentMethods","supportedShopperInteractions","includes","supportedStoredPaymentMethods","filterSupportedStoredPaymentMethods"],"mappings":"AAAO,SAASA,EAA4BC,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,OAAQ,CACnD,CAEO,SAASC,EAA4BL,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,MAAQ,CACnD,CAEO,SAASE,EAA+BN,GAC3C,QAASA,KAAQA,EAAGO,8BAAgCP,EAAGO,6BAA6BC,SAAS,YACjG,CAEA,MAAMC,EAAgC,CAClC,SACA,OACA,QACA,MACA,UACA,mBACA,QACA,gBACA,sBAGG,SAASC,EAAoCV,GAChD,QAASA,KAAQA,EAAGI,MAAQK,EAA8BD,SAASR,EAAGI,KAC1E"}
1
+ {"version":3,"file":"filters.js","sources":["../../../../../src/core/ProcessResponse/PaymentMethods/filters.ts"],"sourcesContent":["export function filterAllowedPaymentMethods(pm) {\n return !this.length || this.includes(pm.type);\n}\n\nexport function filterRemovedPaymentMethods(pm) {\n return !this.length || !this.includes(pm.type);\n}\n\nexport function filterEcomStoredPaymentMethods(pm) {\n return !!pm && !!pm.supportedShopperInteractions && pm.supportedShopperInteractions.includes('Ecommerce');\n}\n\nconst supportedStoredPaymentMethods = [\n 'scheme',\n 'blik',\n 'twint',\n 'ach',\n 'cashapp',\n 'paybybank_AIS_DD',\n 'payto',\n 'paybybank_pix',\n 'eft_directdebit_CA'\n];\n\nexport function filterSupportedStoredPaymentMethods(pm) {\n return !!pm && !!pm.type && supportedStoredPaymentMethods.includes(pm.type);\n}\n"],"names":["filterAllowedPaymentMethods","pm","this","length","includes","type","filterRemovedPaymentMethods","filterEcomStoredPaymentMethods","supportedShopperInteractions","supportedStoredPaymentMethods","filterSupportedStoredPaymentMethods"],"mappings":"AAAO,SAASA,EAA4BC,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,SAASH,EAAGI,KAC5C,CAEO,SAASC,EAA4BL,GACxC,OAAQC,KAAKC,SAAWD,KAAKE,SAASH,EAAGI,KAC7C,CAEO,SAASE,EAA+BN,GAC3C,QAASA,KAAQA,EAAGO,8BAAgCP,EAAGO,6BAA6BJ,SAAS,YACjG,CAEA,MAAMK,EAAgC,CAClC,SACA,OACA,QACA,MACA,UACA,mBACA,QACA,gBACA,sBAGG,SAASC,EAAoCT,GAChD,QAASA,KAAQA,EAAGI,MAAQI,EAA8BL,SAASH,EAAGI,KAC1E"}
@@ -1,2 +1,2 @@
1
- function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.34.0","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],d=6e4;export{d as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION};
1
+ function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.35.0","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
2
2
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * Asserts that a value is defined and throws an error if it is not.\n *\n * @param value The value to check.\n * @param message The error message to throw if the value is undefined.\n * @returns The value if it is defined.\n */\nfunction assertDefined<T>(value: T | undefined, message: string): T {\n if (value === undefined || value === null) {\n throw new Error(message);\n }\n return value;\n}\n\n/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\n/**\n * Library version injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_VERSION = assertDefined(process.env.VERSION, 'LIBRARY_VERSION is not defined');\n\n/**\n * Bundle type injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_BUNDLE_TYPE = assertDefined(process.env.BUNDLE_TYPE, 'BUNDLE_TYPE is not defined');\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onEnterKeyPressed',\n 'onError',\n 'onBalanceCheck',\n 'onOrderCancel',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n"],"names":["assertDefined","value","message","Error","FALLBACK_CONTEXT","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT"],"mappings":"AAOA,SAASA,EAAiBC,EAAsBC,GAC5C,GAAID,QACA,MAAM,IAAIE,MAAMD,GAEpB,OAAOD,CACX,CAKO,MAAMG,EAAmB,0DAMnBC,EAAkBL,EAAc,SAAqB,kCAMrDM,EAAsBN,EAAc,MAAyB,8BAE7DO,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,oBACA,UACA,iBACA,gBACA,iBACA,iBACA,2BAGSC,EAAuB"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * Asserts that a value is defined and throws an error if it is not.\n *\n * @param value The value to check.\n * @param message The error message to throw if the value is undefined.\n * @returns The value if it is defined.\n */\nfunction assertDefined<T>(value: T | undefined, message: string): T {\n if (value === undefined || value === null) {\n throw new Error(message);\n }\n return value;\n}\n\n/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\n/**\n * Library version injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_VERSION = assertDefined(process.env.VERSION, 'LIBRARY_VERSION is not defined');\n\n/**\n * Bundle type injected at build time.\n * Always defined - the build process ensures this value is set.\n */\nexport const LIBRARY_BUNDLE_TYPE = assertDefined(process.env.BUNDLE_TYPE, 'BUNDLE_TYPE is not defined');\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onEnterKeyPressed',\n 'onError',\n 'onBalanceCheck',\n 'onOrderCancel',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n\n/**\n * @internal\n */\n\nexport enum CHANNEL {\n WEB = 'web'\n}\n\n/**\n * @internal\n */\nexport const PLATFORM = 'web';\n\n/**\n * How the SDK handles the rendering of a payment method.\n *\n * - NATIVE: The payment method has a dedicated component in the SDK.\n * - GENERIC: The payment method has no dedicated component; it falls back to a generic component (Redirect).\n * @internal\n */\nexport enum PAYMENT_METHOD_BEHAVIOR {\n NATIVE = 'nativeComponent',\n GENERIC = 'genericComponent'\n}\n"],"names":["assertDefined","value","message","Error","FALLBACK_CONTEXT","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT","CHANNEL","PLATFORM","PAYMENT_METHOD_BEHAVIOR"],"mappings":"AAOA,SAASA,EAAiBC,EAAsBC,GAC5C,GAAID,QACA,MAAM,IAAIE,MAAMD,GAEpB,OAAOD,CACX,CAKO,MAAMG,EAAmB,0DAMnBC,EAAkBL,EAAc,SAAqB,kCAMrDM,EAAsBN,EAAc,MAAyB,8BAE7DO,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,oBACA,UACA,iBACA,gBACA,iBACA,iBACA,2BAGSC,EAAuB,IAY7B,IAAKC,EAAAA,SAAAA,GAAAA,mBAAAA,CAEZ,CAFYA,CAEZ,CAAA,GAKO,MAAMC,EAAW,MASjB,IAAKC,EAAAA,SAAAA,GAAAA,+DAAAA,CAGZ,CAHYA,CAGZ,CAAA"}
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import e from"./RiskModule/RiskModule.js";import o from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import s from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as l}from"./Errors/SRPanel.js";import m from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as p,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{THREEDS2_FULL as f}from"../components/ThreeDS2/constants.js";import{defaultProps as C}from"./core.defaultProps.js";import{resolveEnvironments as v}from"./Environment/Environment.js";import{LIBRARY_BUNDLE_TYPE as A,LIBRARY_VERSION as w}from"./config.js";import{AnalyticsLogEvent as j,LogEventType as b}from"./Analytics/events/AnalyticsLogEvent.js";import E from"./Errors/CancelError.js";import{AnalyticsService as P}from"./Analytics/AnalyticsService.js";import{AnalyticsEventQueue as T}from"./Analytics/AnalyticsEventQueue.js";import{isAmountValid as M}from"../utils/amount-util.js";import{LanguageService as U}from"../language/LanguageService.js";function I(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class k{static setBundleType(t){k.metadata.bundleType=t}static register(...t){m.add(...t)}register(...t){m.add(...t)}getComponent(t){return m.getComponent(t)}async initialize(){return this.validateCoreConfiguration(),await this.initializeCore(),this.createCoreModules(),this.assignLocaleToCore(),this.requestAnalyticsAttemptId(),await this.requestTranslations(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:e,shopperLocale:o,countryCode:s,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:e,locale:this.options.locale||o,countryCode:this.options.countryCode||s}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.")}submitDetails(t){let e=null;this.options.onAdditionalDetails&&(e=new Promise((e,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:e,reject:o})})),this.session&&(e=this.session.submitDetails(t).catch(t=>(this.options.onError?.(t),Promise.reject(t)))),e?e.then(d).then(p).then(this.afterAdditionalDetails).then(t=>{u(t),this.options.onPaymentCompleted?.(t)}).catch(t=>{t instanceof E||(u(t),this.options.onPaymentFailed?.(t))}):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,e={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::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('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const o=t.type===f?`${t.type}${t.subtype}`:t.paymentMethodType,i=new j({type:b.action,subType:j.getSubtypeFromActionType(t.type),message:`${o} action was handled by the SDK`,component:o});this.modules.analytics.sendAnalytics(i);const n={...this.getCorePropsForComponent(),...e};return s(this,m,t,n)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:e=!0}={}){if(e)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(e=>{const o={...t.order?.remainingAmount?{amount:t.order.remainingAmount}:{amount:this.options.amount},...this.session&&{session:this.session},...t};e.update(o)}),this));const{amount:o,secondaryAmount:s}=t;return(o||s)&&this.triggerAmountUpdate(o,s),Promise.resolve(this)}triggerAmountUpdate(t,e){M(t)?!e||M(e)?(this.setOptions({amount:t,...e&&{secondaryAmount:e}}),this.components.forEach(o=>{o.updateAmount(t,e)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const e=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(e)}createPaymentMethodsList(t){this.paymentMethodsResponse=new o(this.options.paymentMethodsResponse||t,this.options)}createCoreModules(){this.modules||(this.modules=Object.freeze({risk:new e(this,{...this.options,loadingContext:this.loadingContext}),analytics:new i({eventQueue:new T,service:new P({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:this.options.analytics?.enabled,analyticsData:this.options.analytics?.analyticsData}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,customTranslations:this.options.translations,service:new U({cdnUrl:this.cdnTranslationsUrl,sdkVersion:k.metadata.version}),onError:this.options?.onError}),srPanel:new l(this,{...this.options.srConfig})}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(t){console.warn("Core - requestTranslations(): Something went wrong.",t)}}async requestAnalyticsAttemptId(){await this.modules.analytics.setUp({locale:this.options.locale,...this.session?.id&&{sessionId:this.session.id}})}constructor(t){I(this,"session",void 0),I(this,"paymentMethodsResponse",void 0),I(this,"modules",void 0),I(this,"options",void 0),I(this,"analyticsContext",void 0),I(this,"loadingContext",void 0),I(this,"cdnImagesUrl",void 0),I(this,"cdnTranslationsUrl",void 0),I(this,"components",[]),I(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&t?.action){const e=this.createFromAction(t.action);return this.options.afterAdditionalDetails(e),Promise.reject(new E("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),I(this,"remove",t=>(this.components=this.components.filter(e=>e._id!==t._id),t.unmount(),this)),I(this,"setOptions",t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale,environment:String.prototype.toLowerCase.apply(t?.environment||this.options?.environment)}}),r(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions({...C,...t});const{apiUrl:e,analyticsUrl:o,cdnImagesUrl:s,cdnTranslationsUrl:i}=v(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=o,this.cdnImagesUrl=s,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=k.metadata)}}I(k,"metadata",{version:w,bundleType:A}),I(k,"registry",m);export{k as default};
1
+ import{Language as t}from"../language/Language.js";import e from"./RiskModule/RiskModule.js";import o from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import s from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as l}from"./Errors/SRPanel.js";import m from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as p,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{THREEDS2_FULL as f}from"../components/ThreeDS2/constants.js";import{defaultProps as C}from"./core.defaultProps.js";import{resolveEnvironments as v}from"./Environment/Environment.js";import{LIBRARY_BUNDLE_TYPE as A,LIBRARY_VERSION as w}from"./config.js";import{AnalyticsLogEvent as j,LogEventType as b}from"./Analytics/events/AnalyticsLogEvent.js";import E from"./Errors/CancelError.js";import{AnalyticsService as P}from"./Analytics/AnalyticsService.js";import{AnalyticsEventQueue as T}from"./Analytics/AnalyticsEventQueue.js";import{isAmountValid as M}from"../utils/amount-util.js";import{LanguageService as U}from"../language/LanguageService.js";function I(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class k{static setBundleType(t){k.metadata.bundleType=t}static register(...t){m.add(...t)}register(...t){m.add(...t)}getComponent(t){return m.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),this.createCoreModules(),this.assignLocaleToCore(),this.requestAnalyticsAttemptId(),await this.requestTranslations(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then(t=>{const{amount:e,shopperLocale:o,countryCode:s,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:e,locale:this.options.locale||o,countryCode:this.options.countryCode||s}),this.createPaymentMethodsList(i),this}).catch(t=>(this.options.onError&&this.options.onError(t),Promise.reject(t))):(this.createPaymentMethodsList(),Promise.resolve(this))}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.")}submitDetails(t){let e=null;this.options.onAdditionalDetails&&(e=new Promise((e,o)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:e,reject:o})})),this.session&&(e=this.session.submitDetails(t).catch(t=>(this.options.onError?.(t),Promise.reject(t)))),e?e.then(d).then(p).then(this.afterAdditionalDetails).then(t=>{u(t),this.options.onPaymentCompleted?.(t)}).catch(t=>{t instanceof E||(u(t),this.options.onPaymentFailed?.(t))}):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,e={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::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('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const o=t.type===f?`${t.type}${t.subtype}`:t.paymentMethodType,i=new j({type:b.action,subType:j.getSubtypeFromActionType(t.type),message:`${o} action was handled by the SDK`,component:o});this.modules.analytics.sendAnalytics(i);const n={...this.getCorePropsForComponent(),...e};return s(this,m,t,n)}return this.handleCreateError()}update(t={},{shouldReinitializeCheckout:e=!0}={}){if(e)return this.setOptions(t),this.initialize().then(()=>(this.components.forEach(e=>{const o={...t.order?.remainingAmount?{amount:t.order.remainingAmount}:{amount:this.options.amount},...this.session&&{session:this.session},...t};e.update(o)}),this));const{amount:o,secondaryAmount:s}=t;return(o||s)&&this.triggerAmountUpdate(o,s),Promise.resolve(this)}triggerAmountUpdate(t,e){M(t)?!e||M(e)?(this.setOptions({amount:t,...e&&{secondaryAmount:e}}),this.components.forEach(o=>{o.updateAmount(t,e)})):console.warn("Core update(): Update canceled. Invalid secondary amount object"):console.warn("Core update(): Update canceled. Invalid amount object")}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const e=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(e)}createPaymentMethodsList(t){this.paymentMethodsResponse=new o(this.options.paymentMethodsResponse||t,this.options)}createCoreModules(){this.modules||(this.modules=Object.freeze({risk:new e(this,{...this.options,loadingContext:this.loadingContext}),analytics:new i({eventQueue:new T,service:new P({analyticsContext:this.analyticsContext,clientKey:this.options.clientKey}),enabled:this.options.analytics?.enabled,analyticsData:this.options.analytics?.analyticsData}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,customTranslations:this.options.translations,service:new U({cdnUrl:this.cdnTranslationsUrl,sdkVersion:k.metadata.version}),onError:this.options?.onError}),srPanel:new l(this,{...this.options.srConfig})}))}assignLocaleToCore(){this.options.locale=this.modules.i18n.locale}async requestTranslations(){try{await this.modules.i18n.requestTranslations()}catch(t){console.warn("Core - requestTranslations(): Something went wrong.",t)}}async requestAnalyticsAttemptId(){await this.modules.analytics.setUp({locale:this.options.locale,...this.session?.id&&{sessionId:this.session.id}})}constructor(t){I(this,"session",void 0),I(this,"paymentMethodsResponse",void 0),I(this,"modules",void 0),I(this,"options",void 0),I(this,"analyticsContext",void 0),I(this,"loadingContext",void 0),I(this,"cdnImagesUrl",void 0),I(this,"cdnTranslationsUrl",void 0),I(this,"components",[]),I(this,"afterAdditionalDetails",t=>{if(this.options.afterAdditionalDetails&&t?.action){const e=this.createFromAction(t.action);return this.options.afterAdditionalDetails(e),Promise.reject(new E("Handled by afterAdditionalDetails"))}return Promise.resolve(t)}),I(this,"remove",t=>(this.components=this.components.filter(e=>e._id!==t._id),t.unmount(),this)),I(this,"setOptions",t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale,environment:String.prototype.toLowerCase.apply(t?.environment||this.options?.environment)}}),r(t),this.createFromAction=this.createFromAction.bind(this),this.update=this.update.bind(this),this.setOptions({...C,...t});const{apiUrl:e,analyticsUrl:o,cdnImagesUrl:s,cdnTranslationsUrl:i}=v(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=o,this.cdnImagesUrl=s,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=k.metadata)}}I(k,"metadata",{version:w,bundleType:A}),I(k,"registry",m);export{k as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { defaultProps } from './core.defaultProps';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\nimport { LanguageService } from '../language/LanguageService';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata: { version: string; bundleType: string } = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n this.validateCoreConfiguration();\n await this.initializeCore();\n this.createCoreModules();\n this.assignLocaleToCore();\n void this.requestAnalyticsAttemptId();\n await this.requestTranslations();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::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('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<Omit<CoreConfiguration, 'session'>> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...(props.order?.remainingAmount ? { amount: props.order.remainingAmount } : { amount: this.options.amount }),\n ...(this.session && { session: this.session }),\n ...props\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private createCoreModules(): void {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n customTranslations: this.options.translations,\n service: new LanguageService({\n cdnUrl: this.cdnTranslationsUrl,\n sdkVersion: Core.metadata.version\n }),\n onError: this.options?.onError\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n /**\n * Retrieve the parsed locale from the i18n module and assigns it to the core options.\n */\n private assignLocaleToCore(): void {\n this.options.locale = this.modules.i18n.locale;\n }\n\n /**\n * Request translations to the CDN. If an error occurs, it will be logged to the console in development mode.\n */\n private async requestTranslations(): Promise<void> {\n try {\n await this.modules.i18n.requestTranslations();\n } catch (error: unknown) {\n console.warn('Core - requestTranslations(): Something went wrong.', error);\n }\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","validateCoreConfiguration","initializeCore","createCoreModules","assignLocaleToCore","requestAnalyticsAttemptId","requestTranslations","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","paymentMethodsConfiguration","console","warn","AdyenCheckoutError","IMPLEMENTATION_ERROR","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","cleanupFinalResult","onPaymentCompleted","e","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","translations","LanguageService","cdnUrl","cdnTranslationsUrl","sdkVersion","version","srPanel","SRPanel","srConfig","setUp","id","sessionId","constructor","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"wiDA6BA,MAAMA,EAoBF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAwCA,gBAAaC,GAOT,OANAC,KAAKC,kCACCD,KAAKE,iBACXF,KAAKG,oBACLH,KAAKI,qBACAJ,KAAKK,kCACJL,KAAKM,sBACJN,IACX,CAEA,oBAAcE,GACV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AAUC,YAAYC,MAAM9H,GAAS0H,aAAenI,KAAKS,SAAS0H,gBArR1FK,EAAsCvE,GAEtCjE,KAAKgD,iBAAmBhD,KAAKgD,iBAAiByF,KAAKzI,MACnDA,KAAKqE,OAASrE,KAAKqE,OAAOoE,KAAKzI,MAE/BA,KAAKiB,WAAW,IAAKyH,KAAiBzE,IAEtC,MAAM0E,OAAEA,EAAMC,aAAEA,EAAYzD,aAAEA,EAAY+B,mBAAEA,GAAuB2B,EAC/D7I,KAAKS,QAAQ0H,YACbnI,KAAKS,QAAQqI,kBAGjB9I,KAAKiF,eAAiB0D,EACtB3I,KAAKuG,iBAAmBqC,EACxB5I,KAAKmF,aAAeA,EACpBnF,KAAKkH,mBAAqBA,EAE1BlH,KAAKO,QAAUP,KAAKS,QAAQF,SAAW,IAAIwI,EAAQ/I,KAAKS,QAAQF,QAASP,KAAKS,QAAQ+F,UAAWxG,KAAKiF,gBAEtG,MAAM+D,EAAgBhJ,KAAKS,QAAQ+F,WAAWyC,UAAU,EAAG,GAC3D,IAAuB,SAAlBD,GAA8C,SAAlBA,KAA8BhJ,KAAKiF,eAAeiE,SAASF,GACxF,MAAM,IAAIjH,EACN,uBACA,0BAA0BiH,2BAAuChJ,KAAKS,QAAQqI,kBAAkBK,KAAOnJ,KAAKS,QAAQ0H,2BAGtG,SAAlBa,GACAnH,QAAQuH,MACJ,0EAA0EpJ,KAAKS,QAAQ+F,WAAWyC,UAAU,EAAG,oQAInHjJ,KAAKS,QAAQ4I,wBACbC,OAAO,iBAAsBlK,EAAKG,SAE1C,EA/DAqI,EAbExI,EAaqBG,WAAoD,CACvE6H,QAASmC,EACT/J,WAAYgK,IAGhB5B,EAlBExI,EAkBqBO,WAAWA"}
1
+ {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { defaultProps } from './core.defaultProps';\nimport { resolveEnvironments } from './Environment';\nimport { LIBRARY_BUNDLE_TYPE, LIBRARY_VERSION } from './config';\n\nimport type { PaymentAction, PaymentAmount, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData, CoreModules } from './types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\nimport { AnalyticsLogEvent, LogEventType } from './Analytics/events/AnalyticsLogEvent';\nimport CancelError from './Errors/CancelError';\nimport { AnalyticsService } from './Analytics/AnalyticsService';\nimport { AnalyticsEventQueue } from './Analytics/AnalyticsEventQueue';\nimport { isAmountValid } from '../utils/amount-util';\nimport { LanguageService } from '../language/LanguageService';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: CoreModules;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata: { version: string; bundleType: string } = {\n version: LIBRARY_VERSION,\n bundleType: LIBRARY_BUNDLE_TYPE\n };\n\n public static readonly registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n this.update = this.update.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n this.createCoreModules();\n this.assignLocaleToCore();\n void this.requestAnalyticsAttemptId();\n await this.requestTranslations();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.afterAdditionalDetails)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n return;\n }\n\n cleanupFinalResult(e as PaymentResponseData);\n this.options.onPaymentFailed?.(e as PaymentResponseData);\n });\n }\n\n private readonly afterAdditionalDetails = (response: PaymentResponseData): Promise<PaymentResponseData | Error> => {\n /**\n * After the user is redirected back, a request to `/details` or `/paymentDetails` will be made.\n * Typically, the response will not include an action object, except for the case of `paybybank_pix` payment method.\n * In terms of `paybybank_pix`, the action UIElement will be created and passed to the `afterAdditionalDetails` callback, allowing it to be mounted on the page.\n */\n if (this.options.afterAdditionalDetails && response?.action) {\n const actionEle = this.createFromAction(response.action);\n this.options.afterAdditionalDetails(actionEle);\n return Promise.reject(new CancelError('Handled by afterAdditionalDetails'));\n }\n return Promise.resolve(response);\n };\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::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('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n const event = new AnalyticsLogEvent({\n type: LogEventType.action,\n subType: AnalyticsLogEvent.getSubtypeFromActionType(action.type),\n message: `${component} action was handled by the SDK`,\n component\n });\n this.modules.analytics.sendAnalytics(event);\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param props - props to update\n * @param options - Can be used to avoid remounting the elements\n * @returns this - the Core instance\n */\n public update(props: Partial<Omit<CoreConfiguration, 'session'>> = {}, { shouldReinitializeCheckout = true } = {}): Promise<this> {\n if (shouldReinitializeCheckout) {\n this.setOptions(props);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...(props.order?.remainingAmount ? { amount: props.order.remainingAmount } : { amount: this.options.amount }),\n ...(this.session && { session: this.session }),\n ...props\n };\n component.update(newProps);\n });\n return this;\n });\n }\n\n const { amount, secondaryAmount } = props;\n\n if (amount || secondaryAmount) {\n this.triggerAmountUpdate(amount, secondaryAmount);\n }\n\n return Promise.resolve(this);\n }\n\n /**\n * Validates and propagates amount updates to all mounted components.\n *\n * @param amount - Primary payment amount object (required)\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n private triggerAmountUpdate(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n if (!isAmountValid(amount)) {\n console.warn('Core update(): Update canceled. Invalid amount object');\n return;\n }\n\n if (secondaryAmount && !isAmountValid(secondaryAmount)) {\n console.warn('Core update(): Update canceled. Invalid secondary amount object');\n return;\n }\n\n this.setOptions({\n amount,\n ...(secondaryAmount && { secondaryAmount })\n });\n\n this.components.forEach(component => {\n component.updateAmount(amount, secondaryAmount);\n });\n }\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale,\n // Make environment lowercase to ensure consistency\n environment: String.prototype.toLowerCase.apply(options?.environment || this.options?.environment)\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private createCoreModules(): void {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: new Analytics({\n eventQueue: new AnalyticsEventQueue(),\n service: new AnalyticsService({\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey\n }),\n enabled: this.options.analytics?.enabled,\n analyticsData: this.options.analytics?.analyticsData\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n customTranslations: this.options.translations,\n service: new LanguageService({\n cdnUrl: this.cdnTranslationsUrl,\n sdkVersion: Core.metadata.version\n }),\n onError: this.options?.onError\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n\n /**\n * Retrieve the parsed locale from the i18n module and assigns it to the core options.\n */\n private assignLocaleToCore(): void {\n this.options.locale = this.modules.i18n.locale;\n }\n\n /**\n * Request translations to the CDN. If an error occurs, it will be logged to the console in development mode.\n */\n private async requestTranslations(): Promise<void> {\n try {\n await this.modules.i18n.requestTranslations();\n } catch (error: unknown) {\n console.warn('Core - requestTranslations(): Something went wrong.', error);\n }\n }\n\n private async requestAnalyticsAttemptId(): Promise<void> {\n await this.modules.analytics.setUp({\n locale: this.options.locale,\n ...(this.session?.id && { sessionId: this.session.id })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","assignLocaleToCore","requestAnalyticsAttemptId","requestTranslations","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","paymentMethodsConfiguration","console","warn","AdyenCheckoutError","IMPLEMENTATION_ERROR","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","afterAdditionalDetails","response","cleanupFinalResult","onPaymentCompleted","e","CancelError","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","event","AnalyticsLogEvent","LogEventType","subType","getSubtypeFromActionType","message","modules","analytics","sendAnalytics","props","getCorePropsForComponent","getComponentForAction","handleCreateError","update","shouldReinitializeCheckout","components","forEach","newProps","secondaryAmount","triggerAmountUpdate","isAmountValid","updateAmount","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","eventQueue","AnalyticsEventQueue","service","AnalyticsService","analyticsContext","clientKey","enabled","analyticsData","resources","Resources","Language","customTranslations","translations","LanguageService","cdnUrl","cdnTranslationsUrl","sdkVersion","version","srPanel","SRPanel","srConfig","setUp","id","sessionId","constructor","_define_property","actionEle","remove","filter","c","_id","unmount","environment","String","prototype","toLowerCase","apply","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","_environmentUrls","Session","clientKeyType","substring","includes","api","debug","exposeLibraryMetadata","window","LIBRARY_VERSION","LIBRARY_BUNDLE_TYPE"],"mappings":"wiDA6BA,MAAMA,EAoBF,oBAAcC,CAAcC,G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AKS,QAAQ4I,wBACbC,OAAO,iBAAsBlK,EAAKG,SAE1C,EA/DAqI,EAbExI,EAaqBG,WAAoD,CACvE6H,QAASmC,EACT/J,WAAYgK,IAGhB5B,EAlBExI,EAkBqBO,WAAWA"}
@@ -1,2 +1,2 @@
1
- import{Component as e,options as n,createElement as t,Fragment as o,toChildArray as r,render as _}from"../../dist/preact.js";export{createContext,createRef}from"../../dist/preact.js";export{useCallback,useContext,useEffect,useImperativeHandle,useLayoutEffect,useMemo,useReducer,useRef,useState}from"../../hooks/dist/hooks.js";function i(e,n){for(var t in e)if("__source"!==t&&!(t in n))return!0;for(var o in n)if("__source"!==o&&e[o]!==n[o])return!0;return!1}function l(e,n){this.props=e,this.context=n}function u(e,n){function o(e){var t=this.props.ref,o=t==e.ref;return!o&&t&&(t.call?t(null):t.current=null),n?!n(this.props,e)||!o:i(this.props,e)}function r(n){return this.shouldComponentUpdate=o,t(e,n)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r.type=e,r}(l.prototype=new e).isPureReactComponent=!0,l.prototype.shouldComponentUpdate=function(e,n){return i(this.props,e)||i(this.state,n)};var a=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),a&&a(e)};var c=n.__e;n.__e=function(e,n,t,o){if(e.then)for(var r,_=n;_=_.__;)if((r=_.__c)&&r.__c)return null==n.__e&&(n.__e=t.__e,n.__k=t.__k),r.__c(e,n);c(e,n,t,o)};var s=n.unmount;function p(e,n,t){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,n){for(var t in n)e[t]=n[t];return e}({},e)).__c&&(e.__c.__P===t&&(e.__c.__P=n),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return p(e,n,t)})),e}function f(e,n,t){return e&&t&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return f(e,n,t)}),e.__c&&e.__c.__P===n&&(e.__e&&t.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=t)),e}function v(){this.__u=0,this.o=null,this.__b=null}function d(e){if(!e.__)return null;var n=e.__.__c;return n&&n.__a&&n.__a(e)}function h(){this.i=null,this.l=null}n.unmount=function(e){var n=e.__c;n&&(n.__z=!0),n&&n.__R&&n.__R(),n&&32&e.__u&&(e.type=null),s&&s(e)},(v.prototype=new e).__c=function(e,n){var t=n.__c,o=this;null==o.o&&(o.o=[]),o.o.push(t);var r=d(o.__v),_=!1,i=function(){_||o.__z||(_=!0,t.__R=null,r?r(u):u())};t.__R=i;var l=t.__P;t.__P=null;var u=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=f(e,e.__c.__P,e.__c.__O)}var n;for(o.setState({__a:o.__b=null});n=o.o.pop();)n.__P=l,n.forceUpdate()}};o.__u++||32&n.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(i,i)},v.prototype.componentWillUnmount=function(){this.o=[]},v.prototype.render=function(e,n){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),_=this.__v.__k[0].__c;this.__v.__k[0]=p(this.__b,r,_.__O=_.__P)}this.__b=null}var i=n.__a&&t(o,null,e.fallback);return i&&(i.__u&=-33),[t(o,null,n.__a?null:e.children),i]};var m=function(e,n,t){if(++t[1]===t[0]&&e.l.delete(n),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(t=e.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;e.i=t=t[2]}};function y(e){return this.getChildContext=function(){return e.context},e.children}function b(e){var n=this,o=e.h;if(n.componentWillUnmount=function(){_(null,n.v),n.v=null,n.h=null},n.h&&n.h!==o&&n.componentWillUnmount(),!n.v){for(var r=n.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;n.h=o,n.v={nodeType:1,parentNode:o,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:o.namespaceURI,insertBefore:function(e,t){this.childNodes.push(e),n.h.insertBefore(e,t)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),n.h.removeChild(e)}}}_(t(y,{context:n.context},e.__v),n.v)}function k(e,n){var o=t(b,{__v:e,h:n});return o.containerInfo=n,o}(h.prototype=new e).__a=function(e){var n=this,t=d(n.__v),o=n.l.get(e);return o[0]++,function(r){var _=function(){n.props.revealOrder?(o.push(r),m(n,e,o)):r()};t?t(_):_()}},h.prototype.render=function(e){this.i=null,this.l=new Map;var n=r(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&n.reverse();for(var t=n.length;t--;)this.l.set(n[t],this.i=[1,0,this.i]);return e.children},h.prototype.componentDidUpdate=h.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(n,t){m(e,t,n)})};var g="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,C=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,P=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,x=/[A-Z0-9]/g,N="undefined"!=typeof document,O=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};e.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(e.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var R=n.event;function S(){}function U(){return this.cancelBubble}function E(){return this.defaultPrevented}n.event=function(e){return R&&(e=R(e)),e.persist=S,e.isPropagationStopped=U,e.isDefaultPrevented=E,e.nativeEvent=e};var w={enumerable:!1,configurable:!0,get:function(){return this.class}},A=n.vnode;n.vnode=function(e){"string"==typeof e.type&&function(e){var n=e.props,t=e.type,o={},_=-1===t.indexOf("-");for(var i in n){var l=n[i];if(!("value"===i&&"defaultValue"in n&&null==l||N&&"children"===i&&"noscript"===t||"class"===i||"className"===i)){var u=i.toLowerCase();"defaultValue"===i&&"value"in n&&null==n.value?i="value":"download"===i&&!0===l?l="":"translate"===u&&"no"===l?l=!1:"o"===u[0]&&"n"===u[1]?"ondoubleclick"===u?i="ondblclick":"onchange"!==u||"input"!==t&&"textarea"!==t||O(n.type)?"onfocus"===u?i="onfocusin":"onblur"===u?i="onfocusout":P.test(i)&&(i=u):u=i="oninput":_&&C.test(i)?i=i.replace(x,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===u&&o[i=u]&&(i="oninputCapture"),o[i]=l}}"select"==t&&o.multiple&&Array.isArray(o.value)&&(o.value=r(n.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==t&&null!=o.defaultValue&&(o.value=r(n.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",w)):n.className&&(o.class=o.className=n.className),e.props=o}(e),e.$$typeof=g,A&&A(e)};var W=n.__r;n.__r=function(e){W&&W(e),e.__c};var j=n.diffed;n.diffed=function(e){j&&j(e);var n=e.props,t=e.__e;null!=t&&"textarea"===e.type&&"value"in n&&n.value!==t.value&&(t.value=null==n.value?"":n.value)};export{e as Component,o as Fragment,l as PureComponent,v as Suspense,h as SuspenseList,t as createElement,k as createPortal,u as memo};
1
+ import{Component as e,options as t,createElement as n,Fragment as o,toChildArray as r,render as _}from"../../dist/preact.js";export{createContext,createRef}from"../../dist/preact.js";export{useCallback,useContext,useEffect,useImperativeHandle,useLayoutEffect,useMemo,useReducer,useRef,useState}from"../../hooks/dist/hooks.js";function i(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function u(e,t){this.props=e,this.context=t}function a(e,t){function o(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:i(this.props,e)}function r(t){return this.shouldComponentUpdate=o,n(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(u.prototype=new e).isPureReactComponent=!0,u.prototype.shouldComponentUpdate=function(e,t){return i(this.props,e)||i(this.state,t)};var l=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),l&&l(e)};var c=t.__e;t.__e=function(e,t,n,o){if(e.then)for(var r,_=t;_=_.__;)if((r=_.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);c(e,t,n,o)};var s=t.unmount;function p(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return p(e,t,n)})),e}function f(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return f(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function v(){this.__u=0,this.o=null,this.__b=null}function d(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function h(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),s&&s(e)},(v.prototype=new e).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=d(o.__v),_=!1,i=function(){_||o.__z||(_=!0,n.__R=null,r?r(a):a())};n.__R=i;var u=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=f(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=u,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(i,i)},v.prototype.componentWillUnmount=function(){this.o=[]},v.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),_=this.__v.__k[0].__c;this.__v.__k[0]=p(this.__b,r,_.__O=_.__P)}this.__b=null}var i=t.__a&&n(o,null,e.fallback);return i&&(i.__u&=-33),[n(o,null,t.__a?null:e.children),i]};var m=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function y(e){return this.getChildContext=function(){return e.context},e.children}function b(e){var t=this,o=e.h;if(t.componentWillUnmount=function(){_(null,t.v),t.v=null,t.h=null},t.h&&t.h!==o&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=o,t.v={nodeType:1,parentNode:o,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:o.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}_(n(y,{context:t.context},e.__v),t.v)}function k(e,t){var o=n(b,{__v:e,h:t});return o.containerInfo=t,o}(h.prototype=new e).__a=function(e){var t=this,n=d(t.__v),o=t.l.get(e);return o[0]++,function(r){var _=function(){t.props.revealOrder?(o.push(r),m(t,e,o)):r()};n?n(_):_()}},h.prototype.render=function(e){this.i=null,this.l=new Map;var t=r(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},h.prototype.componentDidUpdate=h.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){m(e,n,t)})};var g="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,C=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,P=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,x=/[A-Z0-9]/g,N="undefined"!=typeof document,O=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};e.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(e.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var R=t.event;t.event=function(e){return R&&(e=R(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var S={configurable:!0,get:function(){return this.class}},U=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},_=-1==n.indexOf("-");for(var i in t){var u=t[i];if(!("value"===i&&"defaultValue"in t&&null==u||N&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===u?u="":"translate"===a&&"no"===u?u=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||O(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":P.test(i)&&(i=a):a=i="oninput":_&&C.test(i)?i=i.replace(x,"-$&").toLowerCase():null===u&&(u=void 0),"oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=u}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=r(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=r(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",S)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=g,U&&U(e)};var E=t.__r;t.__r=function(e){E&&E(e),e.__c};var w=t.diffed;t.diffed=function(e){w&&w(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};export{e as Component,o as Fragment,u as PureComponent,o as StrictMode,v as Suspense,h as SuspenseList,n as createElement,k as createPortal,a as memo};
2
2
  //# sourceMappingURL=compat.js.map