Mark widget config "styles" property as required #14
Replies: 3 comments
-
Hi Ross, |
Beta Was this translation helpful? Give feedback.
-
Hey @rossparachute , Thank you for the feedback - we will address the issue. @monica-m-ps please create a bug for this. |
Beta Was this translation helpful? Give feedback.
-
Easy one to overlook if styles were always being passed. Enjoyed working with the API and components besides that! Cheers for the help, |
Beta Was this translation helpful? Give feedback.
-
Hey there,
Creating a new instance of Dojo.Payment() will throw an error if you don't pass styles.
Specifically, it was looking for a "form" prop on the config.styles object.
https://docs.dojo.tech/payments/accept-payments/components/configuration#config
Due to the server.js script being minified it's less clear what's missing and throwing the exception.
Could be worth making it clearer in the docs the styles prop is required.
Nabbing the default styles from the sample got things working again:
https://github.com/dojo-engineering/dojo-samples/tree/main/samples/accept-a-payment/prebuilt-checkout
Ross
Expected Behaviour
A fully functional Card Component widget is initialized.
Actual Behaviour
The Card Component widget is only partially setup and will fail when executePayment() is fired due to the exception throwing an error in the constructor.
Error thrown in:
https://web.e.connect.paymentsense.cloud/assets/js/server.js
(minified but it was about here in the Payment constructor)
Exception thrown
Leading to:
Reproducible Example
This fails (stripped down):
This succeeds:
Where DefaultStyles is shaped something like:
https://github.com/dojo-engineering/dojo-samples/blob/main/samples/accept-a-payment/prebuilt-checkout/client/react-cra/src/styles/DefaultStyles.js
Beta Was this translation helpful? Give feedback.
All reactions