Do not fail script loading if no script_attributes or data_client_id

This commit is contained in:
Alex P 2023-12-12 10:57:31 +02:00
parent 4e34332c0b
commit 5ab6d3b27d
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -56,10 +56,12 @@ export const loadPaypalScript = (config, onLoaded, onError = null) => {
// Build the PayPal script options. // Build the PayPal script options.
let scriptOptions = keysToCamelCase(config.url_params); let scriptOptions = keysToCamelCase(config.url_params);
scriptOptions = merge(scriptOptions, config.script_attributes); if (config.script_attributes) {
scriptOptions = merge(scriptOptions, config.script_attributes);
}
// Load PayPal script for special case with data-client-token // Load PayPal script for special case with data-client-token
if (config.data_client_id.set_attribute) { if (config.data_client_id?.set_attribute) {
dataClientIdAttributeHandler(scriptOptions, config.data_client_id, callback, errorCallback); dataClientIdAttributeHandler(scriptOptions, config.data_client_id, callback, errorCallback);
return; return;
} }