Skip to content

Embed loader - #467

Merged
Exploding merged 5 commits into
mainfrom
ah/embed
Oct 9, 2026
Merged

Exploding merged 5 commits into
mainfrom
ah/embed

Conversation

@Exploding

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
donate-button Ready Ready Preview Oct 9, 2026 12:20am UTC

Request Review

* container and resizes itself to fit its content.
*/
(function () {
var EMBED_ORIGIN = 'https://embed-staging.every.org';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make the origin dependent on the environment later on?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we will, for now it'll just be available for staging.

everyWidget.create({
selector: '#donate-widget',
partnerSlug: 'your-partner-slug',
nonprofitSlug: 'nonprofit-slug',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially we might want to support ids or eins too in case they change their slug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed, we should allow id or slug

@johnemau johnemau left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☑️ Needs yarn.lock to pass CI. Left comments with No hard blockers.

  • Consider adding a small test file to cover cases like window.everyWidget.create()
  • #462 is needed before vercel will build + deploy

Comment thread packages/donate-embed/embed.js Outdated
var EMBED_ORIGIN = 'https://embed-staging.every.org';

function create(options) {
var container = document.querySelector(options.selector);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/donate-embed/package.json Outdated
"author": "Every.org",
"license": "MIT",
"devDependencies": {
"prettier": "^2.2.1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need an updated yarn.lock to pass ci

Comment thread packages/donate-embed/package.json Outdated
"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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a fairly small script, I'm ok just serving it minified

@Exploding
Exploding merged commit ed5cb56 into main Oct 9, 2026
6 checks passed
@Exploding
Exploding deleted the ah/embed branch October 9, 2026 22:29

This branch was successfully deployed

1 active deployment
Preview — 5196dae7 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants