@clickaroo/checkout-ui 1.0.1-beta → 1.1.1-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,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { ReactNode } from 'react';
2
+ import React$1, { ReactNode } from 'react';
3
+ import { LayoutObject, Appearance } from '@stripe/stripe-js';
3
4
  import { z } from 'zod';
4
5
 
5
6
  interface CartItem {
@@ -36,31 +37,60 @@ interface CheckoutPageProps {
36
37
  onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
37
38
  onOrderSubmit?: OnOrderSubmitCallback;
38
39
  onOrderSuccess?: OnOrderSuccessCallback;
40
+ styles?: React.CSSProperties;
39
41
  }
40
42
  declare const CheckoutPage: (props: CheckoutPageProps) => react_jsx_runtime.JSX.Element;
41
43
 
42
44
  interface SubmitButtonProps {
45
+ buttonText?: string | React$1.ReactNode;
46
+ showSecurityText?: boolean;
43
47
  onOrderSubmit?: OnOrderSubmitCallback;
44
48
  onOrderSuccess?: OnOrderSuccessCallback;
49
+ styles?: React$1.CSSProperties & {
50
+ root?: React$1.CSSProperties;
51
+ button?: React$1.CSSProperties;
52
+ buttonContent?: React$1.CSSProperties;
53
+ };
45
54
  }
46
- declare const SubmitButton: React.FC<SubmitButtonProps>;
55
+ declare const SubmitButton: React$1.FC<SubmitButtonProps>;
47
56
 
48
57
  interface CustomInfoProps {
49
58
  showTitle?: boolean;
59
+ showLabel?: boolean;
60
+ styles?: React$1.CSSProperties & {
61
+ root?: React$1.CSSProperties;
62
+ container?: React$1.CSSProperties;
63
+ input?: React$1.CSSProperties;
64
+ };
50
65
  }
51
- declare const CustomInfo: React.FC<CustomInfoProps>;
66
+ declare const CustomInfo: React$1.FC<CustomInfoProps>;
52
67
 
53
68
  interface DeliveryAddressProps {
54
69
  showTitle?: boolean;
70
+ showLabel?: boolean;
55
71
  googleApiKey?: string;
72
+ styles?: {
73
+ root?: React$1.CSSProperties;
74
+ container?: React$1.CSSProperties;
75
+ input?: React$1.CSSProperties;
76
+ };
56
77
  }
57
- declare const DeliveryAddress$1: React.FC<DeliveryAddressProps>;
78
+ declare const DeliveryAddress$1: React$1.FC<DeliveryAddressProps>;
58
79
 
80
+ interface StripePaymentOptions {
81
+ layout?: LayoutObject;
82
+ appearance?: Appearance;
83
+ }
59
84
  interface PaymentMethodsProps {
60
85
  showText?: boolean;
61
86
  onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
87
+ options?: StripePaymentOptions;
88
+ styles?: React$1.CSSProperties & {
89
+ root?: React$1.CSSProperties;
90
+ container?: React$1.CSSProperties;
91
+ };
62
92
  }
63
- declare const PaymentMethods: React.FC<PaymentMethodsProps>;
93
+ declare const PaymentMethods: React$1.FC<PaymentMethodsProps>;
64
94
 
65
95
  interface ClickarooInfo {
66
96
  offer_code: string;
@@ -114,6 +144,18 @@ interface OrderPayment {
114
144
  type: 'stripe';
115
145
  data: OrderPaymentData;
116
146
  }
147
+ interface ConfirmPaymentData {
148
+ confirmation_token_id?: string;
149
+ payment_method_types?: string[];
150
+ payment_method_id?: string;
151
+ }
152
+ interface RetryPaymentData {
153
+ type: string;
154
+ data: ConfirmPaymentData;
155
+ }
156
+ interface RetryPaymentRequest {
157
+ payment_data: RetryPaymentData;
158
+ }
117
159
  interface CreateOrderItem {
118
160
  sku: string;
119
161
  price_point_code: string;
@@ -133,12 +175,30 @@ interface CreateOrderRequest {
133
175
  metadata: OrderMetadata;
134
176
  payment: OrderPayment;
135
177
  }
178
+ interface UpdateOrderRequest {
179
+ customer_info: OrderCustomerInfo;
180
+ billing_address?: OrderAddress;
181
+ shipping_address: OrderShippingAddress;
182
+ source_url?: string;
183
+ remark?: string;
184
+ metadata?: Record<string, unknown>;
185
+ }
136
186
  interface CreateOrderResponse {
137
187
  order_code: string;
138
188
  payment_status: OrderPaymentStatus;
139
- payment_result: Record<string, unknown>;
189
+ payment_result: {
190
+ advice_code?: AdviceCode;
191
+ message?: string;
192
+ payment_method_id?: string;
193
+ [key: string]: unknown;
194
+ };
140
195
  order_trade_code: string;
141
196
  }
197
+ declare enum AdviceCode {
198
+ DO_NOT_TRY_AGAIN = "do_not_try_again",
199
+ TRY_AGAIN_LATER = "try_again_later",
200
+ CONFIRM_CARD_DATA = "confirm_card_data"
201
+ }
142
202
  interface OrderApiError {
143
203
  message: string;
144
204
  code?: string;
@@ -237,6 +297,9 @@ declare global {
237
297
  interface Window {
238
298
  dataLayer: unknown[];
239
299
  gtag: (...args: unknown[]) => void;
300
+ $tracksity: {
301
+ tssid: string;
302
+ };
240
303
  }
241
304
  }
242
305
 
@@ -263,7 +326,7 @@ interface CheckoutProviderProps {
263
326
  onCheckoutInit?: OnCheckoutInitCallback;
264
327
  metadata?: Record<string, string>;
265
328
  }
266
- declare const CheckoutProvider: React.FC<CheckoutProviderProps>;
329
+ declare const CheckoutProvider: React$1.FC<CheckoutProviderProps>;
267
330
 
268
331
  /**
269
332
  * Storage utility functions
@@ -310,7 +373,7 @@ interface ClickarooProviderProps {
310
373
  * ClickarooProvider component
311
374
  * Used to manage Clickaroo-related parameters at the outermost level of the application
312
375
  */
313
- declare const ClickarooProvider: React.FC<ClickarooProviderProps>;
376
+ declare const ClickarooProvider: React$1.FC<ClickarooProviderProps>;
314
377
 
315
378
  interface UseCheckoutContextPublic {
316
379
  isFormValid: () => boolean;
@@ -329,9 +392,15 @@ interface OrderSubmissionResult {
329
392
  orderCode?: string;
330
393
  tradeCode?: string;
331
394
  }
332
- declare const useOrderSubmission: () => {
395
+ interface UseOrderSubmissionOptions {
396
+ /** payment error callback */
397
+ onPaymentError?: (result: Required<CreateOrderResponse['payment_result']>) => void;
398
+ }
399
+ declare const useOrderSubmission: (options?: UseOrderSubmissionOptions) => {
333
400
  isSubmitting: boolean;
334
401
  submitOrder: () => Promise<OrderSubmissionResult>;
402
+ retryOrder: () => Promise<OrderSubmissionResult>;
403
+ failedAdviceCode: AdviceCode | undefined;
335
404
  };
336
405
 
337
406
  interface UseOrderDetailReturn {
@@ -376,5 +445,5 @@ declare const getPricePointInfo: (baseUrl: string, offerPricePoints: string | st
376
445
  error?: PricePointApiError;
377
446
  }>;
378
447
 
379
- export { ApiClient, SubmitButton as ButtonGroup, CheckoutPage, CheckoutProvider, ClickarooProvider, CustomInfo as CustomerInfo, DeliveryAddress$1 as DeliveryAddress, PaymentMethods, createOrderWithToken as createOrder, getOrderDetail, getPricePointInfo, useCheckoutContextPublic as useCheckoutContext, useClickarooParams, useOrderDetail, useOrderSubmission };
380
- export type { ApiClientConfig, ApiResponse, CartItem, ClickarooContextType, ClickarooProviderConfig, CustomerInfo as CustomerInfoType, DeliveryAddress as DeliveryAddressType, UseCheckoutContextPublic as UseCheckoutContext };
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 };