@funnelfox/billing 0.9.3-ffb-apple-pay-continue-button.33 → 0.10.0
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 +4 -0
- package/dist/chunk-index.cjs.js +109 -159
- package/dist/chunk-index.cjs3.js +1 -1
- package/dist/chunk-index.es.js +108 -160
- package/dist/chunk-index.es3.js +1 -1
- package/dist/chunk-stripe-card-form.cjs.js +5 -5
- package/dist/chunk-stripe-card-form.es.js +5 -5
- package/dist/chunk-stripe-wallet.cjs.js +9 -2
- package/dist/chunk-stripe-wallet.es.js +9 -2
- package/dist/funnelfox-billing.js +120 -165
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +33 -42
package/src/types.d.ts
CHANGED
|
@@ -74,40 +74,10 @@ export interface BillingCardOptions extends CheckoutCardOptions {
|
|
|
74
74
|
emailAddress?: BillingCardEmailAddressOptions;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
/**
|
|
78
|
-
* Apple Pay button types (https://developer.apple.com/documentation/applepayontheweb/applepaybuttontype).
|
|
79
|
-
*
|
|
80
|
-
* The legacy 7 values (Primer's union) render through Primer's CSS approach.
|
|
81
|
-
* The newer values (e.g. 'continue') cannot be rendered by WebKit via CSS, so
|
|
82
|
-
* the SDK overlays Apple's official <apple-pay-button> element on top of the
|
|
83
|
-
* Primer button and forwards clicks (see utils/apple-pay-native-button.ts,
|
|
84
|
-
* PRD-1426). Payment flow stays fully Primer-driven either way.
|
|
85
|
-
*/
|
|
86
|
-
export type ApplePayButtonType =
|
|
87
|
-
| NonNullable<ApplePayOptions['buttonType']>
|
|
88
|
-
| 'add-money'
|
|
89
|
-
| 'continue'
|
|
90
|
-
| 'contribute'
|
|
91
|
-
| 'order'
|
|
92
|
-
| 'pay'
|
|
93
|
-
| 'reload'
|
|
94
|
-
| 'rent'
|
|
95
|
-
| 'support'
|
|
96
|
-
| 'tip'
|
|
97
|
-
| 'top-up';
|
|
98
|
-
|
|
99
|
-
export type BillingApplePayOptions = Omit<
|
|
100
|
-
ApplePayOptions,
|
|
101
|
-
'container' | 'buttonType'
|
|
102
|
-
> & {
|
|
103
|
-
buttonType?: ApplePayButtonType;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
77
|
export interface PrimerCheckoutConfig extends Pick<
|
|
107
78
|
Partial<HeadlessUniversalCheckoutOptions>,
|
|
108
|
-
'paypal' | 'googlePay' | 'style'
|
|
79
|
+
'paypal' | 'applePay' | 'googlePay' | 'style'
|
|
109
80
|
> {
|
|
110
|
-
applePay?: BillingApplePayOptions;
|
|
111
81
|
card?: BillingCardOptions;
|
|
112
82
|
cardSelectors?: CardInputSelectors;
|
|
113
83
|
paymentButtonSelectors?: PaymentButtonSelectors;
|
|
@@ -123,27 +93,27 @@ export interface CheckoutConfig extends PrimerCheckoutConfig {
|
|
|
123
93
|
enableTax?: boolean;
|
|
124
94
|
onTaxChange?: (info: TaxInfo) => void;
|
|
125
95
|
onTaxError?: (error: Error) => void;
|
|
96
|
+
onTaxPending?: () => void;
|
|
126
97
|
}
|
|
127
98
|
|
|
128
99
|
export interface TaxInfo {
|
|
129
100
|
/** Minor units; the total the customer pays. */
|
|
130
101
|
amountTotal: number;
|
|
131
|
-
/** Minor units; tax
|
|
102
|
+
/** Minor units; the tax to show the buyer — added on top when exclusive, already inside the price when inclusive, 0 when unknown. */
|
|
132
103
|
taxAmount: number;
|
|
133
104
|
currency: string;
|
|
105
|
+
taxBehavior?: TaxBehavior;
|
|
134
106
|
}
|
|
135
107
|
|
|
108
|
+
export type TaxBehavior = 'inclusive' | 'exclusive';
|
|
109
|
+
|
|
136
110
|
export interface PaymentButtonSelectors {
|
|
137
111
|
paypal: string;
|
|
138
112
|
googlePay: string;
|
|
139
113
|
applePay: string;
|
|
140
114
|
}
|
|
141
115
|
|
|
142
|
-
export interface CheckoutOptions extends
|
|
143
|
-
Partial<HeadlessUniversalCheckoutOptions>,
|
|
144
|
-
'applePay'
|
|
145
|
-
> {
|
|
146
|
-
applePay?: BillingApplePayOptions;
|
|
116
|
+
export interface CheckoutOptions extends Partial<HeadlessUniversalCheckoutOptions> {
|
|
147
117
|
onTokenizeSuccess: OnTokenizeSuccess;
|
|
148
118
|
onResumeSuccess: OnResumeSuccess;
|
|
149
119
|
onAvailablePaymentMethodsLoad?: (items: PaymentMethod[]) => void;
|
|
@@ -298,6 +268,8 @@ export interface APIError extends FunnefoxSDKError {
|
|
|
298
268
|
errorType: string | null;
|
|
299
269
|
requestId: string | null;
|
|
300
270
|
response: unknown;
|
|
271
|
+
declineCode: string | null;
|
|
272
|
+
declineCodeSource: DeclineCodeSource | null;
|
|
301
273
|
}
|
|
302
274
|
|
|
303
275
|
export interface PrimerError extends FunnefoxSDKError {
|
|
@@ -384,13 +356,12 @@ export interface InitMethodOptions
|
|
|
384
356
|
Partial<
|
|
385
357
|
Pick<
|
|
386
358
|
HeadlessUniversalCheckoutOptions,
|
|
387
|
-
'style' | 'card' | 'paypal' | 'googlePay'
|
|
359
|
+
'style' | 'card' | 'applePay' | 'paypal' | 'googlePay'
|
|
388
360
|
>
|
|
389
361
|
>,
|
|
390
362
|
'card'
|
|
391
363
|
>,
|
|
392
364
|
InitMethodCallbacks {
|
|
393
|
-
applePay?: BillingApplePayOptions;
|
|
394
365
|
card?: BillingCardOptions;
|
|
395
366
|
orgId: string;
|
|
396
367
|
baseUrl?: string;
|
|
@@ -400,16 +371,26 @@ export interface InitMethodOptions
|
|
|
400
371
|
meta?: MetadataType;
|
|
401
372
|
}
|
|
402
373
|
|
|
374
|
+
export type DeclineCodeSource = ('primer' | 'stripe' | 'adyen') | (string & {});
|
|
375
|
+
|
|
376
|
+
export type PaymentFailure = Error & {
|
|
377
|
+
declineCode?: string | null;
|
|
378
|
+
declineCodeSource?: DeclineCodeSource | null;
|
|
379
|
+
};
|
|
380
|
+
|
|
403
381
|
export interface InitMethodCallbacks {
|
|
404
382
|
onRenderSuccess?: () => void;
|
|
405
383
|
onRenderError?: (err: PaymentMethod) => void;
|
|
406
384
|
onPaymentSuccess?: () => void;
|
|
407
|
-
onPaymentFail?: (err:
|
|
385
|
+
onPaymentFail?: (err: PaymentFailure) => void;
|
|
408
386
|
onPaymentCancel?: () => void;
|
|
409
387
|
onErrorMessageChange?: (msg: string) => void;
|
|
410
388
|
onLoaderChange?: (state: boolean) => void;
|
|
411
389
|
onPaymentStarted?: (method: PaymentMethod) => void;
|
|
412
390
|
onMethodsAvailable?: (methods: PaymentMethod[]) => void;
|
|
391
|
+
onTaxChange?: (info: TaxInfo) => void;
|
|
392
|
+
onTaxError?: (error: Error) => void;
|
|
393
|
+
onTaxPending?: () => void;
|
|
413
394
|
}
|
|
414
395
|
|
|
415
396
|
export declare function initMethod(
|
|
@@ -435,7 +416,7 @@ export declare function getAvailablePaymentMethods(params: {
|
|
|
435
416
|
export interface StripeCardFormOptions
|
|
436
417
|
extends
|
|
437
418
|
CreateClientSessionOptions,
|
|
438
|
-
Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
|
|
419
|
+
Omit<InitMethodCallbacks, 'onPaymentSuccess' | 'onTaxPending'> {
|
|
439
420
|
onPaymentSuccess?: (
|
|
440
421
|
paymentMethod: import('@stripe/stripe-js').PaymentMethod,
|
|
441
422
|
orderId: string
|
|
@@ -452,12 +433,16 @@ export interface StripeCardFormOptions
|
|
|
452
433
|
export interface StripeWalletOptions
|
|
453
434
|
extends
|
|
454
435
|
CreateClientSessionOptions,
|
|
455
|
-
Omit<
|
|
436
|
+
Omit<
|
|
437
|
+
InitMethodCallbacks,
|
|
438
|
+
'onPaymentSuccess' | 'onTaxPending' | 'onTaxError'
|
|
439
|
+
> {
|
|
456
440
|
onPaymentSuccess?: (
|
|
457
441
|
paymentMethod: import('@stripe/stripe-js').PaymentMethod,
|
|
458
442
|
orderId: string
|
|
459
443
|
) => void;
|
|
460
444
|
totalLabel?: string;
|
|
445
|
+
onTaxChange?: (info: TaxInfo) => void;
|
|
461
446
|
}
|
|
462
447
|
|
|
463
448
|
export interface StripeCardForm {
|
|
@@ -571,6 +556,8 @@ export interface CreateClientSessionResponse {
|
|
|
571
556
|
// Session tax estimate (detected-country) in minor units — for showing tax on mount and in the
|
|
572
557
|
// wallet sheet, and (Stripe-direct) collecting it via the wallet.
|
|
573
558
|
tax_amount?: number;
|
|
559
|
+
tax_inclusive_amount?: number;
|
|
560
|
+
tax_behavior?: TaxBehavior;
|
|
574
561
|
amount_total?: number;
|
|
575
562
|
currency?: string;
|
|
576
563
|
tax_calculation_id?: string;
|
|
@@ -598,6 +585,8 @@ export interface TaxRecalculationData {
|
|
|
598
585
|
tax_calculation_id: string;
|
|
599
586
|
amount_total: number;
|
|
600
587
|
tax_amount: number;
|
|
588
|
+
tax_inclusive_amount?: number;
|
|
589
|
+
tax_behavior?: TaxBehavior;
|
|
601
590
|
currency: string;
|
|
602
591
|
}
|
|
603
592
|
|
|
@@ -616,6 +605,8 @@ export interface PaymentResponseData {
|
|
|
616
605
|
action_required_token: string;
|
|
617
606
|
checkout_status: 'processing' | 'succeeded' | 'failed' | 'cancelled';
|
|
618
607
|
failed_message_for_user: string;
|
|
608
|
+
decline_code?: string | null;
|
|
609
|
+
decline_code_source?: DeclineCodeSource | null;
|
|
619
610
|
order_id: string;
|
|
620
611
|
}
|
|
621
612
|
|