mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
* checkout.com credit card payment for livewire * implement interface for livewire view * livewire method interface * implement interfaces * assets production build * checkout.com: credit card * stripe: credit card * lift up logic from process payment component * update stripe payment view logic * wait fn for mounting existing JS * credit card: simplify data passing * stripe: browser pay * stripe cc: remove getData * stripe: cc * stripe: alipay * checkout :cc * stripe: apple pay * stripe: browser pay * assets production build
44 lines
1.2 KiB
JavaScript
Vendored
44 lines
1.2 KiB
JavaScript
Vendored
/**
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
*/
|
|
|
|
/**
|
|
* @param {...string} selectors
|
|
*/
|
|
export function wait(...selectors) {
|
|
return new Promise((resolve) => {
|
|
if (!selectors.length) {
|
|
resolve([]);
|
|
return;
|
|
}
|
|
|
|
const elements = selectors
|
|
.map((selector) => document.querySelector(selector))
|
|
.filter(Boolean);
|
|
|
|
if (elements.length === selectors.length) {
|
|
resolve(elements);
|
|
return;
|
|
}
|
|
|
|
const observer = new MutationObserver(() => {
|
|
const foundElements = selectors
|
|
.map((selector) => document.querySelector(selector))
|
|
.filter(Boolean);
|
|
|
|
if (foundElements.length === selectors.length) {
|
|
observer.disconnect();
|
|
resolve(foundElements);
|
|
}
|
|
});
|
|
|
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
});
|
|
}
|