@cshah18/sdk 4.3.0 → 4.4.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.
@@ -2091,9 +2091,11 @@ class LobbyModal {
2091
2091
  onlineCheckoutBtn.className = "offline-online-checkout-btn";
2092
2092
  onlineCheckoutBtn.textContent = "Checkout Online";
2093
2093
  onlineCheckoutBtn.addEventListener("click", () => {
2094
- if (this.data.groupLink) {
2095
- window.open(this.data.groupLink, "_blank");
2096
- }
2094
+ this.close();
2095
+ // Ensure modal closes before triggering checkout intent
2096
+ window.setTimeout(() => {
2097
+ this.triggerContinueToCheckout();
2098
+ }, 0);
2097
2099
  });
2098
2100
  actionsRow.appendChild(downloadQRBtn);
2099
2101
  actionsRow.appendChild(onlineCheckoutBtn);
@@ -2332,6 +2334,21 @@ class LobbyModal {
2332
2334
  `;
2333
2335
  document.head.appendChild(style);
2334
2336
  }
2337
+ /**
2338
+ * Trigger the same checkout flow as clicking "Continue to Checkout" on the widget
2339
+ */
2340
+ triggerContinueToCheckout() {
2341
+ const buttons = Array.from(document.querySelectorAll(".cobuy-button"));
2342
+ const target = buttons.find((btn) => {
2343
+ const text = (btn.textContent || "").trim().toLowerCase();
2344
+ return text.includes("continue to checkout") || text === "checkout" || text.includes("checkout");
2345
+ });
2346
+ if (!target) {
2347
+ this.logger.warn("[LobbyModal] Could not find a checkout button to trigger");
2348
+ return;
2349
+ }
2350
+ target.click();
2351
+ }
2335
2352
  /**
2336
2353
  * Create offer section
2337
2354
  */