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