@funnelfox/billing 0.10.0 → 0.11.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/src/types.d.ts CHANGED
@@ -74,10 +74,40 @@ 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
+
77
106
  export interface PrimerCheckoutConfig extends Pick<
78
107
  Partial<HeadlessUniversalCheckoutOptions>,
79
- 'paypal' | 'applePay' | 'googlePay' | 'style'
108
+ 'paypal' | 'googlePay' | 'style'
80
109
  > {
110
+ applePay?: BillingApplePayOptions;
81
111
  card?: BillingCardOptions;
82
112
  cardSelectors?: CardInputSelectors;
83
113
  paymentButtonSelectors?: PaymentButtonSelectors;
@@ -103,17 +133,43 @@ export interface TaxInfo {
103
133
  taxAmount: number;
104
134
  currency: string;
105
135
  taxBehavior?: TaxBehavior;
136
+ taxRate?: number;
137
+ taxBreakdown?: TaxBreakdownEntry[];
106
138
  }
107
139
 
108
140
  export type TaxBehavior = 'inclusive' | 'exclusive';
109
141
 
142
+ export interface TaxBreakdownEntry {
143
+ amount: string;
144
+ percentage: string;
145
+ inclusive: boolean;
146
+ taxType?: string | null;
147
+ country?: string | null;
148
+ subdivision?: string | null;
149
+ taxabilityReason?: string | null;
150
+ }
151
+
152
+ export interface TaxBreakdownEntryResponse {
153
+ amount: string;
154
+ percentage: string;
155
+ inclusive: boolean;
156
+ tax_type?: string | null;
157
+ country?: string | null;
158
+ subdivision?: string | null;
159
+ taxability_reason?: string | null;
160
+ }
161
+
110
162
  export interface PaymentButtonSelectors {
111
163
  paypal: string;
112
164
  googlePay: string;
113
165
  applePay: string;
114
166
  }
115
167
 
116
- export interface CheckoutOptions extends Partial<HeadlessUniversalCheckoutOptions> {
168
+ export interface CheckoutOptions extends Omit<
169
+ Partial<HeadlessUniversalCheckoutOptions>,
170
+ 'applePay'
171
+ > {
172
+ applePay?: BillingApplePayOptions;
117
173
  onTokenizeSuccess: OnTokenizeSuccess;
118
174
  onResumeSuccess: OnResumeSuccess;
119
175
  onAvailablePaymentMethodsLoad?: (items: PaymentMethod[]) => void;
@@ -356,12 +412,13 @@ export interface InitMethodOptions
356
412
  Partial<
357
413
  Pick<
358
414
  HeadlessUniversalCheckoutOptions,
359
- 'style' | 'card' | 'applePay' | 'paypal' | 'googlePay'
415
+ 'style' | 'card' | 'paypal' | 'googlePay'
360
416
  >
361
417
  >,
362
418
  'card'
363
419
  >,
364
420
  InitMethodCallbacks {
421
+ applePay?: BillingApplePayOptions;
365
422
  card?: BillingCardOptions;
366
423
  orgId: string;
367
424
  baseUrl?: string;
@@ -558,6 +615,7 @@ export interface CreateClientSessionResponse {
558
615
  tax_amount?: number;
559
616
  tax_inclusive_amount?: number;
560
617
  tax_behavior?: TaxBehavior;
618
+ tax_breakdown?: TaxBreakdownEntryResponse[];
561
619
  amount_total?: number;
562
620
  currency?: string;
563
621
  tax_calculation_id?: string;
@@ -587,6 +645,7 @@ export interface TaxRecalculationData {
587
645
  tax_amount: number;
588
646
  tax_inclusive_amount?: number;
589
647
  tax_behavior?: TaxBehavior;
648
+ tax_breakdown?: TaxBreakdownEntryResponse[];
590
649
  currency: string;
591
650
  }
592
651