Socket
Socket
Sign inDemoInstall

braintree-paypal-client-config

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

26

dist/braintree-paypal-client-config.js

@@ -96,3 +96,3 @@ !function(root, factory) {

var CONFIG_KEY = "__braintree_paypal_config__", STORE = {
LOCALSTORAGE: "localstorage",
SESSIONSTORAGE: "sessionstorage",
GLOBAL: "global"

@@ -171,5 +171,5 @@ }, KEY = {

}
}), _defineProperty(_stores, __WEBPACK_IMPORTED_MODULE_0__constants__.d.LOCALSTORAGE, {
}), _defineProperty(_stores, __WEBPACK_IMPORTED_MODULE_0__constants__.d.SESSIONSTORAGE, {
get: function(key) {
var storage = localStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
var storage = window.sessionStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
storage = storage ? JSON.parse(storage) : {};

@@ -179,24 +179,24 @@ return storage[key];

set: function(key, value) {
var storage = localStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
var storage = window.sessionStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
storage = storage ? JSON.parse(storage) : {};
storage[key] = value;
localStorage.setItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a, JSON.stringify(storage));
window.sessionStorage.setItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a, JSON.stringify(storage));
return value;
},
has: function(key) {
var storage = localStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
var storage = window.sessionStorage.getItem(__WEBPACK_IMPORTED_MODULE_0__constants__.a);
storage = storage ? JSON.parse(storage) : {};
return storage.hasOwnProperty(key);
}
}), _stores), store = Object(__WEBPACK_IMPORTED_MODULE_1__util__.a)() ? stores[__WEBPACK_IMPORTED_MODULE_0__constants__.d.LOCALSTORAGE] : stores[__WEBPACK_IMPORTED_MODULE_0__constants__.d.GLOBAL];
}), _stores), store = Object(__WEBPACK_IMPORTED_MODULE_1__util__.a)() ? stores[__WEBPACK_IMPORTED_MODULE_0__constants__.d.SESSIONSTORAGE] : stores[__WEBPACK_IMPORTED_MODULE_0__constants__.d.GLOBAL];
},
"./src/util.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function isLocalStorageEnabled() {
function isSessionStorageEnabled() {
try {
if (window.localStorage) {
if (window.sessionStorage) {
var value = Math.random().toString();
window.localStorage.setItem("__test__localStorage__", value);
var result = window.localStorage.getItem("__test__localStorage__");
window.localStorage.removeItem("__test__localStorage__");
window.sessionStorage.setItem("__test__sessionStorage__", value);
var result = window.sessionStorage.getItem("__test__sessionStorage__");
window.sessionStorage.removeItem("__test__sessionStorage__");
if (value === result) return !0;

@@ -207,3 +207,3 @@ }

}
__webpack_exports__.a = isLocalStorageEnabled;
__webpack_exports__.a = isSessionStorageEnabled;
}

@@ -210,0 +210,0 @@ });

@@ -1,3 +0,3 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("btppClientConfig",[],n):"object"==typeof exports?exports.btppClientConfig=n():t.btppClientConfig=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s="./src/index.js")}({"./src/config.js":function(t,n,e){"use strict";function r(t,n){return c.a.has(t)?c.a.get(t):n}function o(t,n){if(c.a.set(t,n),u[t])for(var e=u[t],r=Array.isArray(e),o=0,e=r?e:e[Symbol.iterator]();;){var a;if(r){if(o>=e.length)break;a=e[o++]}else{if(o=e.next(),o.done)break;a=o.value}var i=a;i(n)}return n}function a(t,n){return c.a.has(t)?r(t):o(t,n)}function i(t,n){return u[t]=u[t]||[],u[t].push(n),{cancel:function(){u[t].splice(u[t].indexOf(n),1)}}}n.a=r,n.d=o,n.b=a,n.c=i;var c=e("./src/store.js"),u={}},"./src/constants.js":function(t,n,e){"use strict";e.d(n,"a",function(){return r}),e.d(n,"d",function(){return o}),e.d(n,"b",function(){return a}),e.d(n,"c",function(){return i});var r="__braintree_paypal_config__",o={LOCALSTORAGE:"localstorage",GLOBAL:"global"},a={LOGGER_SESSION_ID:"logger_session_id",PAYPAL_FUNDING_DISALLOW:"paypal_funding_disallow"},i={PAYPAL:"paypal",VENMO:"venmo",CREDIT:"credit",CARD:"card",IDEAL:"ideal",ELV:"elv"}},"./src/index.js":function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./src/config.js");e.d(n,"get",function(){return r.a}),e.d(n,"set",function(){return r.d}),e.d(n,"get_or_set",function(){return r.b}),e.d(n,"on",function(){return r.c});var o=e("./src/constants.js");e.d(n,"CONFIG_KEY",function(){return o.a}),e.d(n,"STORE",function(){return o.d}),e.d(n,"KEY",function(){return o.b}),e.d(n,"PAYPAL_FUNDING",function(){return o.c})},"./src/store.js":function(t,n,e){"use strict";function r(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}e.d(n,"a",function(){return u});var o,a=e("./src/constants.js"),i=e("./src/util.js"),c=(o={},r(o,a.d.GLOBAL,{get:function(t){return(window[a.a]||{})[t]},set:function(t,n){var e=window[a.a]||{};return e[t]=n,window[a.a]=e,n},has:function(t){return(window[a.a]||{}).hasOwnProperty(t)}}),r(o,a.d.LOCALSTORAGE,{get:function(t){var n=localStorage.getItem(a.a);return n=n?JSON.parse(n):{},n[t]},set:function(t,n){var e=localStorage.getItem(a.a);return e=e?JSON.parse(e):{},e[t]=n,localStorage.setItem(a.a,JSON.stringify(e)),n},has:function(t){var n=localStorage.getItem(a.a);return n=n?JSON.parse(n):{},n.hasOwnProperty(t)}}),o),u=Object(i.a)()?c[a.d.LOCALSTORAGE]:c[a.d.GLOBAL]},"./src/util.js":function(t,n,e){"use strict";function r(){try{if(window.localStorage){var t=Math.random().toString();window.localStorage.setItem("__test__localStorage__",t);var n=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),t===n)return!0}}catch(t){}return!1}n.a=r}})});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("btppClientConfig",[],n):"object"==typeof exports?exports.btppClientConfig=n():t.btppClientConfig=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s="./src/index.js")}({"./src/config.js":function(t,n,e){"use strict";function r(t,n){return u.a.has(t)?u.a.get(t):n}function o(t,n){if(u.a.set(t,n),a[t])for(var e=a[t],r=Array.isArray(e),o=0,e=r?e:e[Symbol.iterator]();;){var s;if(r){if(o>=e.length)break;s=e[o++]}else{if(o=e.next(),o.done)break;s=o.value}var i=s;i(n)}return n}function s(t,n){return u.a.has(t)?r(t):o(t,n)}function i(t,n){return a[t]=a[t]||[],a[t].push(n),{cancel:function(){a[t].splice(a[t].indexOf(n),1)}}}n.a=r,n.d=o,n.b=s,n.c=i;var u=e("./src/store.js"),a={}},"./src/constants.js":function(t,n,e){"use strict";e.d(n,"a",function(){return r}),e.d(n,"d",function(){return o}),e.d(n,"b",function(){return s}),e.d(n,"c",function(){return i});var r="__braintree_paypal_config__",o={SESSIONSTORAGE:"sessionstorage",GLOBAL:"global"},s={LOGGER_SESSION_ID:"logger_session_id",PAYPAL_FUNDING_DISALLOW:"paypal_funding_disallow"},i={PAYPAL:"paypal",VENMO:"venmo",CREDIT:"credit",CARD:"card",IDEAL:"ideal",ELV:"elv"}},"./src/index.js":function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./src/config.js");e.d(n,"get",function(){return r.a}),e.d(n,"set",function(){return r.d}),e.d(n,"get_or_set",function(){return r.b}),e.d(n,"on",function(){return r.c});var o=e("./src/constants.js");e.d(n,"CONFIG_KEY",function(){return o.a}),e.d(n,"STORE",function(){return o.d}),e.d(n,"KEY",function(){return o.b}),e.d(n,"PAYPAL_FUNDING",function(){return o.c})},"./src/store.js":function(t,n,e){"use strict";function r(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}e.d(n,"a",function(){return a});var o,s=e("./src/constants.js"),i=e("./src/util.js"),u=(o={},r(o,s.d.GLOBAL,{get:function(t){return(window[s.a]||{})[t]},set:function(t,n){var e=window[s.a]||{};return e[t]=n,window[s.a]=e,n},has:function(t){return(window[s.a]||{}).hasOwnProperty(t)}}),r(o,s.d.SESSIONSTORAGE,{get:function(t){var n=window.sessionStorage.getItem(s.a);return n=n?JSON.parse(n):{},n[t]},set:function(t,n){var e=window.sessionStorage.getItem(s.a);return e=e?JSON.parse(e):{},e[t]=n,window.sessionStorage.setItem(s.a,JSON.stringify(e)),n},has:function(t){var n=window.sessionStorage.getItem(s.a);return n=n?JSON.parse(n):{},n.hasOwnProperty(t)}}),o),a=Object(i.a)()?u[s.d.SESSIONSTORAGE]:u[s.d.GLOBAL]},"./src/util.js":function(t,n,e){"use strict";function r(){try{if(window.sessionStorage){var t=Math.random().toString();window.sessionStorage.setItem("__test__sessionStorage__",t);var n=window.sessionStorage.getItem("__test__sessionStorage__");if(window.sessionStorage.removeItem("__test__sessionStorage__"),t===n)return!0}}catch(t){}return!1}n.a=r}})});
//# sourceMappingURL=braintree-paypal-client-config.min.js.map
//# sourceMappingURL=braintree-paypal-client-config.min.js.map
export var CONFIG_KEY = '__braintree_paypal_config__';
export var STORE = {
LOCALSTORAGE: 'localstorage',
SESSIONSTORAGE: 'sessionstorage',
GLOBAL: 'global'

@@ -6,0 +6,0 @@ };

@@ -6,3 +6,3 @@ var _stores;

import { CONFIG_KEY, STORE } from './constants';
import { isLocalStorageEnabled } from './util';
import { isSessionStorageEnabled } from './util';

@@ -24,5 +24,5 @@ var stores = (_stores = {}, _defineProperty(_stores, STORE.GLOBAL, {

}
}), _defineProperty(_stores, STORE.LOCALSTORAGE, {
}), _defineProperty(_stores, STORE.SESSIONSTORAGE, {
get: function get(key) {
var storage = localStorage.getItem(CONFIG_KEY);
var storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};

@@ -32,10 +32,10 @@ return storage[key];

set: function set(key, value) {
var storage = localStorage.getItem(CONFIG_KEY);
var storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};
storage[key] = value;
localStorage.setItem(CONFIG_KEY, JSON.stringify(storage));
window.sessionStorage.setItem(CONFIG_KEY, JSON.stringify(storage));
return value;
},
has: function has(key) {
var storage = localStorage.getItem(CONFIG_KEY);
var storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};

@@ -46,3 +46,3 @@ return storage.hasOwnProperty(key);

export var store = isLocalStorageEnabled() ? stores[STORE.LOCALSTORAGE] : stores[STORE.GLOBAL];
export var store = isSessionStorageEnabled() ? stores[STORE.SESSIONSTORAGE] : stores[STORE.GLOBAL];

@@ -49,0 +49,0 @@ export function use(storeType) {

@@ -1,8 +0,8 @@

export function isLocalStorageEnabled() {
export function isSessionStorageEnabled() {
try {
if (window.localStorage) {
if (window.sessionStorage) {
var value = Math.random().toString();
window.localStorage.setItem('__test__localStorage__', value);
var result = window.localStorage.getItem('__test__localStorage__');
window.localStorage.removeItem('__test__localStorage__');
window.sessionStorage.setItem('__test__sessionStorage__', value);
var result = window.sessionStorage.getItem('__test__sessionStorage__');
window.sessionStorage.removeItem('__test__sessionStorage__');
if (value === result) {

@@ -9,0 +9,0 @@ return true;

{
"name": "braintree-paypal-client-config",
"version": "1.0.1",
"version": "1.0.2",
"description": "Shared config between PayPal/Braintree.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,4 +6,4 @@ /* @flow */

export const STORE = {
LOCALSTORAGE: 'localstorage',
GLOBAL: 'global'
SESSIONSTORAGE: 'sessionstorage',
GLOBAL: 'global'
};

@@ -10,0 +10,0 @@

/* @flow */
import { CONFIG_KEY, STORE } from './constants';
import { isLocalStorageEnabled } from './util';
import { isSessionStorageEnabled } from './util';

@@ -25,5 +25,5 @@ let stores = {

[ STORE.LOCALSTORAGE ]: {
[ STORE.SESSIONSTORAGE ]: {
get<T>(key : string) : T {
let storage = localStorage.getItem(CONFIG_KEY);
let storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};

@@ -33,10 +33,10 @@ return storage[key];

set<T>(key : string, value : T) : T {
let storage = localStorage.getItem(CONFIG_KEY);
let storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};
storage[key] = value;
localStorage.setItem(CONFIG_KEY, JSON.stringify(storage));
window.sessionStorage.setItem(CONFIG_KEY, JSON.stringify(storage));
return value;
},
has(key : string) : boolean {
let storage = localStorage.getItem(CONFIG_KEY);
let storage = window.sessionStorage.getItem(CONFIG_KEY);
storage = storage ? JSON.parse(storage) : {};

@@ -48,4 +48,4 @@ return storage.hasOwnProperty(key);

export let store = isLocalStorageEnabled()
? stores[STORE.LOCALSTORAGE]
export let store = isSessionStorageEnabled()
? stores[STORE.SESSIONSTORAGE]
: stores[STORE.GLOBAL];

@@ -52,0 +52,0 @@

/* @flow */
export function isLocalStorageEnabled() : boolean {
export function isSessionStorageEnabled() : boolean {
try {
if (window.localStorage) {
if (window.sessionStorage) {
let value = Math.random().toString();
window.localStorage.setItem('__test__localStorage__', value);
let result = window.localStorage.getItem('__test__localStorage__');
window.localStorage.removeItem('__test__localStorage__');
window.sessionStorage.setItem('__test__sessionStorage__', value);
let result = window.sessionStorage.getItem('__test__sessionStorage__');
window.sessionStorage.removeItem('__test__sessionStorage__');
if (value === result) {

@@ -11,0 +11,0 @@ return true;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc