adopted-ember-addons / ember-stripe-elements

A simple Ember wrapper for Stripe Elements
https://ember-stripe-elements.netlify.com
MIT License
19 stars 23 forks source link

Use official Stripe loader #25

Open lindyhopchris opened 3 years ago

lindyhopchris commented 3 years ago

Stripe now provide an official Stripe loader module: https://github.com/stripe/stripe-js

We should use that to load Stripe.

lindyhopchris commented 3 years ago

@st-h just wanted to check your opinion on this before I implement...

Basically I think we should switch to using the official Stripe loader; always better to use something official imho!

The Stripe loader is an async function... therefore I think when we switch to it, we should change this package so that you always have to explicitly call the Stripe service's load method. That's so the developer is explicilty handling the async nature of loading Stripe, and where they want to do this within their application code.

Personally I think that's better than calling the async Stripe loader behind the scenes.

Do you think that's an acceptable change?

st-h commented 3 years ago

@lindyhopchris Personally, I think it would be fine to make the consuming app to explicitly load stripe when needed. We are already using it like that in our app through the config param. I think it's common for payment to be only a subset of the features of an ember app and usually there is no need to load stripe unless someone visits a page/route that needs stripe.

If I understand it correctly, the stripe loading wrapper will just replace the custom code to load stripe within this addon? That would be perfectly fine and less code to maintain 👍

lindyhopchris commented 3 years ago

Great - thanks for the response, we're on exactly the same page! I'll sort it out this week.

Fyi I tagged a 1.0.0 this morning from the master branch. The develop branch has the next major release so once I've taken care of this issue I might tag a 2.0.0-rc.1.

st-h commented 3 years ago

@lindyhopchris awesome. thanks a bunch 👍