@clickaroo/checkout-ui 1.1.2-beta → 1.1.3-beta

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/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
3
  import { LayoutObject, Appearance } from '@stripe/stripe-js';
4
4
  import { z } from 'zod';
5
+ import { BrowserOptions } from '@sentry/react';
5
6
 
6
7
  interface CartItem {
7
8
  sku: string;
@@ -92,36 +93,12 @@ interface PaymentMethodsProps {
92
93
  }
93
94
  declare const PaymentMethods: React$1.FC<PaymentMethodsProps>;
94
95
 
95
- interface ClickarooInfo {
96
- offer_code: string;
97
- type: "one_off" | "subscription_schedules";
98
- payment: {
99
- type: "stripe";
100
- data: ClickarooPaymentStripe;
101
- };
102
- subscription_schedules?: {
103
- phase: number;
104
- price_in_cents: number;
105
- currency: string;
106
- quantity: number;
107
- period: string;
108
- }[];
109
- one_off?: {
110
- price_in_cents: number;
111
- currency: string;
112
- quantity: number;
113
- };
114
- }
115
- interface ClickarooPaymentStripe {
116
- publishable_key: string;
117
- account_id: string;
118
- }
119
-
120
96
  declare enum OrderPaymentStatus {
121
97
  PENDING = "pending",
122
98
  PAID = "paid",
123
99
  PARTIALLY_PAID = "partially_paid",
124
- FAILED = "failed"
100
+ FAILED = "failed",
101
+ REQUIRES_ACTION = "requires_action"
125
102
  }
126
103
  interface OrderCustomerInfo {
127
104
  name: string;
@@ -190,6 +167,7 @@ interface CreateOrderResponse {
190
167
  advice_code?: AdviceCode;
191
168
  message?: string;
192
169
  payment_method_id?: string;
170
+ secret?: string;
193
171
  [key: string]: unknown;
194
172
  };
195
173
  order_trade_code: string;
@@ -267,6 +245,31 @@ interface OrderDetail {
267
245
  updated_at: string;
268
246
  }
269
247
 
248
+ interface ClickarooInfo {
249
+ offer_code: string;
250
+ type: "one_off" | "subscription_schedules";
251
+ payment: {
252
+ type: "stripe";
253
+ data: ClickarooPaymentStripe;
254
+ };
255
+ subscription_schedules?: {
256
+ phase: number;
257
+ price_in_cents: number;
258
+ currency: string;
259
+ quantity: number;
260
+ period: string;
261
+ }[];
262
+ one_off?: {
263
+ price_in_cents: number;
264
+ currency: string;
265
+ quantity: number;
266
+ };
267
+ }
268
+ interface ClickarooPaymentStripe {
269
+ publishable_key: string;
270
+ account_id: string;
271
+ }
272
+
270
273
  interface ApiClientConfig {
271
274
  baseUrl: string;
272
275
  }
@@ -290,7 +293,10 @@ declare class ApiClient {
290
293
  createOrder(orderData: CreateOrderRequest): Promise<ApiResponse<CreateOrderResponse>>;
291
294
  createOrderWithToken(orderData: Omit<CreateOrderRequest, "clickaroo_token">): Promise<ApiResponse<CreateOrderResponse>>;
292
295
  getOrderDetail(orderCode: string): Promise<ApiResponse<OrderDetail>>;
296
+ confirmPayment(orderCode: string, tradeCode: string): Promise<ApiResponse<CreateOrderResponse>>;
293
297
  getPricePointInfo(offerPricePoints: string | string[]): Promise<ApiResponse<ClickarooInfo | Record<string, ClickarooInfo>>>;
298
+ updateOrder(orderCode: string, orderData: UpdateOrderRequest): Promise<ApiResponse<OrderDetail>>;
299
+ retryPayment(orderCode: string, tradeCode: string, paymentData: RetryPaymentRequest): Promise<ApiResponse<CreateOrderResponse>>;
294
300
  }
295
301
 
296
302
  declare global {
@@ -340,6 +346,10 @@ interface CookieOptions {
340
346
  sameSite?: 'strict' | 'lax' | 'none';
341
347
  }
342
348
 
349
+ /**
350
+ * Sentry configuration options
351
+ */
352
+ type ClickarooSentryConfig = Partial<BrowserOptions>;
343
353
  /**
344
354
  * ClickarooProvider configuration options
345
355
  */
@@ -352,6 +362,10 @@ interface ClickarooProviderConfig {
352
362
  cookieOptions?: CookieOptions;
353
363
  /** Whether to output debug information to console */
354
364
  debug?: boolean;
365
+ /** Whether to enable Sentry error tracking, defaults to true if sentryConfig is provided */
366
+ enableSentry?: boolean;
367
+ /** Sentry configuration for error tracking */
368
+ sentryConfig?: ClickarooSentryConfig;
355
369
  }
356
370
  /**
357
371
  * Clickaroo Context type
@@ -386,15 +400,26 @@ interface UseCheckoutContextPublic {
386
400
  }
387
401
  declare const useCheckoutContextPublic: () => UseCheckoutContextPublic;
388
402
 
403
+ interface ThreeDSAction {
404
+ clientSecret: string;
405
+ orderCode: string;
406
+ tradeCode: string;
407
+ }
408
+
389
409
  interface OrderSubmissionResult {
390
410
  success: boolean;
391
411
  message: string;
392
412
  orderCode?: string;
393
413
  tradeCode?: string;
414
+ requiresAction?: boolean;
415
+ clientSecret?: string;
416
+ [key: string]: unknown;
394
417
  }
395
418
  interface UseOrderSubmissionOptions {
396
419
  /** payment error callback */
397
420
  onPaymentError?: (result: Required<CreateOrderResponse['payment_result']>) => void;
421
+ /** handle 3DS authentication */
422
+ on3DSAuthStart?: (action: ThreeDSAction) => Promise<OrderSubmissionResult>;
398
423
  }
399
424
  declare const useOrderSubmission: (options?: UseOrderSubmissionOptions) => {
400
425
  isSubmitting: boolean;
@@ -446,4 +471,4 @@ declare const getPricePointInfo: (baseUrl: string, offerPricePoints: string | st
446
471
  }>;
447
472
 
448
473
  export { AdviceCode, ApiClient, SubmitButton as ButtonGroup, CheckoutPage, CheckoutProvider, ClickarooProvider, CustomInfo as CustomerInfo, DeliveryAddress$1 as DeliveryAddress, FulfillmentStatus, OrderPaymentStatus, OrderStatus, PaymentMethods, PaymentType, RefundStatus, createOrderWithToken as createOrder, getOrderDetail, getPricePointInfo, useCheckoutContextPublic as useCheckoutContext, useClickarooParams, useOrderDetail, useOrderSubmission };
449
- export type { ApiClientConfig, ApiResponse, CartItem, CheckoutCartItem, ClickarooContextType, ClickarooInfo, ClickarooPaymentStripe, ClickarooProviderConfig, ConfirmPaymentData, CreateOrderItem, CreateOrderRequest, CreateOrderResponse, CustomerInfo as CustomerInfoType, DeliveryAddress as DeliveryAddressType, OnCheckoutInitCallback, OnOrderSubmitCallback, OnOrderSuccessCallback, OnPaymentInfoCompleteCallback, OrderAddress, OrderApiError, OrderCustomer, OrderCustomerInfo, OrderDetail, OrderDetailMetadata, OrderItem, OrderMetadata, OrderPayment, OrderPaymentData, OrderShippingAddress, RetryPaymentData, RetryPaymentRequest, UpdateOrderRequest, UseCheckoutContextPublic as UseCheckoutContext };
474
+ export type { ApiClientConfig, ApiResponse, CartItem, CheckoutCartItem, ClickarooContextType, ClickarooInfo, ClickarooPaymentStripe, ClickarooProviderConfig, ClickarooSentryConfig, ConfirmPaymentData, CreateOrderItem, CreateOrderRequest, CreateOrderResponse, CustomerInfo as CustomerInfoType, DeliveryAddress as DeliveryAddressType, OnCheckoutInitCallback, OnOrderSubmitCallback, OnOrderSuccessCallback, OnPaymentInfoCompleteCallback, OrderAddress, OrderApiError, OrderCustomer, OrderCustomerInfo, OrderDetail, OrderDetailMetadata, OrderItem, OrderMetadata, OrderPayment, OrderPaymentData, OrderShippingAddress, RetryPaymentData, RetryPaymentRequest, UpdateOrderRequest, UseCheckoutContextPublic as UseCheckoutContext };