Last active
March 27, 2019 17:41
-
-
Save aitor/fe8554f859bc8eb26bb6c3de728f5072 to your computer and use it in GitHub Desktop.
Error in the JS snippet provided at https://developer.paypal.com/docs/integration/direct/identity/button-js-builder/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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