donate fixed

This commit is contained in:
tonyrewin 2022-11-10 20:04:39 +03:00
parent 6644e01585
commit 3f5c2deab6
2 changed files with 73 additions and 61 deletions

View File

@ -20,7 +20,7 @@ export const Donate = () => {
const [period, setPeriod] = createSignal(monthly) const [period, setPeriod] = createSignal(monthly)
const [amount, setAmount] = createSignal(0) const [amount, setAmount] = createSignal(0)
onMount(() => { const initiated = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const { const {
cp: { CloudPayments } cp: { CloudPayments }
@ -51,6 +51,16 @@ export const Donate = () => {
provision: 0 // Сумма оплаты встречным предоставлением (сертификаты, др. мат.ценности) (2 знака после запятой) provision: 0 // Сумма оплаты встречным предоставлением (сертификаты, др. мат.ценности) (2 знака после запятой)
} }
}) })
}
onMount(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const script = document.createElement('script')
script.type = 'text/javascript'
script.src = 'https://widget.cloudpayments.ru/bundles/cloudpayments.js'
script.async = true
script.onload = initiated
document.head.appendChild(script)
}) })
const show = () => { const show = () => {
@ -103,70 +113,68 @@ export const Donate = () => {
} }
return ( return (
<> <form class="discours-form donate-form" action="" method="post">
<form class="discours-form donate-form" action="" method="post"> <input type="hidden" name="shopId" value="156465" />
<input type="hidden" name="shopId" value="156465" /> <input value="148805" name="scid" type="hidden" />
<input value="148805" name="scid" type="hidden" /> <input value="0" name="customerNumber" type="hidden" />
<input value="0" name="customerNumber" type="hidden" />
<div class="form-group"> <div class="form-group">
<div class="donate-buttons-container" ref={amountSwitchElement}> <div class="donate-buttons-container" ref={amountSwitchElement}>
<input type="radio" name="amount" id="fix250" value="250" /> <input type="radio" name="amount" id="fix250" value="250" />
<label for="fix250" class="btn donate-value-radio"> <label for="fix250" class="btn donate-value-radio">
250&thinsp; 250&thinsp;
</label> </label>
<input type="radio" name="amount" id="fix500" value="500" checked /> <input type="radio" name="amount" id="fix500" value="500" checked />
<label for="fix500" class="btn donate-value-radio"> <label for="fix500" class="btn donate-value-radio">
500&thinsp; 500&thinsp;
</label> </label>
<input type="radio" name="amount" id="fix1000" value="1000" /> <input type="radio" name="amount" id="fix1000" value="1000" />
<label for="fix1000" class="btn donate-value-radio"> <label for="fix1000" class="btn donate-value-radio">
1000&thinsp; 1000&thinsp;
</label> </label>
<input <input
class="form-control donate-input" class="form-control donate-input"
required required
ref={customAmountElement} ref={customAmountElement}
type="number" type="number"
name="sum" name="sum"
placeholder={t('Another amount')} placeholder={t('Another amount')}
/> />
</div>
</div> </div>
</div>
<div class="form-group" id="payment-type" classList={{ showing: showingPayment() }}> <div class="form-group" id="payment-type" classList={{ showing: showingPayment() }}>
<div class="btn-group payment-choose" data-toggle="buttons"> <div class="btn-group payment-choose" data-toggle="buttons">
<input <input
type="radio" type="radio"
autocomplete="off" autocomplete="off"
id="once" id="once"
name="once" name="once"
onClick={() => setPeriod(once)} onClick={() => setPeriod(once)}
checked={period() === once} checked={period() === once}
/> />
<label for="once" class="btn payment-type" classList={{ active: period() === once }}> <label for="once" class="btn payment-type" classList={{ active: period() === once }}>
{t('One time')} {t('One time')}
</label> </label>
<input <input
type="radio" type="radio"
autocomplete="off" autocomplete="off"
id="monthly" id="monthly"
name="monthly" name="monthly"
onClick={() => setPeriod(monthly)} onClick={() => setPeriod(monthly)}
checked={period() === monthly} checked={period() === monthly}
/> />
<label for="monthly" class="btn payment-type" classList={{ active: period() === monthly }}> <label for="monthly" class="btn payment-type" classList={{ active: period() === monthly }}>
{t('Every month')} {t('Every month')}
</label> </label>
</div>
</div> </div>
</div>
<div class="form-group"> <div class="form-group">
<a href={''} class="btn send-btn donate" onClick={show}> <a href={''} class="btn send-btn donate" onClick={show}>
{t('Help discours to grow')} {t('Help discours to grow')}
</a> </a>
</div> </div>
</form> </form>
</>
) )
} }

View File

@ -6,6 +6,10 @@ import { initRouter } from '../../stores/router'
const { pathname, search } = Astro.url const { pathname, search } = Astro.url
initRouter(pathname, search) initRouter(pathname, search)
Astro.response.headers.set(
"Content-Security-Policy",
"frame-src 'self' https://*.discours.io https://widget.cloudpayments.ru; frame-ancestors 'self' https://*.discours.io https://widget.cloudpayments.ru;"
)
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate') Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
--- ---