Error in the JS snippet provided at https://developer.paypal.com/docs/integration/direct/identity/button-js-builder/
// Source at https://www.paypalobjects.com/js/external/connect/login.js | |
//... | |
getTranslation: function(n) { | |
var t = n || {} | |
, e = t.text | |
, a = t.locale | |
, o = t.buttonSize | |
, i = "LWP" === t.labelType ? this.logInTranslations : this.connectTranslation; | |
return e || (a || (a = navigator.language || navigator.userLanguage), | |
2 === a.length && (a = a + "-" + a), | |
// If o (buttonSize is undefined getTranslation() return void(0) aka undefined) | |
// If buttonSize is optional by design and it has not been defined in the config | |
// i[a].lg_content should be return instead of undefined | |
i[a = a.replace(/_/, "-").toLowerCase()] ? o ? "lg" === o ? i[a].lg_content : i[a].sm_content : void 0 : i["en-us"].lg_content) | |
}, | |
//... | |
//Then in the render function… | |
var t = "sandbox" === n.authend ? "https://www.sandbox.paypal.com/signin/authorize" : "https://www.paypal.com/signin/authorize" | |
, e = n.appid || null | |
, a = n.returnurl || null | |
, o = n.scopes || "basic" | |
, i = n.containerid ? document.getElementById(n.containerid) : n.containerelement ? n.containerelement : x | |
, r = n.responseType || "code" | |
, l = n.prompt | |
, c = n.state | |
, s = (n.openIdUiMode, | |
// …this shows always the english text if buttonSize has not been provided | |
// as it's the case on the example snippet provided at | |
// https://developer.paypal.com/docs/integration/direct/identity/button-js-builder/ | |
f.getTranslation(n) || "Connect with PayPal") | |
, g = n.theme && "neutral" === n.theme.toLowerCase() ? "" : " PPBlue_V2" | |
, m = { | |
flowEntry: "lg" === n.buttonSize ? "CWPP_large" : "CWPP_small", | |
client_id: e, | |
response_type: r, | |
scope: o, | |
redirect_uri: encodeURIComponent(a), | |
nonce: f.createRandomNumber(), | |
newUI: "Y", | |
prompt: l, | |
state: c | |
} | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment