@goodhood/chargebee
Advanced tools
Comparing version
@@ -70,5 +70,5 @@ import { useEffect, useRef, useState } from 'react'; | ||
node = /*#__PURE__*/jsx("span", { | ||
...rest, | ||
role: "button", | ||
tabIndex: 0, | ||
...rest, | ||
onClick: handleClick | ||
@@ -75,0 +75,0 @@ }); |
@@ -78,5 +78,5 @@ 'use strict'; | ||
node = /*#__PURE__*/jsxRuntime.jsx("span", { | ||
...rest, | ||
role: "button", | ||
tabIndex: 0, | ||
...rest, | ||
onClick: handleClick | ||
@@ -83,0 +83,0 @@ }); |
import React from 'react'; | ||
import { OnCallHandler } from '../types'; | ||
type ActionProps = { | ||
export type ActionProps = { | ||
site: string; | ||
onCall: OnCallHandler; | ||
disabled?: boolean; | ||
onClick?: React.MouseEventHandler; | ||
} & Record<string, unknown>; | ||
} & React.ComponentPropsWithoutRef<'span'>; | ||
declare const Action: ({ disabled, onClick, onCall, site, ...rest }: ActionProps) => JSX.Element; | ||
export default Action; |
/// <reference types="react" /> | ||
import { ActionProps } from '../action'; | ||
import { OpenCheckoutOptions, VoidFunction, HostedPage } from '../types'; | ||
type CheckoutProps = { | ||
site: string; | ||
type CheckoutProps = Omit<ActionProps, 'onCall'> & { | ||
onHostedPageGet: () => HostedPage; | ||
onLoaded?: OpenCheckoutOptions['loaded']; | ||
onStep?: OpenCheckoutOptions['step']; | ||
onSuccess?: VoidFunction; | ||
onClose?: VoidFunction; | ||
onSuccess?: VoidFunction; | ||
onError?: VoidFunction; | ||
} & Record<string, unknown>; | ||
}; | ||
declare const Checkout: ({ onHostedPageGet, onSuccess, onLoaded, onClose, onError, onStep, ...rest }: CheckoutProps) => JSX.Element; | ||
export default Checkout; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { PortalSessionSetter } from '../types'; | ||
type PortalLinkProps = { | ||
site: string; | ||
onSessionGet: PortalSessionSetter; | ||
onClose?: () => void; | ||
section?: string; | ||
} & Record<string, unknown>; | ||
import { PortalSectionsKeys, GetPortalSessionFunction, VoidFunction } from '../types'; | ||
import { ActionProps } from '../action'; | ||
type PortalLinkProps = Omit<ActionProps, 'onCall'> & { | ||
onSessionGet: GetPortalSessionFunction; | ||
section?: PortalSectionsKeys; | ||
onClose?: VoidFunction; | ||
}; | ||
declare const PortalLink: { | ||
({ section, onSessionGet, onClose, ...rest }: PortalLinkProps): JSX.Element; | ||
propTypes: { | ||
section: PropTypes.Requireable<{ | ||
readonly SECTION_INVOICES: "BILLING_HISTORY"; | ||
readonly SECTION_BILLING_ADDRESS: "EDIT_BILLING_ADDRESS"; | ||
readonly SECTION_ADD_PAYMENT: "ADD_PAYMENT_SOURCE"; | ||
readonly SECTION_EDIT_PAYMENT: "EDIT_PAYMENT_SOURCE"; | ||
readonly SECTION_VIEW_PAYMENT: "VIEW_PAYMENT_SOURCE"; | ||
}>; | ||
section: PropTypes.Requireable<"BILLING_HISTORY" | "EDIT_BILLING_ADDRESS" | "ADD_PAYMENT_SOURCE" | "EDIT_PAYMENT_SOURCE" | "VIEW_PAYMENT_SOURCE">; | ||
onSessionGet: PropTypes.Validator<(...args: any[]) => any>; | ||
@@ -21,0 +15,0 @@ onClose: PropTypes.Requireable<(...args: any[]) => any>; |
export type VoidFunction = () => void; | ||
type HostedPageId = Nominal<string, 'HostedPageId'>; | ||
export type HostedPageId = Nominal<string, 'HostedPageId'>; | ||
type HostedPageType = 'checkout_new' | 'checkout_existing' | 'update_payment_method' | 'manage_payment_sources' | 'collect_now' | 'extend_subscription' | 'checkout_one_time' | 'pre_cancel' | 'checkout_gift' | 'claim_gift' | 'agreement_pfd'; | ||
@@ -25,3 +25,3 @@ type HostedPageState = 'created' | 'requested' | 'succeeded' | 'cancelled' | 'acknowledged'; | ||
layout?: OpenCheckoutLayout; | ||
step?: (currentStep: string) => void; | ||
step?: (currentCheckoutStep: string) => void; | ||
}; | ||
@@ -34,8 +34,8 @@ type ChargebeePortalOptions = { | ||
loaded?: VoidFunction; | ||
visit?: (sectionType: string) => void; | ||
visit?: (sectionType: PortalSectionTypes) => void; | ||
}; | ||
type SubscriptionId = Nominal<string, 'SubscriptionId'>; | ||
type PaymentSourceId = Nominal<string, 'PaymentSourceId'>; | ||
export type SubscriptionId = Nominal<string, 'SubscriptionId'>; | ||
export type PaymentSourceId = Nominal<string, 'PaymentSourceId'>; | ||
export type ChargebeeForwardOptions = { | ||
sectionType: string; | ||
sectionType: PortalSectionTypes; | ||
params?: { | ||
@@ -49,5 +49,5 @@ subscriptionId: SubscriptionId; | ||
}; | ||
type CustomerId = Nominal<string, 'CustomerId'>; | ||
type PortalSessionId = Nominal<string, 'PortalSessionId'>; | ||
type PortalSessionToken = Nominal<string, 'PortalSessionToken'>; | ||
export type CustomerId = Nominal<string, 'CustomerId'>; | ||
export type PortalSessionId = Nominal<string, 'PortalSessionId'>; | ||
export type PortalSessionToken = Nominal<string, 'PortalSessionToken'>; | ||
type PortalSessionStatus = 'created' | 'logged_in' | 'logged_out' | 'not_yet_activated' | 'activated'; | ||
@@ -64,7 +64,7 @@ type PortalSession = { | ||
}; | ||
export type PortalSessionSetter = () => Promise<PortalSession>; | ||
export type GetPortalSessionFunction = () => Promise<PortalSession>; | ||
export type OnCallHandler = (instance: ChargebeeInstance, chargebee?: Chargebee) => void; | ||
export type ChargebeeInstance = { | ||
createChargebeePortal: () => ChargebeePortal; | ||
setPortalSession: (callback: PortalSessionSetter) => void; | ||
setPortalSession: (callback: GetPortalSessionFunction) => void; | ||
openCheckout: (options: OpenCheckoutOptions) => void; | ||
@@ -74,3 +74,3 @@ logout: () => void; | ||
}; | ||
type BusinessEntityId = Nominal<string, 'BusinessEntityId'>; | ||
export type BusinessEntityId = Nominal<string, 'BusinessEntityId'>; | ||
type ChargebeeInitOptions = { | ||
@@ -90,6 +90,26 @@ site: string; | ||
}; | ||
declare const PortalSections: { | ||
readonly SUBSCRIPTION_DETAILS: "sub_details"; | ||
readonly SUBSCRIPTION_CANCELLATION: "sub_cancel"; | ||
readonly EDIT_SUBSCRIPTION: "edit_subscription"; | ||
readonly VIEW_SCHEDULED_CHANGES: "scheduled_changes"; | ||
readonly ACCOUNT_DETAILS: "account_details"; | ||
readonly EDIT_ACCOUNT_DETAILS: "portal_edit_account"; | ||
readonly ADDRESS: "portal_address"; | ||
readonly EDIT_BILLING_ADDRESS: "portal_edit_billing_address"; | ||
readonly EDIT_SHIPPING_ADDRESS: "portal_edit_shipping_address"; | ||
readonly EDIT_SUBSCRIPTION_CUSTOM_FIELDS: "portal_edit_subscription_cf"; | ||
readonly PAYMENT_SOURCES: "portal_payment_methods"; | ||
readonly ADD_PAYMENT_SOURCE: "portal_add_payment_method"; | ||
readonly EDIT_PAYMENT_SOURCE: "portal_edit_payment_method"; | ||
readonly VIEW_PAYMENT_SOURCE: "portal_view_payment_method"; | ||
readonly CHOOSE_PAYMENT_METHOD_FOR_SUBSCRIPTION: "portal_choose_payment_method"; | ||
readonly BILLING_HISTORY: "portal_billing_history"; | ||
}; | ||
export type PortalSectionsKeys = keyof typeof PortalSections; | ||
export type PortalSectionTypes = typeof PortalSections[PortalSectionsKeys]; | ||
type Chargebee = { | ||
init: (options: ChargebeeInitOptions) => ChargebeeInstance; | ||
getInstance: () => ChargebeeInstance; | ||
getPortalSections: () => Record<string, string>; | ||
getPortalSections: () => typeof PortalSections; | ||
}; | ||
@@ -96,0 +116,0 @@ declare global { |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "1.6.0-alpha.0", | ||
"version": "1.6.0", | ||
"module": "lib/index.esm.js", | ||
@@ -32,4 +32,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"react-load-script": "0.0.6", | ||
"prop-types": "^15.7.2" | ||
"react-load-script": "0.0.6" | ||
}, | ||
@@ -36,0 +35,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
40356
3.17%1
-50%455
2.94%0
-100%0
-100%