@sazito/checkout 0.1.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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/chunks/labels-BlMZkOsV.cjs +1646 -0
- package/dist/chunks/labels-BlMZkOsV.cjs.map +1 -0
- package/dist/chunks/labels-ChywPk2i.js +1613 -0
- package/dist/chunks/labels-ChywPk2i.js.map +1 -0
- package/dist/chunks/use-checkout-Cvp_K3UW.cjs +69 -0
- package/dist/chunks/use-checkout-Cvp_K3UW.cjs.map +1 -0
- package/dist/chunks/use-checkout-E0O8HsSs.js +63 -0
- package/dist/chunks/use-checkout-E0O8HsSs.js.map +1 -0
- package/dist/core/index.cjs +40 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +482 -0
- package/dist/core/index.d.ts +482 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/next/index.cjs +845 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +427 -0
- package/dist/next/index.d.ts +427 -0
- package/dist/next/index.js +834 -0
- package/dist/next/index.js.map +1 -0
- package/dist/react/index.cjs +17 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +376 -0
- package/dist/react/index.d.ts +376 -0
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -0
- package/dist/styles.css +1696 -0
- package/package.json +98 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { ReactNode, ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
|
|
3
|
+
import { Cart, Invoice, ApplicableShippingMethods, InvoiceItem, ShippingRate, PaymentMethod, Order } from '@sazito/client-sdk';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checkout domain types.
|
|
7
|
+
*
|
|
8
|
+
* The package re-exports the SDK data models (camelCase) and layers
|
|
9
|
+
* checkout-specific state, config, events and effects on top.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** How a discount code changes the order. */
|
|
13
|
+
type DiscountKind = 'percentage' | 'fixed_amount' | 'free_shipping' | 'unknown';
|
|
14
|
+
/**
|
|
15
|
+
* A successfully applied discount code with its detected type. The API only
|
|
16
|
+
* reports discount codes as totals on the invoice, so the type is inferred by
|
|
17
|
+
* `classifyAppliedDiscount` (selectors) — `unknown` when nothing measurable
|
|
18
|
+
* changed yet (e.g. a free-shipping code applied before a rate is selected).
|
|
19
|
+
*/
|
|
20
|
+
interface AppliedDiscount {
|
|
21
|
+
code: string;
|
|
22
|
+
kind: DiscountKind;
|
|
23
|
+
/** Amount taken off the items total by this code. */
|
|
24
|
+
amount: number;
|
|
25
|
+
/** Percentage discounts only: the detected integer percent. */
|
|
26
|
+
percent?: number;
|
|
27
|
+
/** Shipping cost removed by the code. */
|
|
28
|
+
shippingSaved?: number;
|
|
29
|
+
}
|
|
30
|
+
/** Regions are not re-exported by the SDK top level; mirror the shape here. */
|
|
31
|
+
interface CheckoutCity {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
}
|
|
37
|
+
interface CheckoutRegion {
|
|
38
|
+
id: number;
|
|
39
|
+
name: string;
|
|
40
|
+
cities: CheckoutCity[];
|
|
41
|
+
}
|
|
42
|
+
type CheckoutLocale = 'fa' | 'en';
|
|
43
|
+
type CheckoutDirection = 'rtl' | 'ltr';
|
|
44
|
+
/** Interactive steps in order. `result` is the terminal post-payment screen. */
|
|
45
|
+
type CheckoutStep = 'cart' | 'shipping' | 'payment' | 'result';
|
|
46
|
+
/** Coarse engine status used to drive spinners / disabled states. */
|
|
47
|
+
type CheckoutStatus = 'idle' | 'bootstrapping' | 'working' | 'redirecting' | 'polling' | 'error';
|
|
48
|
+
type CheckoutResultStatus = 'success' | 'failed' | 'pending' | 'stock_violated';
|
|
49
|
+
interface CheckoutTheme {
|
|
50
|
+
/** Primary accent (buttons, active states). CSS color. */
|
|
51
|
+
accent?: string;
|
|
52
|
+
/** Foreground used on top of the accent. CSS color. */
|
|
53
|
+
accentForeground?: string;
|
|
54
|
+
/** Soft accent surface used for selected rows and focus-adjacent states. */
|
|
55
|
+
accentSoft?: string;
|
|
56
|
+
/** Checkout page background. */
|
|
57
|
+
background?: string;
|
|
58
|
+
/** Primary text color. */
|
|
59
|
+
foreground?: string;
|
|
60
|
+
/** Muted surface background. */
|
|
61
|
+
muted?: string;
|
|
62
|
+
/** Secondary text color. */
|
|
63
|
+
mutedForeground?: string;
|
|
64
|
+
/** Borders and dividers. */
|
|
65
|
+
border?: string;
|
|
66
|
+
/** Form, product, and shipping card background. */
|
|
67
|
+
card?: string;
|
|
68
|
+
/** Order-summary sidebar background. */
|
|
69
|
+
summaryBackground?: string;
|
|
70
|
+
/** Error and destructive-state color. */
|
|
71
|
+
danger?: string;
|
|
72
|
+
/** Success and completed-state color. */
|
|
73
|
+
success?: string;
|
|
74
|
+
/** Base corner radius in px. */
|
|
75
|
+
radius?: number;
|
|
76
|
+
/** Font family. Defaults to `inherit` so the host font flows through. */
|
|
77
|
+
fontFamily?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Seed credentials so checkout can attach to an already-built cart. */
|
|
80
|
+
interface CheckoutCredentials {
|
|
81
|
+
cart?: {
|
|
82
|
+
id?: number;
|
|
83
|
+
identifier: string;
|
|
84
|
+
};
|
|
85
|
+
invoice?: {
|
|
86
|
+
id: number;
|
|
87
|
+
identifier: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface CheckoutConfig {
|
|
91
|
+
locale?: CheckoutLocale;
|
|
92
|
+
direction?: CheckoutDirection;
|
|
93
|
+
theme?: CheckoutTheme;
|
|
94
|
+
/** URL for the "continue shopping" / back-to-store action. */
|
|
95
|
+
continueShoppingUrl?: string;
|
|
96
|
+
/** URL the gateway returns to after payment. Defaults to current URL. */
|
|
97
|
+
returnUrl?: string;
|
|
98
|
+
/** Pending-payment poll interval in ms (default 15000). */
|
|
99
|
+
pollIntervalMs?: number;
|
|
100
|
+
/** Currency label override (defaults per-locale). */
|
|
101
|
+
currencyLabel?: string;
|
|
102
|
+
onEvent?: (event: CheckoutEvent) => void;
|
|
103
|
+
}
|
|
104
|
+
/** The guest contact + address form. */
|
|
105
|
+
interface AddressFormValues {
|
|
106
|
+
firstName: string;
|
|
107
|
+
lastName: string;
|
|
108
|
+
mobilePhone: string;
|
|
109
|
+
email: string;
|
|
110
|
+
phoneNumber: string;
|
|
111
|
+
regionId: number | null;
|
|
112
|
+
cityId: number | null;
|
|
113
|
+
postalCode: string;
|
|
114
|
+
address: string;
|
|
115
|
+
description: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A shippable group: a set of invoice items shipped together, with the rates
|
|
119
|
+
* the customer can switch between and the currently selected rate.
|
|
120
|
+
*/
|
|
121
|
+
interface ShippingGroup {
|
|
122
|
+
key: string;
|
|
123
|
+
title: string;
|
|
124
|
+
itemIds: Array<number | string>;
|
|
125
|
+
items: InvoiceItem[];
|
|
126
|
+
rates: ShippingRate[];
|
|
127
|
+
selectedRateId: number | null;
|
|
128
|
+
}
|
|
129
|
+
interface CheckoutResult {
|
|
130
|
+
status: CheckoutResultStatus;
|
|
131
|
+
order?: Order;
|
|
132
|
+
message?: string;
|
|
133
|
+
}
|
|
134
|
+
interface CheckoutError {
|
|
135
|
+
message: string;
|
|
136
|
+
code?: CheckoutErrorCode;
|
|
137
|
+
status?: number;
|
|
138
|
+
step?: CheckoutStep;
|
|
139
|
+
}
|
|
140
|
+
type CheckoutErrorCode = 'no_cart' | 'no_invoice' | 'min_basket' | 'rate_limited' | 'cart_invalid' | 'invoice_locked' | 'stock_violated' | 'shipping_required' | 'address_required' | 'payment_failed' | 'network' | 'validation' | 'unknown';
|
|
141
|
+
/** Per-region async flags so the UI can show targeted spinners. */
|
|
142
|
+
interface CheckoutFlags {
|
|
143
|
+
bootstrapping: boolean;
|
|
144
|
+
updatingCart: boolean;
|
|
145
|
+
savingAddress: boolean;
|
|
146
|
+
loadingShipping: boolean;
|
|
147
|
+
selectingRate: boolean;
|
|
148
|
+
applyingDiscount: boolean;
|
|
149
|
+
loadingPayments: boolean;
|
|
150
|
+
placingOrder: boolean;
|
|
151
|
+
}
|
|
152
|
+
interface CheckoutState {
|
|
153
|
+
step: CheckoutStep;
|
|
154
|
+
status: CheckoutStatus;
|
|
155
|
+
locale: CheckoutLocale;
|
|
156
|
+
direction: CheckoutDirection;
|
|
157
|
+
cart: Cart | null;
|
|
158
|
+
invoice: Invoice | null;
|
|
159
|
+
regions: CheckoutRegion[];
|
|
160
|
+
addressForm: AddressFormValues;
|
|
161
|
+
/** Shop-level requirement loaded from the checkout configuration. */
|
|
162
|
+
postalCodeMandatory: boolean;
|
|
163
|
+
/** Shop-level requirement loaded from the checkout configuration. */
|
|
164
|
+
emailMandatory: boolean;
|
|
165
|
+
/** Whether the saved address on the invoice matches the current form. */
|
|
166
|
+
addressDirty: boolean;
|
|
167
|
+
applicable: ApplicableShippingMethods | null;
|
|
168
|
+
shippingGroups: ShippingGroup[];
|
|
169
|
+
paymentMethods: PaymentMethod[];
|
|
170
|
+
selectedPaymentMethodId: number | null;
|
|
171
|
+
discountCode: string;
|
|
172
|
+
appliedDiscountCode: string | null;
|
|
173
|
+
/** Type + saved amounts of the applied code; null when no code is applied. */
|
|
174
|
+
appliedDiscount: AppliedDiscount | null;
|
|
175
|
+
/** Inline error for the discount field; not shown in the global banner. */
|
|
176
|
+
discountError: string | null;
|
|
177
|
+
result: CheckoutResult | null;
|
|
178
|
+
error: CheckoutError | null;
|
|
179
|
+
flags: CheckoutFlags;
|
|
180
|
+
}
|
|
181
|
+
type CheckoutEventName = 'checkout_viewed' | 'step_viewed' | 'address_submitted' | 'shipping_rate_selected' | 'discount_applied' | 'discount_removed' | 'payment_method_selected' | 'payment_initiated' | 'payment_succeeded' | 'payment_failed' | 'payment_pending';
|
|
182
|
+
interface CheckoutEvent {
|
|
183
|
+
name: CheckoutEventName;
|
|
184
|
+
step?: CheckoutStep;
|
|
185
|
+
value?: number;
|
|
186
|
+
metadata?: Record<string, unknown>;
|
|
187
|
+
timestamp: number;
|
|
188
|
+
}
|
|
189
|
+
/** Public command surface exposed to UI bindings. */
|
|
190
|
+
interface CheckoutActions {
|
|
191
|
+
/** Load cart + invoice and derive initial state. */
|
|
192
|
+
start(): Promise<void>;
|
|
193
|
+
goToStep(step: CheckoutStep): void;
|
|
194
|
+
next(): Promise<void>;
|
|
195
|
+
back(): void;
|
|
196
|
+
/** Cart review edits — update a line quantity or remove a line. */
|
|
197
|
+
updateItemQuantity(cartProductId: number | string, variantId: number, quantity: number): Promise<void>;
|
|
198
|
+
removeItem(cartProductId: number | string, variantId: number): Promise<void>;
|
|
199
|
+
setAddressField<K extends keyof AddressFormValues>(key: K, value: AddressFormValues[K]): void;
|
|
200
|
+
submitAddress(): Promise<boolean>;
|
|
201
|
+
selectShippingRate(groupKey: string, rateId: number): Promise<void>;
|
|
202
|
+
setDiscountCode(code: string): void;
|
|
203
|
+
applyDiscount(): Promise<void>;
|
|
204
|
+
removeDiscount(): Promise<void>;
|
|
205
|
+
selectPaymentMethod(id: number): void;
|
|
206
|
+
placeOrder(): Promise<void>;
|
|
207
|
+
/** Resolve a return from the payment gateway (query params from the URL). */
|
|
208
|
+
resolvePaymentReturn(params: Record<string, string>): Promise<void>;
|
|
209
|
+
reset(): void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* UI strings (fa/en) and domain label helpers (payment gateways, shipping).
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
interface Strings {
|
|
217
|
+
stepCart: string;
|
|
218
|
+
stepShipping: string;
|
|
219
|
+
stepPayment: string;
|
|
220
|
+
stepReview: string;
|
|
221
|
+
stepResult: string;
|
|
222
|
+
/** Mobile header title for the shipping step. */
|
|
223
|
+
stepShippingInfo: string;
|
|
224
|
+
/** Mobile header progress, e.g. "مرحله ۲ از ۳" / "Step 2 of 3". */
|
|
225
|
+
stepOf: (current: string, total: string) => string;
|
|
226
|
+
next: string;
|
|
227
|
+
placeOrder: string;
|
|
228
|
+
saveShippingDetails: string;
|
|
229
|
+
continueToPayment: string;
|
|
230
|
+
finalizeOrder: string;
|
|
231
|
+
finishPurchase: string;
|
|
232
|
+
back: string;
|
|
233
|
+
continueShopping: string;
|
|
234
|
+
orderSummary: string;
|
|
235
|
+
subtotal: string;
|
|
236
|
+
shipping: string;
|
|
237
|
+
discount: string;
|
|
238
|
+
credit: string;
|
|
239
|
+
vat: string;
|
|
240
|
+
total: string;
|
|
241
|
+
totalAmount: string;
|
|
242
|
+
free: string;
|
|
243
|
+
quantity: string;
|
|
244
|
+
optional: string;
|
|
245
|
+
cartTitle: string;
|
|
246
|
+
cartEmpty: string;
|
|
247
|
+
cartEmptyHint: string;
|
|
248
|
+
remove: string;
|
|
249
|
+
itemDiscount: (amount: string) => string;
|
|
250
|
+
yourSavings: string;
|
|
251
|
+
contactInfo: string;
|
|
252
|
+
firstName: string;
|
|
253
|
+
lastName: string;
|
|
254
|
+
mobilePhone: string;
|
|
255
|
+
email: string;
|
|
256
|
+
phoneNumber: string;
|
|
257
|
+
region: string;
|
|
258
|
+
city: string;
|
|
259
|
+
postalCode: string;
|
|
260
|
+
addressLine: string;
|
|
261
|
+
description: string;
|
|
262
|
+
selectRegion: string;
|
|
263
|
+
selectCity: string;
|
|
264
|
+
shippingMethod: string;
|
|
265
|
+
shippingMethods: string;
|
|
266
|
+
shippingMethodsHint: string;
|
|
267
|
+
digitalNoShipping: string;
|
|
268
|
+
errorRequired: string;
|
|
269
|
+
errorMobilePhone: string;
|
|
270
|
+
errorEmail: string;
|
|
271
|
+
changeTo: string;
|
|
272
|
+
productCount: (n: string) => string;
|
|
273
|
+
paymentMethod: string;
|
|
274
|
+
discountCode: string;
|
|
275
|
+
discountPlaceholder: string;
|
|
276
|
+
apply: string;
|
|
277
|
+
applied: string;
|
|
278
|
+
discountPercentOff: (percent: string) => string;
|
|
279
|
+
discountAmountOff: (amount: string) => string;
|
|
280
|
+
discountFreeShipping: string;
|
|
281
|
+
reviewTitle: string;
|
|
282
|
+
reviewContact: string;
|
|
283
|
+
reviewAddress: string;
|
|
284
|
+
reviewShipping: string;
|
|
285
|
+
reviewPayment: string;
|
|
286
|
+
payNow: string;
|
|
287
|
+
edit: string;
|
|
288
|
+
paymentSuccess: string;
|
|
289
|
+
paymentFailed: string;
|
|
290
|
+
paymentPending: string;
|
|
291
|
+
paymentPendingHint: string;
|
|
292
|
+
orderNumber: string;
|
|
293
|
+
tryAgain: string;
|
|
294
|
+
loading: string;
|
|
295
|
+
processing: string;
|
|
296
|
+
redirecting: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Pure derivations over invoice / shipping data: shipping groups, summary
|
|
301
|
+
* lines, address form mapping and validation. No SDK calls, no side-effects.
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
type SummaryLineKey = 'subtotal' | 'discount' | 'shipping' | 'credit' | 'vat';
|
|
305
|
+
interface SummaryLine {
|
|
306
|
+
key: SummaryLineKey;
|
|
307
|
+
amount: number;
|
|
308
|
+
negative?: boolean;
|
|
309
|
+
free?: boolean;
|
|
310
|
+
/** Discount line only: amount as a percentage of subtotal (rounded). */
|
|
311
|
+
percent?: number;
|
|
312
|
+
}
|
|
313
|
+
interface CheckoutSummary {
|
|
314
|
+
lines: SummaryLine[];
|
|
315
|
+
total: number;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** Props passed to renderNextButton / renderBackButton. */
|
|
319
|
+
interface RenderButtonProps {
|
|
320
|
+
/** Whether the action is in-flight (show a loading indicator). */
|
|
321
|
+
loading: boolean;
|
|
322
|
+
/** Whether the button should be inert (validation not met). */
|
|
323
|
+
disabled: boolean;
|
|
324
|
+
/** Trigger the checkout action for this button. */
|
|
325
|
+
onClick: () => void;
|
|
326
|
+
/** Localised label for the current step. */
|
|
327
|
+
children: ReactNode;
|
|
328
|
+
}
|
|
329
|
+
interface RenderEmptyCartProps$1 {
|
|
330
|
+
continueShoppingUrl?: string;
|
|
331
|
+
}
|
|
332
|
+
interface SazitoCheckoutProps {
|
|
333
|
+
theme?: CheckoutTheme;
|
|
334
|
+
continueShoppingUrl?: string;
|
|
335
|
+
className?: string;
|
|
336
|
+
renderNextButton?: (props: RenderButtonProps) => ReactNode;
|
|
337
|
+
renderBackButton?: (props: RenderButtonProps) => ReactNode;
|
|
338
|
+
renderEmptyCart?: (props: RenderEmptyCartProps$1) => ReactNode;
|
|
339
|
+
}
|
|
340
|
+
declare function SazitoCheckout({ theme, continueShoppingUrl, className, renderNextButton, renderBackButton, renderEmptyCart, }: SazitoCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
341
|
+
|
|
342
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
343
|
+
variant?: 'primary' | 'outline' | 'ghost';
|
|
344
|
+
block?: boolean;
|
|
345
|
+
loading?: boolean;
|
|
346
|
+
asChild?: boolean;
|
|
347
|
+
}
|
|
348
|
+
declare function Button({ variant, block, loading, asChild, className, children, disabled, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
349
|
+
interface SpinnerProps {
|
|
350
|
+
asChild?: boolean;
|
|
351
|
+
className?: string;
|
|
352
|
+
children?: ReactNode;
|
|
353
|
+
}
|
|
354
|
+
declare function Spinner({ asChild, className, children }?: SpinnerProps): react_jsx_runtime.JSX.Element;
|
|
355
|
+
interface ProductPlaceholderProps {
|
|
356
|
+
asChild?: boolean;
|
|
357
|
+
className?: string;
|
|
358
|
+
children?: ReactNode;
|
|
359
|
+
}
|
|
360
|
+
declare function ProductPlaceholder({ asChild, className, children }?: ProductPlaceholderProps): react_jsx_runtime.JSX.Element;
|
|
361
|
+
interface FieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
362
|
+
label: string;
|
|
363
|
+
error?: string;
|
|
364
|
+
optionalLabel?: string;
|
|
365
|
+
asChild?: boolean;
|
|
366
|
+
}
|
|
367
|
+
declare function Field({ label, id, className, error, required, optionalLabel, asChild, children, ...rest }: FieldProps): react_jsx_runtime.JSX.Element;
|
|
368
|
+
interface SectionTitleProps {
|
|
369
|
+
children: ReactNode;
|
|
370
|
+
asChild?: boolean;
|
|
371
|
+
className?: string;
|
|
372
|
+
}
|
|
373
|
+
declare function SectionTitle({ children, asChild, className }: SectionTitleProps): react_jsx_runtime.JSX.Element;
|
|
374
|
+
interface ErrorBannerProps {
|
|
375
|
+
message: string;
|
|
376
|
+
asChild?: boolean;
|
|
377
|
+
children?: ReactNode;
|
|
378
|
+
className?: string;
|
|
379
|
+
}
|
|
380
|
+
declare function ErrorBanner({ message, asChild, children, className }: ErrorBannerProps): react_jsx_runtime.JSX.Element;
|
|
381
|
+
|
|
382
|
+
interface RenderEmptyCartProps {
|
|
383
|
+
continueShoppingUrl?: string;
|
|
384
|
+
}
|
|
385
|
+
interface SazitoCheckoutPageProps {
|
|
386
|
+
credentials?: CheckoutCredentials;
|
|
387
|
+
config?: CheckoutConfig;
|
|
388
|
+
paymentReturnParams?: Record<string, string>;
|
|
389
|
+
className?: string;
|
|
390
|
+
renderNextButton?: (props: RenderButtonProps) => React.ReactNode;
|
|
391
|
+
renderBackButton?: (props: RenderButtonProps) => React.ReactNode;
|
|
392
|
+
renderEmptyCart?: (props: RenderEmptyCartProps) => React.ReactNode;
|
|
393
|
+
}
|
|
394
|
+
declare function SazitoCheckoutPage({ credentials, config, paymentReturnParams, className, renderNextButton, renderBackButton, renderEmptyCart, }: SazitoCheckoutPageProps): react_jsx_runtime.JSX.Element;
|
|
395
|
+
|
|
396
|
+
interface CheckoutProviderProps {
|
|
397
|
+
/** Override the SazitoProvider client for this checkout instance only. */
|
|
398
|
+
client?: unknown;
|
|
399
|
+
credentials?: CheckoutCredentials;
|
|
400
|
+
config?: CheckoutConfig;
|
|
401
|
+
autoStart?: boolean;
|
|
402
|
+
children: ReactNode;
|
|
403
|
+
}
|
|
404
|
+
declare function CheckoutProvider({ client: clientProp, credentials, config, autoStart, children }: CheckoutProviderProps): react_jsx_runtime.JSX.Element;
|
|
405
|
+
|
|
406
|
+
interface UseCheckout {
|
|
407
|
+
state: CheckoutState;
|
|
408
|
+
actions: CheckoutActions;
|
|
409
|
+
/** Localized UI strings. */
|
|
410
|
+
t: Strings;
|
|
411
|
+
/** Format an amount with the currency label for the active locale. */
|
|
412
|
+
money(value: number): string;
|
|
413
|
+
/** Like `money`, but renders 0 as "Free". */
|
|
414
|
+
price(value: number): string;
|
|
415
|
+
summary: CheckoutSummary;
|
|
416
|
+
digitalItems: InvoiceItem[];
|
|
417
|
+
}
|
|
418
|
+
declare function useCheckout(): UseCheckout;
|
|
419
|
+
|
|
420
|
+
interface SazitoProviderProps {
|
|
421
|
+
client: unknown;
|
|
422
|
+
children: ReactNode;
|
|
423
|
+
}
|
|
424
|
+
declare function SazitoProvider({ client, children }: SazitoProviderProps): react_jsx_runtime.JSX.Element;
|
|
425
|
+
|
|
426
|
+
export { Button, CheckoutProvider, ErrorBanner, Field, ProductPlaceholder, SazitoCheckout, SazitoCheckoutPage, SazitoProvider, SectionTitle, Spinner, useCheckout };
|
|
427
|
+
export type { ButtonProps, CheckoutProviderProps, ErrorBannerProps, FieldProps, ProductPlaceholderProps, RenderButtonProps, RenderEmptyCartProps as RenderEmptyCartPageProps, RenderEmptyCartProps$1 as RenderEmptyCartProps, SazitoCheckoutPageProps, SazitoCheckoutProps, SazitoProviderProps, SectionTitleProps, SpinnerProps };
|