Add Financial Account for Platforms disclosure React component#630
Conversation
|
|
||
| if (onLoad) { | ||
| onLoad(); | ||
| } |
There was a problem hiding this comment.
This should be called once disclosurePromise resolves without error (e.g., line 109)
There was a problem hiding this comment.
Wouldn't the promise then already be loaded? I specifically broke up the instantiation of the call to createFinancialAccountDisclosure and awaiting said call so that I could call onLoad when the component was actually doing loading. If I didn't want to capture the exact loading state, I would have instead simply just written:
const {htmlElement: disclosureContent, error} = await (stripeState as any).createFinancialAccountDisclosure(
options
);
There was a problem hiding this comment.
Brian and I chatted about this. The onLoad function is typically called when an object has already been loaded, not when it's loading (W3 docs example).
| }; | ||
|
|
||
| createDisclosure(); | ||
| }, [stripeState, options, onLoad, onError]); |
There was a problem hiding this comment.
should use the specific option values in the dependency array, like options.businessName and options.learnMoreLink, so that this doesn't trigger the createFinancialAccountDisclosure call unless the options actually change.
Summary & motivation
Adds a new React component,
FinancialAccountDisclosure, that users can use to add the compulsory disclosure text detailing our Financial Account (FA) for platforms product (fka Treasury), the banking partners we work with, and information about FDIC insurance.Testing & documentation
I tested this change by creating a new local testing file in
examples/hooksand runningyarn run storybookI also wrote tests in
src/components/FinancialAccountDisclosure.test.tsxthat I ran withyarn jest