1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Rebundle livewire using ESM

This commit is contained in:
David Bomba 2024-01-14 12:00:51 +11:00
parent 485b80128f
commit 4f9400454a
18 changed files with 203 additions and 54 deletions

109
public/build/assets/app-01291e40.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
]
},
"resources/js/app.js": {
"file": "assets/app-253efa47.js",
"file": "assets/app-01291e40.js",
"imports": [
"_index-08e160a7.js",
"__commonjsHelpers-725317a4.js"

2
resources/js/app.js vendored
View File

@ -10,7 +10,9 @@
import axios from 'axios';
import cardValidator from 'card-validator';
import { Livewire, Alpine } from '../../vendor/livewire/livewire/dist/livewire.esm';
Livewire.start()
window.axios = axios;
window.valid = cardValidator;

View File

@ -231,4 +231,8 @@ let s = new StripeCreditCard(publishableKey, secret, onlyAuthorization, stripeCo
s.handle();
document.addEventListener('livewire:init', () => {
Livewire.on('passed-required-fields-check', () => s.handle());
});

View File

@ -12,6 +12,12 @@
document.getElementById('payment_method_id').value = paymentMethodId;
}
document.addEventListener('livewire:init', () => {
Livewire.on('beforePaymentEventsCompleted', () => document.getElementById('payment-method-form').submit());
});
</script>
@endpush

View File

@ -14,10 +14,15 @@
document.getElementById('payment_method_id').value = paymentMethodId;
}
Livewire.on('beforePaymentEventsCompleted', () => {
setTimeout(() => {
document.getElementById('payment-method-form').submit()
}, 2500);
document.addEventListener('livewire:init', () => {
Livewire.on('beforePaymentEventsCompleted', () => {
setTimeout(() => {
document.getElementById('payment-method-form').submit()
}, 2500);
});
});
</script>
@endpush

View File

@ -85,7 +85,7 @@
@yield('body')
@livewireScripts
@livewireScriptConfig
<script src="{{ asset('vendor/cookieconsent@3/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>

View File

@ -216,15 +216,19 @@ span {
}
});
Livewire.hook('message.processed', (message, component) => {
document.addEventListener('livewire:init', () => {
Livewire.hook('message.processed', (message, component) => {
Array.from(document.getElementsByClassName("entity-field")).forEach(function(item) {
if(item.innerText.length == 0){
item.parentNode.remove();
}
});
Array.from(document.getElementsByClassName("entity-field")).forEach(function(item) {
if(item.innerText.length == 0){
item.parentNode.remove();
}
});
})
});
var timeout = false;

View File

@ -89,11 +89,16 @@
@section('gateway_footer')
<script>
Livewire.on('passed-required-fields-check', (event) => {
if (event.hasOwnProperty('client_postal_code')) {
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
}
document.addEventListener('livewire:init', () => {
Livewire.on('passed-required-fields-check', (event) => {
if (event.hasOwnProperty('client_postal_code')) {
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
}
});
});
</script>
<script src="https://js.stripe.com/v3/"></script>

View File

@ -72,11 +72,17 @@
@section('gateway_footer')
<script>
Livewire.on('passed-required-fields-check', (event) => {
if (event.hasOwnProperty('client_postal_code')) {
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
}
document.addEventListener('livewire:init', () => {
Livewire.on('passed-required-fields-check', (event) => {
if (event.hasOwnProperty('client_postal_code')) {
document.querySelector('meta[name=client-postal-code]').content = event.client_postal_code;
}
});
});
</script>
@vite('resources/js/clients/payments/wepay-credit-card.js')

View File

@ -117,7 +117,7 @@
@yield('body')
@endcomponent
@livewireScripts
@livewireScriptConfig
<script src="{{ asset('vendor/cookieconsent@3/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>

View File

@ -112,7 +112,7 @@
@yield('body')
@livewireScripts
@livewireScriptConfig
<script src="{{ asset('vendor/cookieconsent@3/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>

View File

@ -46,26 +46,31 @@
@yield('gateway_footer')
<script>
Livewire.on('passed-required-fields-check', () => {
document.querySelector('div[data-ref="required-fields-container"]').classList.add('opacity-25');
document.querySelector('div[data-ref="required-fields-container"]').classList.add('pointer-events-none');
document.querySelector('div[data-ref="gateway-container"]').classList.remove('opacity-25');
document.querySelector('div[data-ref="gateway-container"]').classList.remove('pointer-events-none');
document.addEventListener('livewire:init', () => {
document
.querySelector('div[data-ref="gateway-container"]')
.scrollIntoView({behavior: "smooth"});
});
Livewire.on('passed-required-fields-check', () => {
document.querySelector('div[data-ref="required-fields-container"]').classList.add('opacity-25');
document.querySelector('div[data-ref="required-fields-container"]').classList.add('pointer-events-none');
Livewire.on('update-shipping-data', (event) => {
for (field in event) {
let element = document.querySelector(`input[name=${field}]`);
document.querySelector('div[data-ref="gateway-container"]').classList.remove('opacity-25');
document.querySelector('div[data-ref="gateway-container"]').classList.remove('pointer-events-none');
if (element) {
element.value = event[field];
document
.querySelector('div[data-ref="gateway-container"]')
.scrollIntoView({behavior: "smooth"});
});
Livewire.on('update-shipping-data', (event) => {
for (field in event) {
let element = document.querySelector(`input[name=${field}]`);
if (element) {
element.value = event[field];
}
}
}
});
});
document.addEventListener('DOMContentLoaded', function() {

View File

@ -120,7 +120,7 @@
@yield('body')
@endcomponent
@livewireScripts
@livewireScriptConfig
<script src="{{ asset('vendor/cookieconsent@3/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>

View File

@ -147,8 +147,14 @@
@section('footer')
<script>
Livewire.on('UpdateDefaultMethod::method-updated', event => {
document.querySelector('span[data-ref=success-label]').classList.remove('hidden');
document.addEventListener('livewire:init', () => {
Livewire.on('UpdateDefaultMethod::method-updated', event => {
document.querySelector('span[data-ref=success-label]').classList.remove('hidden');
});
});
</script>
</script>
@endsection

View File

@ -48,6 +48,12 @@
@push('footer')
<script>
Livewire.on('beforePaymentEventsCompleted', () => document.getElementById('payment-method-form').submit());
document.addEventListener('livewire:init', () => {
Livewire.on('beforePaymentEventsCompleted', () => document.getElementById('payment-method-form').submit());
});
</script>
@endpush

View File

@ -104,7 +104,7 @@
@yield('body')
@livewireScripts
@livewireScriptConfig
<script src="{{ asset('vendor/cookieconsent@3/cookieconsent.min.js') }}" data-cfasync="false"></script>
<script>