give
/
src
/
PaymentGateways
/
Gateways
/
Offline
/
resources
/
formBuilder
/
addOfflineAttributes.ts
addOfflineAttributes.ts
2 years ago
index.tsx
2 years ago
useSetDefaultAttributes.ts
2 years ago
withOfflineInspectorControls.tsx
2 years ago
addOfflineAttributes.ts
32 lines
| 1 | declare const window: { |
| 2 | giveOfflineGatewaySettings: { |
| 3 | defaultInstructions: string; |
| 4 | }; |
| 5 | } & Window; |
| 6 | |
| 7 | export const offlineAttributes = { |
| 8 | offlineEnabled: { |
| 9 | type: 'boolean', |
| 10 | default: true, |
| 11 | }, |
| 12 | offlineUseGlobalInstructions: { |
| 13 | type: 'boolean', |
| 14 | default: true, |
| 15 | }, |
| 16 | offlineDonationInstructions: { |
| 17 | type: 'string', |
| 18 | default: window.giveOfflineGatewaySettings.defaultInstructions, |
| 19 | }, |
| 20 | }; |
| 21 | |
| 22 | export default function addAttribute(settings, name) { |
| 23 | if (name === 'givewp/payment-gateways') { |
| 24 | settings.attributes = { |
| 25 | ...settings.attributes, |
| 26 | offlineAttributes, |
| 27 | }; |
| 28 | } |
| 29 | |
| 30 | return settings; |
| 31 | } |
| 32 |