components
2 years ago
addons-admin-page.js
4 years ago
donation-options.ts
3 years ago
payment-gateway.ts
3 years ago
sale-banner.js
2 years ago
utils.js
4 years ago
payment-gateway.ts
40 lines
| 1 | import dismissRecommendation from '@givewp/promotions/requests/dismissRecommendation'; |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * @since 2.27.1 |
| 6 | * |
| 7 | */ |
| 8 | declare global { |
| 9 | interface Window { |
| 10 | GiveSettings: GiveSettingsData; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | export interface GiveSettingsData { |
| 15 | apiRoot: string; |
| 16 | apiNonce: string; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * |
| 21 | * @since 2.27.1 |
| 22 | * |
| 23 | */ |
| 24 | const feeRecoveryProductRecommendation = document.querySelector( |
| 25 | '.givewp-payment-gateway-fee-recovery-recommendation-row' |
| 26 | ); |
| 27 | |
| 28 | if (feeRecoveryProductRecommendation) { |
| 29 | const dismissAction = document.querySelector('.givewp-payment-gateway-fee-recovery-recommendation_close'); |
| 30 | const table = document.querySelector('.give-setting-tab-body-gateways'); |
| 31 | const preceedingContent = table.querySelector('tr'); |
| 32 | |
| 33 | preceedingContent.insertAdjacentElement('afterend', feeRecoveryProductRecommendation); |
| 34 | |
| 35 | dismissAction.addEventListener('click', async function (event) { |
| 36 | feeRecoveryProductRecommendation.remove(); |
| 37 | await dismissRecommendation('givewp_payment_gateway_fee_recovery_recommendation', window.GiveSettings.apiNonce); |
| 38 | }); |
| 39 | } |
| 40 |