1.1.8
These get published to NPM and from there to places like UNPKG, e.g. at https://unpkg.com/browse/@gp-australia-pacific/gpap-frontend-functions/
Once on the CDN, can be added to webpages directly.
Add the latest version of the helper scripts & CSS (e.g. in the HTML head):
<script src="https://unpkg.com/@gp-australia-pacific/gpap-frontend-functions@latest"></script>
<link rel="stylesheet" href="https://unpkg.com/@gp-australia-pacific/gpap-frontend-functions@latest/dist/gp-donate.css">
In the JavaScript:
var recurringId = 'donate-disclaimer-rg';
var oneOffId = 'donate-disclaimer-oo';
var newFreq = donations.getToggler(oneOffId, recurringId);
In the HTML below the donate form:
<div class="donate-disclaimer-container gp-text-slate">
<p id="donate-disclaimer-oo" class="gp-hidden">
Your generous one-time gift helps fund our campaigns for a better and greener future.
</p>
<p id="donate-disclaimer-rg" class="gp-hidden">
Your account will be debited today, then every subsequent 4 weeks. <a href="https://www.greenpeace.org.au/contact/">Get in touch with us to</a> arrange an alternative date.
</p>
</div>
Make a change
Submit a Pull Request
Once merged, run npm run pub
(note that trying to use Yarn will result in an error publishing to the Yarn registry; use npm
and it will publish correctly to the NPM registry).
View API docs online or locally via yarn docs:serve
.
Generate it:
yarn global add documentation
yarn docs:build
open docs/index.html
Publish it:
yarn docs:publish
SIDE EFFECT: We add to a global:
document.donationInfo
is set to be a DonationInfoObject.
This is meant as a convenience to users, so the getInfo function need not be invoked directly. This is safe, since by the time we execute, the URL params are already set.
```
var firstName = document.donationInfo.firstName;
```
Information about a donation.
Type: Object
Get donation info from donate redirect URL parameters. This is designed for compatibility with GPAP donation pages.
Rather than calling this function, you can just use the global `document.donationInfo`.
DonationInfoObject
:
Gets a frequency toggler function.
Function
:
whose name can be passed as the
frequency-hook
to the donation element.
Get the gift type based on info from the URL parameters.
string
:
'donation' | 'regular donation'