Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| * container and resizes itself to fit its content. | ||
| */ | ||
| (function () { | ||
| var EMBED_ORIGIN = 'https://embed-staging.every.org'; |
There was a problem hiding this comment.
Do we want to make the origin dependent on the environment later on?
There was a problem hiding this comment.
Yeah we will, for now it'll just be available for staging.
| everyWidget.create({ | ||
| selector: '#donate-widget', | ||
| partnerSlug: 'your-partner-slug', | ||
| nonprofitSlug: 'nonprofit-slug', |
There was a problem hiding this comment.
Potentially we might want to support ids or eins too in case they change their slug.
There was a problem hiding this comment.
Yeah agreed, we should allow id or slug
| var EMBED_ORIGIN = 'https://embed-staging.every.org'; | ||
|
|
||
| function create(options) { | ||
| var container = document.querySelector(options.selector); |
There was a problem hiding this comment.
This will throw for malformed selectors or missing selector like
everyWidget.create({selector: '', partnerSlug: 'p', nonprofitSlug: 'n'});
everyWidget.create({selector: '###', partnerSlug: 'p', nonprofitSlug: 'n'});
// no options
everyWidget.create();| <script src="https://embeds.every.org/embed.js"></script> | ||
| <script> | ||
| everyWidget.create({ | ||
| selector: '#donate-widget', |
There was a problem hiding this comment.
We should accept an HTMLElement here as well to support partners using Web Components with encapsulated shadow dom.
That way they can do the querying for the container.
| "author": "Every.org", | ||
| "license": "MIT", | ||
| "devDependencies": { | ||
| "prettier": "^2.2.1" |
There was a problem hiding this comment.
This will need an updated yarn.lock to pass ci
| "private": true, | ||
| "description": "Loader script (embed.js) for the embedded every.org donate flow, published at https://embeds.every.org/embed.js", | ||
| "scripts": { | ||
| "build": "mkdir -p dist/donate-button && cp embed.js dist/donate-button/embed.js", |
There was a problem hiding this comment.
Consider building this with vite, you could implement it in TypeScript and the minified output could go from 1.0 kB → 0.65 kB gzipped
There was a problem hiding this comment.
it's a fairly small script, I'm ok just serving it minified
No description provided.