@goodhood/chargebee
Advanced tools
Comparing version
@@ -11,2 +11,6 @@ import _extends from '@babel/runtime/helpers/extends'; | ||
const invoke = (fn, ...args) => { | ||
if (typeof fn === 'function') return fn(...args); | ||
}; | ||
const Action = (_ref) => { | ||
@@ -44,4 +48,4 @@ let { | ||
const handleClick = event => { | ||
if (onClick) onClick(event); | ||
if (onCall) onCall(instanceRef.current, global.Chargebee); | ||
invoke(onClick, event); | ||
invoke(onCall, instanceRef.current, global.Chargebee); | ||
}; | ||
@@ -60,2 +64,3 @@ | ||
// Portal sections full list https://www.chargebee.com/checkout-portal-docs/api.html#getportalsections | ||
const SECTION_INVOICES = 'BILLING_HISTORY'; | ||
@@ -74,3 +79,8 @@ const SECTION_EDIT_SUBSCRIPTION = 'EDIT_SUBSCRIPTION'; | ||
const handleOpenLink = (instance, Chargebee) => { | ||
const sectionType = Chargebee.getPortalSections()[section]; | ||
const forwardOptions = {}; | ||
if (section) { | ||
forwardOptions.sectionType = Chargebee.getPortalSections()[section]; | ||
} | ||
instance.setPortalSession(() => onSessionGet()); | ||
@@ -80,5 +90,3 @@ const portal = instance.createChargebeePortal(); | ||
close: onClose | ||
}, { | ||
sectionType | ||
}); | ||
}, forwardOptions); | ||
}; | ||
@@ -109,4 +117,4 @@ | ||
close: () => { | ||
if (onClose) onClose(); | ||
if (isSuccess && onSuccess) onSuccess(); | ||
invoke(onClose); | ||
if (isSuccess) invoke(onSuccess); | ||
} | ||
@@ -113,0 +121,0 @@ }); |
@@ -22,2 +22,6 @@ 'use strict'; | ||
const invoke = (fn, ...args) => { | ||
if (typeof fn === 'function') return fn(...args); | ||
}; | ||
const Action = (_ref) => { | ||
@@ -55,4 +59,4 @@ let { | ||
const handleClick = event => { | ||
if (onClick) onClick(event); | ||
if (onCall) onCall(instanceRef.current, global.Chargebee); | ||
invoke(onClick, event); | ||
invoke(onCall, instanceRef.current, global.Chargebee); | ||
}; | ||
@@ -71,2 +75,3 @@ | ||
// Portal sections full list https://www.chargebee.com/checkout-portal-docs/api.html#getportalsections | ||
const SECTION_INVOICES = 'BILLING_HISTORY'; | ||
@@ -85,3 +90,8 @@ const SECTION_EDIT_SUBSCRIPTION = 'EDIT_SUBSCRIPTION'; | ||
const handleOpenLink = (instance, Chargebee) => { | ||
const sectionType = Chargebee.getPortalSections()[section]; | ||
const forwardOptions = {}; | ||
if (section) { | ||
forwardOptions.sectionType = Chargebee.getPortalSections()[section]; | ||
} | ||
instance.setPortalSession(() => onSessionGet()); | ||
@@ -91,5 +101,3 @@ const portal = instance.createChargebeePortal(); | ||
close: onClose | ||
}, { | ||
sectionType | ||
}); | ||
}, forwardOptions); | ||
}; | ||
@@ -120,4 +128,4 @@ | ||
close: () => { | ||
if (onClose) onClose(); | ||
if (isSuccess && onSuccess) onSuccess(); | ||
invoke(onClose); | ||
if (isSuccess) invoke(onSuccess); | ||
} | ||
@@ -124,0 +132,0 @@ }); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"module": "lib/index.esm.js", | ||
@@ -17,0 +17,0 @@ "main": "lib/index.js", |
@@ -44,3 +44,3 @@ # `@goodhood/chargebee` | ||
{/* Will be called on element click. Receives chargebee instance as an argument */} | ||
onCall={(chargebeeInstance, ChargebeeGlobalObject) => {}} | ||
onCall={(chargebeeInstance, ChargebeeAPI) => {}} | ||
/> | ||
@@ -47,0 +47,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24898
5.8%220
4.76%