Replace native confirms with Ladill custom dialogs.
Deploy Ladill Merchant / deploy (push) Successful in 37s

This commit is contained in:
isaacclad
2026-07-24 20:55:47 +00:00
parent 775d05473a
commit f4e4e457f3
7 changed files with 216 additions and 56 deletions
+12 -1
View File
@@ -33,6 +33,10 @@ export function ladillNeedsTopup(balance, price) {
return normalizedBalance <= 0 || normalizedBalance < normalizedPrice;
}
/**
* Alpine store mirrors window.ladillConfirm (defined in partials/confirm-prompt).
* Prefer window.ladillConfirm for new code — it works without Alpine and powers data-confirm forms.
*/
export function registerLadillConfirmStore(Alpine) {
Alpine.store('ladillConfirm', {
open: false,
@@ -44,6 +48,11 @@ export function registerLadillConfirmStore(Alpine) {
_resolve: null,
ask(options = {}) {
// Delegate to the global custom dialog when available (no double UI).
if (typeof window.ladillConfirm === 'function' && window.__ladillConfirmInstalled) {
return window.ladillConfirm(options);
}
return new Promise((resolve) => {
this.title = options.title || 'Are you sure?';
this.message = options.message || '';
@@ -65,7 +74,9 @@ export function registerLadillConfirmStore(Alpine) {
},
});
window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options);
if (typeof window.ladillConfirm !== 'function') {
window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options);
}
}
export function registerLadillModalHelpers() {