hono-stripe-elements 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # hono-stripe-elements
2
2
 
3
3
  [hono/jsx](https://hono.dev/docs/guides/jsx) components that wrap the [`stripe-pwa-elements`](https://github.com/hideokamoto/stripe-pwa-elements) Web Components.
4
- Use Stripe Card, Payment, Express Checkout, Address, Link Authentication and Currency Selector elements from Hono, HonoX islands and any other hono/jsx app.
4
+ Use Stripe Card, Payment, Express Checkout, Address, Link Authentication, Currency Selector and Payment Sheet elements from Hono, HonoX islands and any other hono/jsx app.
5
5
 
6
6
  ## Installation
7
7
 
@@ -40,6 +40,7 @@ export default function Checkout({ clientSecret }: { clientSecret: string }) {
40
40
  | `StripeAddressElement` | `<stripe-address-element>` |
41
41
  | `StripeLinkAuthenticationElement` | `<stripe-link-authentication-element>` |
42
42
  | `StripeCurrencySelector` | `<stripe-currency-selector>` |
43
+ | `StripePaymentSheet` | `<stripe-payment-sheet>` |
43
44
 
44
45
  Each component accepts the props of the underlying Web Component. See the [stripe-pwa-elements documentation](https://github.com/hideokamoto/stripe-pwa-elements#readme) for the full list.
45
46
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { PaymentIntentResult, SetupIntentResult, Stripe, StripeAddressElementChangeEvent, StripeCardCvcElement, StripeCardExpiryElement, StripeCardNumberElement, StripeCheckoutConfirmResult, StripeCheckoutElementsSdk, StripeElements, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent, StripeLinkAuthenticationElement as StripeLinkAuthElement } from '@stripe/stripe-js';
1
+ import type { PaymentSheetOptions, PaymentSheetPresentResult } from 'stripe-pwa-elements';
2
+ import type { Appearance, PaymentIntentResult, SetupIntentResult, Stripe, StripeAddressElementChangeEvent, StripeCardCvcElement, StripeCardExpiryElement, StripeCardNumberElement, StripeCheckoutConfirmResult, StripeCheckoutElementsSdk, StripeElements, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent, StripeLinkAuthenticationElement as StripeLinkAuthElement } from '@stripe/stripe-js';
2
3
  export type IntentType = 'setup' | 'payment';
3
4
  export type StripeLoadedEvent = {
4
5
  stripe: Stripe;
@@ -20,6 +21,7 @@ export type PaymentElementSubmitEvent = {
20
21
  checkoutSessionClientSecret?: string;
21
22
  };
22
23
  export type CheckoutSessionFormSubmitResult = StripeCheckoutConfirmResult | Error;
24
+ export type { PaymentSheetOptions, PaymentSheetPresentResult };
23
25
  export type AddressSubmitEvent = {
24
26
  address: {
25
27
  value: StripeAddressElementChangeEvent['value'];
@@ -66,7 +68,10 @@ type StripeCommonProps = {
66
68
  publishableKey?: string;
67
69
  stripeAccount?: string;
68
70
  };
69
- export type StripeCardElementProps = StripeElementBaseProps & StripeCommonProps & {
71
+ type StripeLoadFailedProps = {
72
+ onStripeLoadFailed?: (event: CustomEvent<unknown>) => void;
73
+ };
74
+ export type StripeCardElementProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
70
75
  intentClientSecret?: string;
71
76
  intentType?: IntentType;
72
77
  buttonLabel?: string;
@@ -74,7 +79,6 @@ export type StripeCardElementProps = StripeElementBaseProps & StripeCommonProps
74
79
  zip?: boolean;
75
80
  showLabel?: boolean;
76
81
  applicationName?: string;
77
- showPaymentRequestButton?: boolean;
78
82
  shouldUseDefaultFormSubmitAction?: boolean;
79
83
  handleSubmit?: (event: Event, props: FormSubmitEvent) => Promise<void>;
80
84
  stripeDidLoaded?: (event: StripeLoadedEvent) => Promise<void>;
@@ -82,9 +86,15 @@ export type StripeCardElementProps = StripeElementBaseProps & StripeCommonProps
82
86
  onFormSubmit?: (event: CustomEvent<FormSubmitEvent>) => void;
83
87
  onDefaultFormSubmitResult?: (event: CustomEvent<DefaultFormSubmitResult>) => void;
84
88
  };
85
- export type StripePaymentElementProps = StripeElementBaseProps & StripeCommonProps & {
89
+ export type StripePaymentElementProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
86
90
  intentClientSecret?: string;
87
91
  checkoutSessionClientSecret?: string;
92
+ checkoutSessionReturnUrl?: string;
93
+ checkoutSessionEmail?: string;
94
+ returnUrl?: string;
95
+ elementsGroup?: string;
96
+ appearance?: Appearance;
97
+ customerSessionClientSecret?: string;
88
98
  intentType?: IntentType;
89
99
  buttonLabel?: string;
90
100
  sheetTitle?: string;
@@ -97,8 +107,9 @@ export type StripePaymentElementProps = StripeElementBaseProps & StripeCommonPro
97
107
  onDefaultFormSubmitResult?: (event: CustomEvent<DefaultFormSubmitResult>) => void;
98
108
  onCheckoutSessionConfirmResult?: (event: CustomEvent<CheckoutSessionFormSubmitResult>) => void;
99
109
  };
100
- export type StripeExpressCheckoutElementProps = StripeElementBaseProps & StripeCommonProps & {
110
+ export type StripeExpressCheckoutElementProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
101
111
  clientSecret?: string;
112
+ intentClientSecret?: string;
102
113
  intentType?: IntentType;
103
114
  amount?: number;
104
115
  currency?: string;
@@ -109,7 +120,7 @@ export type StripeExpressCheckoutElementProps = StripeElementBaseProps & StripeC
109
120
  onCancel?: (event: CustomEvent<void>) => void;
110
121
  onDefaultConfirmResult?: (event: CustomEvent<DefaultFormSubmitResult>) => void;
111
122
  };
112
- export type StripeAddressElementProps = StripeElementBaseProps & StripeCommonProps & {
123
+ export type StripeAddressElementProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
113
124
  mode?: 'shipping' | 'billing';
114
125
  defaultCountry?: string;
115
126
  allowedCountries?: string[];
@@ -122,7 +133,7 @@ export type StripeAddressElementProps = StripeElementBaseProps & StripeCommonPro
122
133
  onStripeLoaded?: (event: CustomEvent<StripeLoadedEvent>) => void;
123
134
  onFormSubmit?: (event: CustomEvent<AddressSubmitEvent>) => void;
124
135
  };
125
- export type StripeLinkAuthenticationElementProps = StripeElementBaseProps & StripeCommonProps & {
136
+ export type StripeLinkAuthenticationElementProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
126
137
  defaultEmail?: string;
127
138
  showLabel?: boolean;
128
139
  applicationName?: string;
@@ -131,8 +142,9 @@ export type StripeLinkAuthenticationElementProps = StripeElementBaseProps & Stri
131
142
  onStripeLoaded?: (event: CustomEvent<StripeLoadedEvent>) => void;
132
143
  onLinkAuthenticationChange?: (event: CustomEvent<LinkAuthenticationElementChangeEvent>) => void;
133
144
  };
134
- export type StripeCurrencySelectorProps = StripeElementBaseProps & StripeCommonProps & {
145
+ export type StripeCurrencySelectorProps = StripeElementBaseProps & StripeCommonProps & StripeLoadFailedProps & {
135
146
  clientSecret?: string;
147
+ checkoutSessionClientSecret?: string;
136
148
  showLabel?: boolean;
137
149
  applicationName?: string;
138
150
  currencyChangeHandler?: (props: CurrencySelectorChangeEvent) => Promise<void>;
@@ -140,10 +152,24 @@ export type StripeCurrencySelectorProps = StripeElementBaseProps & StripeCommonP
140
152
  onStripeLoaded?: (event: CustomEvent<StripeLoadedEvent>) => void;
141
153
  onCurrencyChange?: (event: CustomEvent<CurrencySelectorChangeEvent>) => void;
142
154
  };
155
+ export type StripePaymentSheetProps = StripeElementBaseProps & StripeCommonProps & {
156
+ intentClientSecret?: string;
157
+ checkoutSessionClientSecret?: string;
158
+ open?: boolean;
159
+ sheetTitle?: string;
160
+ buttonLabel?: string;
161
+ applicationName?: string;
162
+ options?: PaymentSheetOptions;
163
+ onPaymentSheetLoaded?: (event: CustomEvent<StripeLoadedEvent>) => void;
164
+ onPaymentSheetFailedToLoad?: (event: CustomEvent<unknown>) => void;
165
+ onPaymentSheetCompleted?: (event: CustomEvent<unknown>) => void;
166
+ onPaymentSheetCanceled?: (event: CustomEvent<void>) => void;
167
+ onPaymentSheetFailed?: (event: CustomEvent<unknown>) => void;
168
+ };
143
169
  export declare const StripeCardElement: (props: StripeCardElementProps) => import("hono/jsx").JSXNode;
144
170
  export declare const StripePaymentElement: (props: StripePaymentElementProps) => import("hono/jsx").JSXNode;
145
171
  export declare const StripeExpressCheckoutElement: (props: StripeExpressCheckoutElementProps) => import("hono/jsx").JSXNode;
146
172
  export declare const StripeAddressElement: (props: StripeAddressElementProps) => import("hono/jsx").JSXNode;
147
173
  export declare const StripeLinkAuthenticationElement: (props: StripeLinkAuthenticationElementProps) => import("hono/jsx").JSXNode;
148
174
  export declare const StripeCurrencySelector: (props: StripeCurrencySelectorProps) => import("hono/jsx").JSXNode;
149
- export {};
175
+ export declare const StripePaymentSheet: (props: StripePaymentSheetProps) => import("hono/jsx").JSXNode;
package/dist/index.js CHANGED
@@ -80,3 +80,4 @@ export const StripeExpressCheckoutElement = createStripeElementComponent('stripe
80
80
  export const StripeAddressElement = createStripeElementComponent('stripe-address-element', () => import('stripe-pwa-elements/dist/components/stripe-address-element'));
81
81
  export const StripeLinkAuthenticationElement = createStripeElementComponent('stripe-link-authentication-element', () => import('stripe-pwa-elements/dist/components/stripe-link-authentication-element'));
82
82
  export const StripeCurrencySelector = createStripeElementComponent('stripe-currency-selector', () => import('stripe-pwa-elements/dist/components/stripe-currency-selector'));
83
+ export const StripePaymentSheet = createStripeElementComponent('stripe-payment-sheet', () => import('stripe-pwa-elements/dist/components/stripe-payment-sheet'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono-stripe-elements",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "hono/jsx components wrapping stripe-pwa-elements Web Components",
5
5
  "author": {
6
6
  "name": "Hidetaka Okamoto",
@@ -20,7 +20,7 @@
20
20
  "@stripe/stripe-js": "^9.17.0",
21
21
  "hono": "^4.13.13",
22
22
  "typescript": "^5.9.3",
23
- "stripe-pwa-elements": "4.1.4"
23
+ "stripe-pwa-elements": "5.1.0"
24
24
  },
25
25
  "keywords": [
26
26
  "hono",