@pernod-ricard-global-cms/jsutils 3.2.0 → 3.2.1

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 (2) hide show
  1. package/jsutils.mjs +7 -3
  2. package/package.json +1 -1
package/jsutils.mjs CHANGED
@@ -639,9 +639,13 @@ async function handleCTBClick(event) {
639
639
  window.isCTBLoaded = true;
640
640
 
641
641
  // This is important!! Never remove this code
642
- setTimeout(() => {
643
- event.target.click();
644
- }, 100);
642
+ const clonedEvent = new event.constructor(event.type, event);
643
+ const repeatEventInterval = setInterval(() => {
644
+ event.target.dispatchEvent(clonedEvent);
645
+ if (document.querySelector('.ctbuy-modal') !== null) {
646
+ clearInterval(repeatEventInterval);
647
+ }
648
+ }, 100)
645
649
  }
646
650
  }
647
651
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pernod-ricard-global-cms/jsutils",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Handy collection of Javascript utility functions",
5
5
  "type": "commonjs",
6
6
  "main": "jsutils.mjs",