1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #9152 from turbo124/v5-develop

v5.8.11
This commit is contained in:
David Bomba 2024-01-14 12:03:32 +11:00 committed by GitHub
commit c036c7664f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 211 additions and 60 deletions

View File

@ -1 +1 @@
5.8.10
5.8.11

View File

@ -2,6 +2,7 @@
namespace App\Http\Requests\ClientPortal\PrePayments;
use App\Utils\Number;
use App\Http\ViewComposers\PortalComposer;
use Illuminate\Foundation\Http\FormRequest;
@ -35,6 +36,7 @@ class StorePrePaymentRequest extends FormRequest
{
$input = $this->all();
$input['amount'] = Number::parseFloat($input['amount'], auth()->guard('contact')->user()->client->currency()->precision ?? 2);
$this->replace($input);

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.8.10'),
'app_tag' => env('APP_TAG', '5.8.10'),
'app_version' => env('APP_VERSION', '5.8.11'),
'app_tag' => env('APP_TAG', '5.8.11'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

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

@ -6,4 +6,4 @@
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/class l{constructor(e,t,n,d){this.key=e,this.secret=t,this.onlyAuthorization=n,this.stripeConnect=d}setupStripe(){return this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}createElement(){var e;return this.cardElement=this.elements.create("card",{hidePostalCode:((e=document.querySelector("meta[name=stripe-require-postal-code]"))==null?void 0:e.content)==="0",value:{postalCode:document.querySelector("meta[name=client-postal-code]").content}}),this}mountCardElement(){return this.cardElement.mount("#card-element"),this}completePaymentUsingToken(){let e=document.querySelector("input[name=token]").value,t=document.getElementById("pay-now");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardPayment(this.secret,{payment_method:e}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}completePaymentWithoutToken(){let e=document.getElementById("pay-now");this.payNowButton=e,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let t=document.getElementById("cardholder-name");this.stripe.handleCardPayment(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:t.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}handleFailure(e){let t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}handleAuthorization(){let e=document.getElementById("cardholder-name"),t=document.getElementById("authorize-card");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardSetup(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:e.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccessfulAuthorization(n))}handleSuccessfulAuthorization(e){document.getElementById("gateway_response").value=JSON.stringify(e.setupIntent),document.getElementById("server_response").submit()}handle(){this.setupStripe(),this.onlyAuthorization?(this.createElement().mountCardElement(),document.getElementById("authorize-card").addEventListener("click",()=>this.handleAuthorization())):(Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",()=>{try{return document.querySelector("input[name=token]").value?this.completePaymentUsingToken():this.completePaymentWithoutToken()}catch(e){console.log(e.message)}}))}}var o;const c=((o=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:o.content)??"";var r;const u=((r=document.querySelector('meta[name="stripe-secret"]'))==null?void 0:r.content)??"";var a;const m=((a=document.querySelector('meta[name="only-authorization"]'))==null?void 0:a.content)??"";var s;const h=((s=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:s.content)??"";let i=new l(c,u,m,h);i.handle();Livewire.on("passed-required-fields-check",()=>i.handle());
*/class l{constructor(e,t,n,d){this.key=e,this.secret=t,this.onlyAuthorization=n,this.stripeConnect=d}setupStripe(){return this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}createElement(){var e;return this.cardElement=this.elements.create("card",{hidePostalCode:((e=document.querySelector("meta[name=stripe-require-postal-code]"))==null?void 0:e.content)==="0",value:{postalCode:document.querySelector("meta[name=client-postal-code]").content}}),this}mountCardElement(){return this.cardElement.mount("#card-element"),this}completePaymentUsingToken(){let e=document.querySelector("input[name=token]").value,t=document.getElementById("pay-now");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardPayment(this.secret,{payment_method:e}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}completePaymentWithoutToken(){let e=document.getElementById("pay-now");this.payNowButton=e,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden");let t=document.getElementById("cardholder-name");this.stripe.handleCardPayment(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:t.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}handleFailure(e){let t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,this.payNowButton.disabled=!1,this.payNowButton.querySelector("svg").classList.add("hidden"),this.payNowButton.querySelector("span").classList.remove("hidden")}handleAuthorization(){let e=document.getElementById("cardholder-name"),t=document.getElementById("authorize-card");this.payNowButton=t,this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),this.stripe.handleCardSetup(this.secret,this.cardElement,{payment_method_data:{billing_details:{name:e.value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccessfulAuthorization(n))}handleSuccessfulAuthorization(e){document.getElementById("gateway_response").value=JSON.stringify(e.setupIntent),document.getElementById("server_response").submit()}handle(){this.setupStripe(),this.onlyAuthorization?(this.createElement().mountCardElement(),document.getElementById("authorize-card").addEventListener("click",()=>this.handleAuthorization())):(Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",e=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",()=>{try{return document.querySelector("input[name=token]").value?this.completePaymentUsingToken():this.completePaymentWithoutToken()}catch(e){console.log(e.message)}}))}}var o;const c=((o=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:o.content)??"";var r;const u=((r=document.querySelector('meta[name="stripe-secret"]'))==null?void 0:r.content)??"";var a;const m=((a=document.querySelector('meta[name="only-authorization"]'))==null?void 0:a.content)??"";var s;const h=((s=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:s.content)??"";let i=new l(c,u,m,h);i.handle();document.addEventListener("livewire:init",()=>{Livewire.on("passed-required-fields-check",()=>i.handle())});

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"
@ -146,7 +146,7 @@
"src": "resources/js/clients/payments/stripe-browserpay.js"
},
"resources/js/clients/payments/stripe-credit-card.js": {
"file": "assets/stripe-credit-card-af3a9013.js",
"file": "assets/stripe-credit-card-5690eb6c.js",
"isEntry": true,
"src": "resources/js/clients/payments/stripe-credit-card.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;
}
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

@ -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,16 +216,20 @@ 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;
/* Watch for resize of window and ensure we unset props with no values */

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,28 +46,33 @@
@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() {
let toggleWithToken = document.querySelector('.toggle-payment-with-token');
let toggleWithCard = document.querySelector('#toggle-payment-with-credit-card');

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>