This PR uses the dasherized block integration ID instead of the plugin ID when creating the main script handle.
Details
Using the Block_Integration_Trait:: get_id_dasherized() will return the current gateway ID, or the plugin ID, depending if the integration is for a gateway or a plugin.
This change helps to ensure that each gateway within a single plugin can manage their own script handle and dependencies.
For example, in Cybersource, the eCheck and Credit Card gateways have different dependencies, but if they share the same handle, it will mean that only the dependencies for the credit card gateway are ever enqueued.
The scripts can ultimately have the same source, but the browser will only download the file once. The file will execute each time it is included, but our entry points simply register payment methods, which is a cheap operation and doing so multiple times does not seem to have any side-effects in my testing.
QA
TODO
Open questions
[x] I see there's already a branch open for the next release, however, it would be great if we could get this one out before we release Cybersource, so I opened the PR against the master branch for now - should we bump the current release branch to next patch version (5.12.3)?
Summary
This PR uses the dasherized block integration ID instead of the plugin ID when creating the main script handle.
Details
Using the
Block_Integration_Trait:: get_id_dasherized()
will return the current gateway ID, or the plugin ID, depending if the integration is for a gateway or a plugin.This change helps to ensure that each gateway within a single plugin can manage their own script handle and dependencies.
For example, in Cybersource, the eCheck and Credit Card gateways have different dependencies, but if they share the same handle, it will mean that only the dependencies for the credit card gateway are ever enqueued.
The scripts can ultimately have the same source, but the browser will only download the file once. The file will execute each time it is included, but our entry points simply register payment methods, which is a cheap operation and doing so multiple times does not seem to have any side-effects in my testing.
QA
TODO
Open questions
master
branch for now - should we bump the current release branch to next patch version (5.12.3
)?