@clickaroo/checkout-ui 1.1.2-beta → 1.2.0-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
@@ -1,7 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
- import { LayoutObject, Appearance } from '@stripe/stripe-js';
3
+ import { LayoutObject, Appearance, StripeExpressCheckoutElementOptions } 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;
@@ -38,6 +39,7 @@ interface CheckoutPageProps {
38
39
  onOrderSubmit?: OnOrderSubmitCallback;
39
40
  onOrderSuccess?: OnOrderSuccessCallback;
40
41
  styles?: React.CSSProperties;
42
+ showExpressButtons?: boolean;
41
43
  }
42
44
  declare const CheckoutPage: (props: CheckoutPageProps) => react_jsx_runtime.JSX.Element;
43
45
 
@@ -121,7 +123,8 @@ declare enum OrderPaymentStatus {
121
123
  PENDING = "pending",
122
124
  PAID = "paid",
123
125
  PARTIALLY_PAID = "partially_paid",
124
- FAILED = "failed"
126
+ FAILED = "failed",
127
+ REQUIRES_ACTION = "requires_action"
125
128
  }
126
129
  interface OrderCustomerInfo {
127
130
  name: string;
@@ -137,8 +140,8 @@ interface OrderShippingAddress {
137
140
  zip: string;
138
141
  }
139
142
  interface OrderPaymentData {
140
- confirmation_token_id: string;
141
- payment_method_types: string[];
143
+ confirmation_token_id?: string;
144
+ payment_method_types?: string[];
142
145
  }
143
146
  interface OrderPayment {
144
147
  type: 'stripe';
@@ -190,6 +193,7 @@ interface CreateOrderResponse {
190
193
  advice_code?: AdviceCode;
191
194
  message?: string;
192
195
  payment_method_id?: string;
196
+ secret?: string;
193
197
  [key: string]: unknown;
194
198
  };
195
199
  order_trade_code: string;
@@ -267,6 +271,14 @@ interface OrderDetail {
267
271
  updated_at: string;
268
272
  }
269
273
 
274
+ interface ExpressButtonsProps {
275
+ styles?: React$1.CSSProperties;
276
+ options?: StripeExpressCheckoutElementOptions;
277
+ onOrderSubmit?: OnOrderSubmitCallback;
278
+ onOrderSuccess?: OnOrderSuccessCallback;
279
+ }
280
+ declare const ExpressButtons: React$1.FC<ExpressButtonsProps>;
281
+
270
282
  interface ApiClientConfig {
271
283
  baseUrl: string;
272
284
  }
@@ -290,7 +302,10 @@ declare class ApiClient {
290
302
  createOrder(orderData: CreateOrderRequest): Promise<ApiResponse<CreateOrderResponse>>;
291
303
  createOrderWithToken(orderData: Omit<CreateOrderRequest, "clickaroo_token">): Promise<ApiResponse<CreateOrderResponse>>;
292
304
  getOrderDetail(orderCode: string): Promise<ApiResponse<OrderDetail>>;
305
+ confirmPayment(orderCode: string, tradeCode: string): Promise<ApiResponse<CreateOrderResponse>>;
293
306
  getPricePointInfo(offerPricePoints: string | string[]): Promise<ApiResponse<ClickarooInfo | Record<string, ClickarooInfo>>>;
307
+ updateOrder(orderCode: string, orderData: UpdateOrderRequest): Promise<ApiResponse<OrderDetail>>;
308
+ retryPayment(orderCode: string, tradeCode: string, paymentData: RetryPaymentRequest): Promise<ApiResponse<CreateOrderResponse>>;
294
309
  }
295
310
 
296
311
  declare global {
@@ -325,6 +340,8 @@ interface CheckoutProviderProps {
325
340
  baseUrl: string;
326
341
  onCheckoutInit?: OnCheckoutInitCallback;
327
342
  metadata?: Record<string, string>;
343
+ locale?: string;
344
+ paymentMethodTypes?: string[];
328
345
  }
329
346
  declare const CheckoutProvider: React$1.FC<CheckoutProviderProps>;
330
347
 
@@ -340,6 +357,10 @@ interface CookieOptions {
340
357
  sameSite?: 'strict' | 'lax' | 'none';
341
358
  }
342
359
 
360
+ /**
361
+ * Sentry configuration options
362
+ */
363
+ type ClickarooSentryConfig = Partial<BrowserOptions>;
343
364
  /**
344
365
  * ClickarooProvider configuration options
345
366
  */
@@ -352,6 +373,10 @@ interface ClickarooProviderConfig {
352
373
  cookieOptions?: CookieOptions;
353
374
  /** Whether to output debug information to console */
354
375
  debug?: boolean;
376
+ /** Whether to enable Sentry error tracking, defaults to true if sentryConfig is provided */
377
+ enableSentry?: boolean;
378
+ /** Sentry configuration for error tracking */
379
+ sentryConfig?: ClickarooSentryConfig;
355
380
  }
356
381
  /**
357
382
  * Clickaroo Context type
@@ -386,20 +411,36 @@ interface UseCheckoutContextPublic {
386
411
  }
387
412
  declare const useCheckoutContextPublic: () => UseCheckoutContextPublic;
388
413
 
414
+ interface ThreeDSAction {
415
+ clientSecret: string;
416
+ orderCode: string;
417
+ tradeCode: string;
418
+ }
419
+
389
420
  interface OrderSubmissionResult {
390
421
  success: boolean;
391
422
  message: string;
392
423
  orderCode?: string;
393
424
  tradeCode?: string;
425
+ requiresAction?: boolean;
426
+ clientSecret?: string;
427
+ [key: string]: unknown;
394
428
  }
395
429
  interface UseOrderSubmissionOptions {
396
430
  /** payment error callback */
397
431
  onPaymentError?: (result: Required<CreateOrderResponse['payment_result']>) => void;
432
+ /** handle 3DS authentication */
433
+ on3DSAuthStart?: (action: ThreeDSAction) => Promise<OrderSubmissionResult>;
434
+ }
435
+ interface SubmitOrderOverrides {
436
+ customerInfo?: Partial<CustomerInfo>;
437
+ deliveryAddress?: Partial<DeliveryAddress>;
398
438
  }
399
439
  declare const useOrderSubmission: (options?: UseOrderSubmissionOptions) => {
400
440
  isSubmitting: boolean;
401
- submitOrder: () => Promise<OrderSubmissionResult>;
441
+ submitOrder: (overrides?: SubmitOrderOverrides | undefined) => Promise<OrderSubmissionResult>;
402
442
  retryOrder: () => Promise<OrderSubmissionResult>;
443
+ confirmPaymentStatus: (orderCode: string, tradeCode: string) => Promise<OrderSubmissionResult>;
403
444
  failedAdviceCode: AdviceCode | undefined;
404
445
  };
405
446
 
@@ -445,5 +486,5 @@ declare const getPricePointInfo: (baseUrl: string, offerPricePoints: string | st
445
486
  error?: PricePointApiError;
446
487
  }>;
447
488
 
448
- 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 };
489
+ export { AdviceCode, ApiClient, SubmitButton as ButtonGroup, CheckoutPage, CheckoutProvider, ClickarooProvider, CustomInfo as CustomerInfo, DeliveryAddress$1 as DeliveryAddress, ExpressButtons, FulfillmentStatus, OrderPaymentStatus, OrderStatus, PaymentMethods, PaymentType, RefundStatus, createOrderWithToken as createOrder, getOrderDetail, getPricePointInfo, useCheckoutContextPublic as useCheckoutContext, useClickarooParams, useOrderDetail, useOrderSubmission };
490
+ 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 };