@clickaroo/checkout-ui 1.2.0-beta → 1.2.2-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 +144 -131
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { ReactNode } from 'react';
|
|
3
|
-
import { LayoutObject, Appearance, StripeExpressCheckoutElementOptions } from '@stripe/stripe-js';
|
|
4
3
|
import { z } from 'zod';
|
|
4
|
+
import { ExpressPaymentType, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent, LayoutObject, Appearance, StripeExpressCheckoutElementOptions } from '@stripe/stripe-js';
|
|
5
5
|
import { BrowserOptions } from '@sentry/react';
|
|
6
6
|
|
|
7
7
|
interface CartItem {
|
|
@@ -10,90 +10,6 @@ interface CartItem {
|
|
|
10
10
|
[key: string]: unknown;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
declare enum PaymentType {
|
|
14
|
-
OneTime = "one-time",
|
|
15
|
-
Subscription = "subscription"
|
|
16
|
-
}
|
|
17
|
-
interface CheckoutCartItem extends CartItem {
|
|
18
|
-
priceInCents: number;
|
|
19
|
-
currency: string;
|
|
20
|
-
quantity: number;
|
|
21
|
-
paymentType: PaymentType;
|
|
22
|
-
}
|
|
23
|
-
interface OnCheckoutInitCallback {
|
|
24
|
-
(): void;
|
|
25
|
-
}
|
|
26
|
-
interface OnPaymentInfoCompleteCallback {
|
|
27
|
-
(products: CheckoutCartItem[], totalAmount: number): void;
|
|
28
|
-
}
|
|
29
|
-
interface OnOrderSubmitCallback {
|
|
30
|
-
(products: CheckoutCartItem[], totalAmount: number, setMetadata: (metadata: Record<string, string>) => void): void;
|
|
31
|
-
}
|
|
32
|
-
interface OnOrderSuccessCallback {
|
|
33
|
-
(orderCode: string, tradeCode?: string): void;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface CheckoutPageProps {
|
|
37
|
-
googleApiKey?: string;
|
|
38
|
-
onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
|
|
39
|
-
onOrderSubmit?: OnOrderSubmitCallback;
|
|
40
|
-
onOrderSuccess?: OnOrderSuccessCallback;
|
|
41
|
-
styles?: React.CSSProperties;
|
|
42
|
-
showExpressButtons?: boolean;
|
|
43
|
-
}
|
|
44
|
-
declare const CheckoutPage: (props: CheckoutPageProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
-
|
|
46
|
-
interface SubmitButtonProps {
|
|
47
|
-
buttonText?: string | React$1.ReactNode;
|
|
48
|
-
showSecurityText?: boolean;
|
|
49
|
-
onOrderSubmit?: OnOrderSubmitCallback;
|
|
50
|
-
onOrderSuccess?: OnOrderSuccessCallback;
|
|
51
|
-
styles?: React$1.CSSProperties & {
|
|
52
|
-
root?: React$1.CSSProperties;
|
|
53
|
-
button?: React$1.CSSProperties;
|
|
54
|
-
buttonContent?: React$1.CSSProperties;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
declare const SubmitButton: React$1.FC<SubmitButtonProps>;
|
|
58
|
-
|
|
59
|
-
interface CustomInfoProps {
|
|
60
|
-
showTitle?: boolean;
|
|
61
|
-
showLabel?: boolean;
|
|
62
|
-
styles?: React$1.CSSProperties & {
|
|
63
|
-
root?: React$1.CSSProperties;
|
|
64
|
-
container?: React$1.CSSProperties;
|
|
65
|
-
input?: React$1.CSSProperties;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
declare const CustomInfo: React$1.FC<CustomInfoProps>;
|
|
69
|
-
|
|
70
|
-
interface DeliveryAddressProps {
|
|
71
|
-
showTitle?: boolean;
|
|
72
|
-
showLabel?: boolean;
|
|
73
|
-
googleApiKey?: string;
|
|
74
|
-
styles?: {
|
|
75
|
-
root?: React$1.CSSProperties;
|
|
76
|
-
container?: React$1.CSSProperties;
|
|
77
|
-
input?: React$1.CSSProperties;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
declare const DeliveryAddress$1: React$1.FC<DeliveryAddressProps>;
|
|
81
|
-
|
|
82
|
-
interface StripePaymentOptions {
|
|
83
|
-
layout?: LayoutObject;
|
|
84
|
-
appearance?: Appearance;
|
|
85
|
-
}
|
|
86
|
-
interface PaymentMethodsProps {
|
|
87
|
-
showText?: boolean;
|
|
88
|
-
onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
|
|
89
|
-
options?: StripePaymentOptions;
|
|
90
|
-
styles?: React$1.CSSProperties & {
|
|
91
|
-
root?: React$1.CSSProperties;
|
|
92
|
-
container?: React$1.CSSProperties;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
declare const PaymentMethods: React$1.FC<PaymentMethodsProps>;
|
|
96
|
-
|
|
97
13
|
interface ClickarooInfo {
|
|
98
14
|
offer_code: string;
|
|
99
15
|
type: "one_off" | "subscription_schedules";
|
|
@@ -271,14 +187,6 @@ interface OrderDetail {
|
|
|
271
187
|
updated_at: string;
|
|
272
188
|
}
|
|
273
189
|
|
|
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
|
-
|
|
282
190
|
interface ApiClientConfig {
|
|
283
191
|
baseUrl: string;
|
|
284
192
|
}
|
|
@@ -333,7 +241,7 @@ declare const AddressSchema: z.ZodObject<{
|
|
|
333
241
|
state: z.ZodString;
|
|
334
242
|
zipCode: z.ZodString;
|
|
335
243
|
}, z.core.$strip>;
|
|
336
|
-
type DeliveryAddress = z.infer<typeof AddressSchema>;
|
|
244
|
+
type DeliveryAddress$1 = z.infer<typeof AddressSchema>;
|
|
337
245
|
interface CheckoutProviderProps {
|
|
338
246
|
children: ReactNode;
|
|
339
247
|
cart: CartItem[];
|
|
@@ -345,6 +253,144 @@ interface CheckoutProviderProps {
|
|
|
345
253
|
}
|
|
346
254
|
declare const CheckoutProvider: React$1.FC<CheckoutProviderProps>;
|
|
347
255
|
|
|
256
|
+
interface ThreeDSAction {
|
|
257
|
+
clientSecret: string;
|
|
258
|
+
orderCode: string;
|
|
259
|
+
tradeCode: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface OrderSubmissionResult {
|
|
263
|
+
success: boolean;
|
|
264
|
+
message: string;
|
|
265
|
+
orderCode?: string;
|
|
266
|
+
tradeCode?: string;
|
|
267
|
+
requiresAction?: boolean;
|
|
268
|
+
clientSecret?: string;
|
|
269
|
+
[key: string]: unknown;
|
|
270
|
+
}
|
|
271
|
+
interface UseOrderSubmissionOptions {
|
|
272
|
+
/** payment error callback */
|
|
273
|
+
onPaymentError?: (result: Required<CreateOrderResponse['payment_result']>) => void;
|
|
274
|
+
/** handle 3DS authentication */
|
|
275
|
+
on3DSAuthStart?: (action: ThreeDSAction) => Promise<OrderSubmissionResult>;
|
|
276
|
+
}
|
|
277
|
+
interface SubmitOrderOverrides {
|
|
278
|
+
customerInfo?: Partial<CustomerInfo>;
|
|
279
|
+
deliveryAddress?: Partial<DeliveryAddress$1>;
|
|
280
|
+
expressPaymentType?: ExpressPaymentType;
|
|
281
|
+
}
|
|
282
|
+
declare const useOrderSubmission: (options?: UseOrderSubmissionOptions) => {
|
|
283
|
+
isSubmitting: boolean;
|
|
284
|
+
submitOrder: (overrides?: SubmitOrderOverrides | undefined) => Promise<OrderSubmissionResult>;
|
|
285
|
+
retryOrder: () => Promise<OrderSubmissionResult>;
|
|
286
|
+
confirmPaymentStatus: (orderCode: string, tradeCode: string) => Promise<OrderSubmissionResult>;
|
|
287
|
+
failedAdviceCode: AdviceCode | undefined;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
declare enum PaymentType {
|
|
291
|
+
OneTime = "one-time",
|
|
292
|
+
Subscription = "subscription"
|
|
293
|
+
}
|
|
294
|
+
interface CheckoutCartItem extends CartItem {
|
|
295
|
+
priceInCents: number;
|
|
296
|
+
currency: string;
|
|
297
|
+
quantity: number;
|
|
298
|
+
paymentType: PaymentType;
|
|
299
|
+
}
|
|
300
|
+
interface OnCheckoutInitCallback {
|
|
301
|
+
(): void;
|
|
302
|
+
}
|
|
303
|
+
interface OnPaymentInfoCompleteCallback {
|
|
304
|
+
(products: CheckoutCartItem[], totalAmount: number): void;
|
|
305
|
+
}
|
|
306
|
+
interface OnOrderSubmitCallback {
|
|
307
|
+
(products: CheckoutCartItem[], totalAmount: number, setMetadata: (metadata: Record<string, string>) => void): void;
|
|
308
|
+
}
|
|
309
|
+
interface OnOrderCreatedCallback {
|
|
310
|
+
(result: OrderSubmissionResult): void;
|
|
311
|
+
}
|
|
312
|
+
interface OnOrderSuccessCallback {
|
|
313
|
+
(orderCode: string, tradeCode?: string): void;
|
|
314
|
+
}
|
|
315
|
+
type OnOrderConfirmedCallback = OnOrderSuccessCallback;
|
|
316
|
+
|
|
317
|
+
interface CheckoutPageProps {
|
|
318
|
+
googleApiKey?: string;
|
|
319
|
+
onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
|
|
320
|
+
onOrderSubmit?: OnOrderSubmitCallback;
|
|
321
|
+
onOrderCreated?: OnOrderCreatedCallback;
|
|
322
|
+
onOrderSuccess?: OnOrderSuccessCallback;
|
|
323
|
+
styles?: React.CSSProperties;
|
|
324
|
+
showExpressButtons?: boolean;
|
|
325
|
+
onExpressButtonClick?: (event: StripeExpressCheckoutElementClickEvent) => void;
|
|
326
|
+
onExpressButtonConfirm?: (event: StripeExpressCheckoutElementConfirmEvent) => void;
|
|
327
|
+
}
|
|
328
|
+
declare const CheckoutPage: (props: CheckoutPageProps) => react_jsx_runtime.JSX.Element;
|
|
329
|
+
|
|
330
|
+
interface SubmitButtonProps {
|
|
331
|
+
buttonText?: string | React$1.ReactNode;
|
|
332
|
+
showSecurityText?: boolean;
|
|
333
|
+
onOrderSubmit?: OnOrderSubmitCallback;
|
|
334
|
+
onOrderCreated?: OnOrderCreatedCallback;
|
|
335
|
+
onOrderSuccess?: OnOrderSuccessCallback;
|
|
336
|
+
styles?: React$1.CSSProperties & {
|
|
337
|
+
root?: React$1.CSSProperties;
|
|
338
|
+
button?: React$1.CSSProperties;
|
|
339
|
+
buttonContent?: React$1.CSSProperties;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
declare const SubmitButton: React$1.FC<SubmitButtonProps>;
|
|
343
|
+
|
|
344
|
+
interface CustomInfoProps {
|
|
345
|
+
showTitle?: boolean;
|
|
346
|
+
showLabel?: boolean;
|
|
347
|
+
styles?: React$1.CSSProperties & {
|
|
348
|
+
root?: React$1.CSSProperties;
|
|
349
|
+
container?: React$1.CSSProperties;
|
|
350
|
+
input?: React$1.CSSProperties;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
declare const CustomInfo: React$1.FC<CustomInfoProps>;
|
|
354
|
+
|
|
355
|
+
interface DeliveryAddressProps {
|
|
356
|
+
showTitle?: boolean;
|
|
357
|
+
showLabel?: boolean;
|
|
358
|
+
googleApiKey?: string;
|
|
359
|
+
styles?: {
|
|
360
|
+
root?: React$1.CSSProperties;
|
|
361
|
+
container?: React$1.CSSProperties;
|
|
362
|
+
input?: React$1.CSSProperties;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
declare const DeliveryAddress: React$1.FC<DeliveryAddressProps>;
|
|
366
|
+
|
|
367
|
+
interface StripePaymentOptions {
|
|
368
|
+
layout?: LayoutObject;
|
|
369
|
+
appearance?: Appearance;
|
|
370
|
+
}
|
|
371
|
+
interface PaymentMethodsProps {
|
|
372
|
+
showText?: boolean;
|
|
373
|
+
onPaymentInfoComplete?: OnPaymentInfoCompleteCallback;
|
|
374
|
+
options?: StripePaymentOptions;
|
|
375
|
+
styles?: React$1.CSSProperties & {
|
|
376
|
+
root?: React$1.CSSProperties;
|
|
377
|
+
container?: React$1.CSSProperties;
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
declare const PaymentMethods: React$1.FC<PaymentMethodsProps>;
|
|
381
|
+
|
|
382
|
+
interface ExpressButtonsProps {
|
|
383
|
+
styles?: React$1.CSSProperties;
|
|
384
|
+
options?: StripeExpressCheckoutElementOptions;
|
|
385
|
+
onClick?: (event: StripeExpressCheckoutElementClickEvent) => void;
|
|
386
|
+
onConfirm?: (event: StripeExpressCheckoutElementConfirmEvent) => void;
|
|
387
|
+
onOrderSubmit?: OnOrderSubmitCallback;
|
|
388
|
+
onOrderCreated?: OnOrderCreatedCallback;
|
|
389
|
+
onOrderSuccess?: OnOrderSuccessCallback;
|
|
390
|
+
onOrderConfirmed?: OnOrderConfirmedCallback;
|
|
391
|
+
}
|
|
392
|
+
declare const ExpressButtons: React$1.FC<ExpressButtonsProps>;
|
|
393
|
+
|
|
348
394
|
/**
|
|
349
395
|
* Storage utility functions
|
|
350
396
|
* Provides unified interface for Cookie, LocalStorage, SessionStorage operations
|
|
@@ -403,47 +449,14 @@ declare const ClickarooProvider: React$1.FC<ClickarooProviderProps>;
|
|
|
403
449
|
interface UseCheckoutContextPublic {
|
|
404
450
|
isFormValid: () => boolean;
|
|
405
451
|
customerInfo: CustomerInfo;
|
|
406
|
-
deliveryAddress: DeliveryAddress;
|
|
452
|
+
deliveryAddress: DeliveryAddress$1;
|
|
407
453
|
isPaymentComplete: boolean;
|
|
408
454
|
cart: CartItem[];
|
|
409
455
|
updateCustomerInfo: (info: Partial<CustomerInfo>) => void;
|
|
410
|
-
updateDeliveryAddress: (address: Partial<DeliveryAddress>) => void;
|
|
456
|
+
updateDeliveryAddress: (address: Partial<DeliveryAddress$1>) => void;
|
|
411
457
|
}
|
|
412
458
|
declare const useCheckoutContextPublic: () => UseCheckoutContextPublic;
|
|
413
459
|
|
|
414
|
-
interface ThreeDSAction {
|
|
415
|
-
clientSecret: string;
|
|
416
|
-
orderCode: string;
|
|
417
|
-
tradeCode: string;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
interface OrderSubmissionResult {
|
|
421
|
-
success: boolean;
|
|
422
|
-
message: string;
|
|
423
|
-
orderCode?: string;
|
|
424
|
-
tradeCode?: string;
|
|
425
|
-
requiresAction?: boolean;
|
|
426
|
-
clientSecret?: string;
|
|
427
|
-
[key: string]: unknown;
|
|
428
|
-
}
|
|
429
|
-
interface UseOrderSubmissionOptions {
|
|
430
|
-
/** payment error callback */
|
|
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>;
|
|
438
|
-
}
|
|
439
|
-
declare const useOrderSubmission: (options?: UseOrderSubmissionOptions) => {
|
|
440
|
-
isSubmitting: boolean;
|
|
441
|
-
submitOrder: (overrides?: SubmitOrderOverrides | undefined) => Promise<OrderSubmissionResult>;
|
|
442
|
-
retryOrder: () => Promise<OrderSubmissionResult>;
|
|
443
|
-
confirmPaymentStatus: (orderCode: string, tradeCode: string) => Promise<OrderSubmissionResult>;
|
|
444
|
-
failedAdviceCode: AdviceCode | undefined;
|
|
445
|
-
};
|
|
446
|
-
|
|
447
460
|
interface UseOrderDetailReturn {
|
|
448
461
|
orderDetail: OrderDetail | null;
|
|
449
462
|
loading: boolean;
|
|
@@ -486,5 +499,5 @@ declare const getPricePointInfo: (baseUrl: string, offerPricePoints: string | st
|
|
|
486
499
|
error?: PricePointApiError;
|
|
487
500
|
}>;
|
|
488
501
|
|
|
489
|
-
export { AdviceCode, ApiClient, SubmitButton as ButtonGroup, CheckoutPage, CheckoutProvider, ClickarooProvider, CustomInfo as CustomerInfo, DeliveryAddress
|
|
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 };
|
|
502
|
+
export { AdviceCode, ApiClient, SubmitButton as ButtonGroup, CheckoutPage, CheckoutProvider, ClickarooProvider, CustomInfo as CustomerInfo, DeliveryAddress, ExpressButtons, FulfillmentStatus, OrderPaymentStatus, OrderStatus, PaymentMethods, PaymentType, RefundStatus, createOrderWithToken as createOrder, getOrderDetail, getPricePointInfo, useCheckoutContextPublic as useCheckoutContext, useClickarooParams, useOrderDetail, useOrderSubmission };
|
|
503
|
+
export type { ApiClientConfig, ApiResponse, CartItem, CheckoutCartItem, ClickarooContextType, ClickarooInfo, ClickarooPaymentStripe, ClickarooProviderConfig, ClickarooSentryConfig, ConfirmPaymentData, CreateOrderItem, CreateOrderRequest, CreateOrderResponse, CustomerInfo as CustomerInfoType, DeliveryAddress$1 as DeliveryAddressType, OnCheckoutInitCallback, OnOrderConfirmedCallback, OnOrderCreatedCallback, OnOrderSubmitCallback, OnOrderSuccessCallback, OnPaymentInfoCompleteCallback, OrderAddress, OrderApiError, OrderCustomer, OrderCustomerInfo, OrderDetail, OrderDetailMetadata, OrderItem, OrderMetadata, OrderPayment, OrderPaymentData, OrderShippingAddress, RetryPaymentData, RetryPaymentRequest, UpdateOrderRequest, UseCheckoutContextPublic as UseCheckoutContext };
|