@@ -5,7 +5,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
55var _slicedToArray = _interopDefault ( require ( 'babel-runtime/helpers/slicedToArray' ) ) ;
66var _Object$assign = _interopDefault ( require ( 'babel-runtime/core-js/object/assign' ) ) ;
77var paypal = _interopDefault ( require ( 'paypal-checkout' ) ) ;
8- require ( 'babel-runtime/core-js/json/stringify' ) ;
98var _Object$keys = _interopDefault ( require ( 'babel-runtime/core-js/object/keys' ) ) ;
109
1110var requiredProps = [ [ 'amount' ] , [ 'currency' , 'USD' ] ] ;
@@ -157,7 +156,7 @@ function assignToPropertyObject(props) {
157156 } ;
158157}
159158
160- // TODO: add item validator thanks
159+ // TODO: add item validator
161160var itemsPayPalProp = new paypalProp ( {
162161 name : 'items' ,
163162 paypalName : 'item_list' ,
@@ -169,6 +168,13 @@ itemsPayPalProp.addChangeTransform(function (items) {
169168 return { items : items } ;
170169} ) ;
171170
171+ var shippingAddressProp = new paypalProp ( {
172+ name : 'shippingAddress' ,
173+ paypalName : 'shipping_address' ,
174+ type : Object ,
175+ injection : propTypes . TRANSACTION
176+ } ) ;
177+
172178var props = [
173179// Button Props
174180new paypalProp ( { name : 'buttonStyle' , paypalName : 'style' , injection : propTypes . BUTTON } ) , new paypalProp ( { name : 'braintree' , injection : propTypes . BUTTON } ) , new paypalProp ( { name : 'locale' , type : String , injection : propTypes . BUTTON } ) ,
@@ -191,7 +197,7 @@ new paypalProp({
191197 ) ;
192198 } ,
193199 injection : propTypes . TRANSACTION
194- } ) , itemsPayPalProp ] ;
200+ } ) , itemsPayPalProp , shippingAddressProp ] ;
195201
196202function vmProps ( ) {
197203 var vm = { } ;
@@ -230,6 +236,12 @@ var script = {
230236 }
231237 } , assignTo ( vue , propTypes . TRANSACTION ) ) ;
232238
239+ // TODO: clean this up
240+ if ( transaction . shipping_address && transaction . item_list ) {
241+ transaction . item_list . shipping_address = transaction . shipping_address ;
242+ delete transaction . shipping_address ;
243+ }
244+
233245 var payment = {
234246 transactions : [ transaction ]
235247 } ;
@@ -281,6 +293,7 @@ var script = {
281293 }
282294} ;
283295
296+ /* script */
284297var __vue_script__ = script ;
285298
286299/* template */
@@ -293,7 +306,6 @@ var __vue_render__ = function __vue_render__() {
293306var __vue_staticRenderFns__ = [ ] ;
294307__vue_render__ . _withStripped = true ;
295308
296- var __vue_template__ = typeof __vue_render__ !== 'undefined' ? { render : __vue_render__ , staticRenderFns : __vue_staticRenderFns__ } : { } ;
297309/* style */
298310var __vue_inject_styles__ = undefined ;
299311/* scoped */
@@ -306,9 +318,8 @@ var __vue_is_functional_template__ = false;
306318function __vue_normalize__ ( template , style , script$$1 , scope , functional , moduleIdentifier , createInjector , createInjectorSSR ) {
307319 var component = ( typeof script$$1 === 'function' ? script$$1 . options : script$$1 ) || { } ;
308320
309- {
310- component . __file = "/home/khoa/Code/paypal/src/components/PayPalCheckout.vue" ;
311- }
321+ // For security concerns, we use only base name in production mode.
322+ component . __file = "/home/khoa/src/github.com/khoanguyen96/paypal/src/components/PayPalCheckout.vue" ;
312323
313324 if ( ! component . render ) {
314325 component . render = template . render ;
@@ -323,60 +334,10 @@ function __vue_normalize__(template, style, script$$1, scope, functional, module
323334 return component ;
324335}
325336/* style inject */
326- function __vue_create_injector__ ( ) {
327- var head = document . head || document . getElementsByTagName ( 'head' ) [ 0 ] ;
328- var styles = __vue_create_injector__ . styles || ( __vue_create_injector__ . styles = { } ) ;
329- var isOldIE = typeof navigator !== 'undefined' && / m s i e [ 6 - 9 ] \\ b / . test ( navigator . userAgent . toLowerCase ( ) ) ;
330-
331- return function addStyle ( id , css ) {
332- if ( document . querySelector ( 'style[data-vue-ssr-id~="' + id + '"]' ) ) return ; // SSR styles are present.
333-
334- var group = isOldIE ? css . media || 'default' : id ;
335- var style = styles [ group ] || ( styles [ group ] = { ids : [ ] , parts : [ ] , element : undefined } ) ;
336-
337- if ( ! style . ids . includes ( id ) ) {
338- var code = css . source ;
339- var index = style . ids . length ;
340-
341- style . ids . push ( id ) ;
342-
343- if ( isOldIE ) {
344- style . element = style . element || document . querySelector ( 'style[data-group=' + group + ']' ) ;
345- }
346-
347- if ( ! style . element ) {
348- var el = style . element = document . createElement ( 'style' ) ;
349- el . type = 'text/css' ;
350-
351- if ( css . media ) el . setAttribute ( 'media' , css . media ) ;
352- if ( isOldIE ) {
353- el . setAttribute ( 'data-group' , group ) ;
354- el . setAttribute ( 'data-next-index' , '0' ) ;
355- }
356-
357- head . appendChild ( el ) ;
358- }
359337
360- if ( isOldIE ) {
361- index = parseInt ( style . element . getAttribute ( 'data-next-index' ) ) ;
362- style . element . setAttribute ( 'data-next-index' , index + 1 ) ;
363- }
364-
365- if ( style . element . styleSheet ) {
366- style . parts . push ( code ) ;
367- style . element . styleSheet . cssText = style . parts . filter ( Boolean ) . join ( '\n' ) ;
368- } else {
369- var textNode = document . createTextNode ( code ) ;
370- var nodes = style . element . childNodes ;
371- if ( nodes [ index ] ) style . element . removeChild ( nodes [ index ] ) ;
372- if ( nodes . length ) style . element . insertBefore ( textNode , nodes [ index ] ) ; else style . element . appendChild ( textNode ) ;
373- }
374- }
375- } ;
376- }
377338/* style inject SSR */
378339
379- var PayPalCheckout = __vue_normalize__ ( __vue_template__ , __vue_inject_styles__ , typeof __vue_script__ === 'undefined' ? { } : __vue_script__ , __vue_scope_id__ , __vue_is_functional_template__ , __vue_module_identifier__ , typeof __vue_create_injector__ !== ' undefined' ? __vue_create_injector__ : function ( ) { } , typeof __vue_create_injector_ssr__ !== ' undefined' ? __vue_create_injector_ssr__ : function ( ) { } ) ;
340+ var PayPalCheckout = __vue_normalize__ ( { render : __vue_render__ , staticRenderFns : __vue_staticRenderFns__ } , __vue_inject_styles__ , __vue_script__ , __vue_scope_id__ , __vue_is_functional_template__ , __vue_module_identifier__ , undefined , undefined ) ;
380341
381342var components = {
382343 'paypal-checkout' : PayPalCheckout
0 commit comments