@tagadapay/headless-sdk 1.3.2 → 1.5.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/README.md +84 -7
- package/dist/core/client.d.ts +6 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +6 -0
- package/dist/core/client.js.map +1 -1
- package/dist/core/http.js +2 -2
- package/dist/core/http.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/modules/checkout.d.ts +113 -12
- package/dist/core/modules/checkout.d.ts.map +1 -1
- package/dist/core/modules/checkout.js +201 -55
- package/dist/core/modules/checkout.js.map +1 -1
- package/dist/core/modules/payment.d.ts +120 -4
- package/dist/core/modules/payment.d.ts.map +1 -1
- package/dist/core/modules/payment.js +336 -7
- package/dist/core/modules/payment.js.map +1 -1
- package/dist/core/types.d.ts +112 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/react/hooks/useCheckout.d.ts.map +1 -1
- package/dist/react/hooks/useCheckout.js +9 -15
- package/dist/react/hooks/useCheckout.js.map +1 -1
- package/dist/react/hooks/usePayment.d.ts +58 -13
- package/dist/react/hooks/usePayment.d.ts.map +1 -1
- package/dist/react/hooks/usePayment.js +124 -11
- package/dist/react/hooks/usePayment.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/stripe/StripeExpressButton.d.ts +30 -0
- package/dist/stripe/StripeExpressButton.d.ts.map +1 -0
- package/dist/stripe/StripeExpressButton.js +32 -0
- package/dist/stripe/StripeExpressButton.js.map +1 -0
- package/dist/stripe/StripeExpressCheckout.d.ts +98 -0
- package/dist/stripe/StripeExpressCheckout.d.ts.map +1 -0
- package/dist/stripe/StripeExpressCheckout.js +198 -0
- package/dist/stripe/StripeExpressCheckout.js.map +1 -0
- package/dist/stripe/index.d.ts +8 -0
- package/dist/stripe/index.d.ts.map +1 -0
- package/dist/stripe/index.js +15 -0
- package/dist/stripe/index.js.map +1 -0
- package/dist/stripe/useStripeExpress.d.ts +54 -0
- package/dist/stripe/useStripeExpress.d.ts.map +1 -0
- package/dist/stripe/useStripeExpress.js +126 -0
- package/dist/stripe/useStripeExpress.js.map +1 -0
- package/dist/tagada-headless-react.min.js +2 -2
- package/dist/tagada-headless-react.min.js.map +3 -3
- package/dist/tagada-headless.js +483 -66
- package/dist/tagada-headless.min.js +2 -2
- package/dist/tagada-headless.min.js.map +3 -3
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -21,19 +21,40 @@ const tagada = createHeadlessClient({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Load checkout session
|
|
24
|
-
const session = await tagada.checkout.loadSession(checkoutToken);
|
|
24
|
+
const session = await tagada.checkout.loadSession(checkoutToken, sessionToken);
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// Set customer info (stored in memory, sent with address)
|
|
27
|
+
await tagada.checkout.updateCustomer(session.id, {
|
|
28
|
+
email: 'john@example.com',
|
|
29
|
+
firstName: 'John',
|
|
30
|
+
lastName: 'Doe',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Set address — customer fields are included automatically
|
|
34
|
+
await tagada.checkout.updateAddress(session.id, {
|
|
35
|
+
shippingAddress: { line1: '10 Rue de la Paix', city: 'Paris', postalCode: '75002', country: 'FR' },
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Tokenize card + pay with automatic 3DS / redirect handling
|
|
27
39
|
const { tagadaToken } = await tagada.payment.tokenizeCard({
|
|
28
40
|
cardNumber: '4242424242424242',
|
|
29
41
|
expiryDate: '12/28',
|
|
30
42
|
cvc: '123',
|
|
31
43
|
});
|
|
32
44
|
|
|
33
|
-
const result = await tagada.payment.
|
|
45
|
+
const result = await tagada.payment.processPayment({
|
|
34
46
|
checkoutSessionId: session.id,
|
|
35
47
|
tagadaToken,
|
|
36
48
|
});
|
|
49
|
+
|
|
50
|
+
if (result.status === 'succeeded') {
|
|
51
|
+
console.log('Payment succeeded!', result.order);
|
|
52
|
+
} else if (result.status === 'requires_redirect') {
|
|
53
|
+
// SDK handles this automatically in React; in vanilla JS, redirect manually:
|
|
54
|
+
window.location.href = result.redirectUrl;
|
|
55
|
+
} else if (result.status === 'failed') {
|
|
56
|
+
console.error(result.error);
|
|
57
|
+
}
|
|
37
58
|
```
|
|
38
59
|
|
|
39
60
|
## Quick Start (React)
|
|
@@ -50,19 +71,74 @@ function App() {
|
|
|
50
71
|
}
|
|
51
72
|
|
|
52
73
|
function CheckoutPage() {
|
|
53
|
-
const { session,
|
|
54
|
-
const {
|
|
74
|
+
const { session, updateCustomer, updateAddress } = useCheckout(checkoutToken, sessionToken);
|
|
75
|
+
const { processPayment, isProcessing, tokenizeCard } = usePayment({
|
|
76
|
+
onPaymentSuccess: (result) => router.push('/thank-you'),
|
|
77
|
+
onPaymentFailed: (result) => alert(result.error),
|
|
78
|
+
});
|
|
55
79
|
|
|
56
80
|
const handlePay = async () => {
|
|
81
|
+
// Customer + address (single atomic API call under the hood)
|
|
82
|
+
await updateCustomer({ email, firstName, lastName });
|
|
83
|
+
await updateAddress({ shippingAddress: { line1, city, postalCode, country } });
|
|
84
|
+
|
|
85
|
+
// Tokenize + pay — 3DS redirects and polling are handled automatically
|
|
57
86
|
const { tagadaToken } = await tokenizeCard({ cardNumber, expiryDate, cvc });
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
await processPayment({ checkoutSessionId: session.id, tagadaToken });
|
|
88
|
+
// onPaymentSuccess / onPaymentFailed callbacks fire automatically
|
|
60
89
|
};
|
|
61
90
|
|
|
62
91
|
return <button onClick={handlePay} disabled={isProcessing}>Pay Now</button>;
|
|
63
92
|
}
|
|
64
93
|
```
|
|
65
94
|
|
|
95
|
+
## Payment Flow
|
|
96
|
+
|
|
97
|
+
`processPayment()` handles the full payment lifecycle automatically:
|
|
98
|
+
|
|
99
|
+
1. **Tokenize** → creates a payment instrument from the card
|
|
100
|
+
2. **Pay** → submits payment to the processor
|
|
101
|
+
3. **3DS / Redirect** → if the bank requires authentication, the SDK redirects the user and resumes automatically on return
|
|
102
|
+
4. **Poll** → waits for async processing to complete
|
|
103
|
+
5. **Result** → returns a typed `ProcessPaymentResult`
|
|
104
|
+
|
|
105
|
+
The return type is a discriminated union:
|
|
106
|
+
|
|
107
|
+
| Status | Meaning |
|
|
108
|
+
|--------|---------|
|
|
109
|
+
| `succeeded` | Payment confirmed. Show success screen. |
|
|
110
|
+
| `requires_redirect` | User must visit a URL (3DS, bank auth). Auto-handled in React. |
|
|
111
|
+
| `failed` | Payment declined or errored. `result.error` has details. |
|
|
112
|
+
| `pending` | Still processing (rare — polling timed out). |
|
|
113
|
+
|
|
114
|
+
## Address Handling
|
|
115
|
+
|
|
116
|
+
The SDK handles both **shipped** and **digital** products:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// Shipped product — billing defaults to shipping
|
|
120
|
+
await tagada.checkout.updateAddress(sessionId, {
|
|
121
|
+
shippingAddress: { line1: '...', city: '...', country: 'FR' },
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Digital product — billing only, no shipping needed
|
|
125
|
+
await tagada.checkout.updateAddress(sessionId, {
|
|
126
|
+
billingAddress: { country: 'FR' },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Separate billing and shipping
|
|
130
|
+
await tagada.checkout.updateAddress(sessionId, {
|
|
131
|
+
shippingAddress: { line1: '...', city: '...', country: 'FR' },
|
|
132
|
+
billingAddress: { line1: '...', city: '...', country: 'DE' },
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Or use the combined method
|
|
136
|
+
await tagada.checkout.updateCustomerAndAddress(sessionId, {
|
|
137
|
+
customer: { email: 'john@example.com', firstName: 'John', lastName: 'Doe' },
|
|
138
|
+
shippingAddress: { line1: '...', city: '...', country: 'FR' },
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
66
142
|
## Modules
|
|
67
143
|
|
|
68
144
|
| Module | What it does |
|
|
@@ -96,6 +172,7 @@ A complete React checkout app is available as a live demo and open-source refere
|
|
|
96
172
|
- **Framework-agnostic core** + thin React hooks layer
|
|
97
173
|
- **TypeScript first** — full type coverage, JSDoc on every method
|
|
98
174
|
- **Optional `@tagadapay/core-js`** peer — only needed for client-side card tokenization
|
|
175
|
+
- **Automatic 3DS** — handles redirects, iframe challenges, and polling out of the box
|
|
99
176
|
|
|
100
177
|
## Package Exports
|
|
101
178
|
|
package/dist/core/client.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ import type { HeadlessConfig } from './types.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Composes all domain modules (checkout, payment, offers, customer, catalog)
|
|
11
11
|
* over a single lightweight HTTP client built on native fetch.
|
|
12
|
+
*
|
|
13
|
+
* **PCI DSS notice:** Card tokenization via `payment.tokenizeCard()` sends
|
|
14
|
+
* card data directly to Basis Theory — it never reaches TagadaPay servers.
|
|
15
|
+
* However, because card data passes through your JavaScript environment,
|
|
16
|
+
* merchants using this SDK are responsible for PCI DSS SAQ-A-EP compliance.
|
|
17
|
+
* See https://docs.tagada.io/developer-tools/headless-sdk/pci-compliance
|
|
12
18
|
*/
|
|
13
19
|
export declare class HeadlessClient {
|
|
14
20
|
readonly config: Required<Pick<HeadlessConfig, 'storeId' | 'environment'>> & HeadlessConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC,GAAG,cAAc,CAAC;IAE5F,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAElC,4EAA4E;IAC5E,OAAO,CAAC,aAAa,CAAqB;IAE1C,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAEhC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,cAAc;IA6BlC,0EAA0E;IAC1E,eAAe,CAAC,KAAK,EAAE,MAAM;CAG9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAE3E"}
|
package/dist/core/client.js
CHANGED
|
@@ -9,6 +9,12 @@ import { CatalogModule } from './modules/catalog.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Composes all domain modules (checkout, payment, offers, customer, catalog)
|
|
11
11
|
* over a single lightweight HTTP client built on native fetch.
|
|
12
|
+
*
|
|
13
|
+
* **PCI DSS notice:** Card tokenization via `payment.tokenizeCard()` sends
|
|
14
|
+
* card data directly to Basis Theory — it never reaches TagadaPay servers.
|
|
15
|
+
* However, because card data passes through your JavaScript environment,
|
|
16
|
+
* merchants using this SDK are responsible for PCI DSS SAQ-A-EP compliance.
|
|
17
|
+
* See https://docs.tagada.io/developer-tools/headless-sdk/pci-compliance
|
|
12
18
|
*/
|
|
13
19
|
export class HeadlessClient {
|
|
14
20
|
constructor(config) {
|
package/dist/core/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,cAAc;IAu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IACnE,CAAC;IAED,0EAA0E;IAC1E,eAAe,CAAC,KAAa;QAC3B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/core/http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TagadaError, TagadaAuthError, TagadaValidationError, TagadaNotFoundError, TagadaRateLimitError, TagadaNetworkError, } from './errors.js';
|
|
2
2
|
const BASE_URLS = {
|
|
3
|
-
production: 'https://
|
|
4
|
-
development: 'https://
|
|
3
|
+
production: 'https://api.tagada.io',
|
|
4
|
+
development: 'https://api.tagada.dev',
|
|
5
5
|
local: 'http://localhost:3000',
|
|
6
6
|
};
|
|
7
7
|
/**
|
package/dist/core/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,MAAM,SAAS,GAAgC;IAC7C,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,MAAM,SAAS,GAAgC;IAC7C,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AASF;;;GAGG;AACH,MAAM,OAAO,UAAU;IAMrB,YAAY,MAAwB;QAClC,IAAI,CAAC,OAAO,G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,EAAE,CAA4B,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;QAED,MAAM,GAAG,GACN,MAAM,CAAC,OAAkB;YACzB,MAAM,CAAC,KAAgB;YACxB,mBAAmB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,OAAO,IAAI,EAAE,CAAC;QAE/D,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;YACnB,KAAK,GAAG,CAAC;YACT,KAAK,GAAG;gBACN,MAAM,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;YACjC,KAAK,GAAG;gBACN,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1C,KAAK,GAAG,CAAC,CAAC,CAAC;gBACT,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;oBAC9C,CAAC,CAAE,MAAM,CAAC,MAAoD;oBAC9D,CAAC,CAAC,EAAE,CAAC;gBACP,MAAM,IAAI,qBAAqB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YACpD,CAAC;YACD,KAAK,GAAG,CAAC,CAAC,CAAC;gBACT,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC;gBACxE,MAAM,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;YAC7C,CAAC;YACD;gBACE,MAAM,IAAI,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;CACF"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export { HttpClient } from './http.js';
|
|
|
8
8
|
export { TagadaError, TagadaAuthError, TagadaValidationError, TagadaNotFoundError, TagadaRateLimitError, TagadaPaymentError, TagadaNetworkError, } from './errors.js';
|
|
9
9
|
export { GoogleAutocompleteCore, loadGoogleMapsScript, ISODataCore, AVAILABLE_LANGUAGES, CurrencyUtils, formatMoney, ensureGeoDataLoaded, getCountries, getStatesForCountry, isLanguageLoaded, } from './helpers/index.js';
|
|
10
10
|
export type { GooglePrediction, GooglePlaceDetails, ExtractedAddress, FormattedAddress, SupportedLanguage, ISOCountry, ISORegion, Country, State, Currency, } from './helpers/index.js';
|
|
11
|
-
export type { Environment, HeadlessConfig, HttpRequestOptions, LineItem, CheckoutSession, CheckoutLineItem, CheckoutTotals, CheckoutCustomer, Address, ShippingRate, PaymentMethodConfig, PaymentSetupConfig, ExpressMethod, ExpressMethods, StoreConfig, PayResult, PayOptions, PayDirectOptions, CreateInstrumentOptions, PaymentInstrument, ThreedsSession, PaymentStatus, Offer, OfferLineItem, OfferPreview, OfferPreviewItem, OfferPayResult, Customer, Order, OrderItem, Subscription, CatalogProduct, CatalogVariant, CatalogPrice, CurrencyOption, } from './types.js';
|
|
11
|
+
export type { Environment, HeadlessConfig, HttpRequestOptions, LineItem, CheckoutSession, CheckoutLineItem, CheckoutTotals, CheckoutCustomer, Address, ShippingRate, PaymentMethodConfig, PaymentSetupConfig, ExpressMethod, ExpressMethods, StoreConfig, PayResult, PayOptions, PayDirectOptions, ProcessPaymentOptions, ProcessPaymentResult, CreateInstrumentOptions, PaymentInstrument, ThreedsSession, PaymentStatus, Offer, OfferLineItem, OfferPreview, OfferPreviewItem, OfferPayResult, Customer, Order, OrderItem, Subscription, CatalogProduct, CatalogVariant, CatalogPrice, CurrencyOption, } from './types.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,OAAO,EACP,KAAK,EACL,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,KAAK,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,KAAK,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.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ACR,KAAK,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
@@ -1,27 +1,64 @@
|
|
|
1
1
|
import type { HttpClient } from '../http.js';
|
|
2
2
|
import type { CheckoutSession, LineItem, ShippingRate, Address, CheckoutCustomer } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Result returned by `updateCart()`. Mirrors the
|
|
5
|
+
* `POST /checkout-sessions/:id/line-items` payload (mutation stats, NOT
|
|
6
|
+
* a refreshed session). Call `loadSession()` to get an updated session.
|
|
7
|
+
*/
|
|
8
|
+
export interface UpdateCartResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
/** Number of existing line items updated. */
|
|
11
|
+
updated: number;
|
|
12
|
+
/** Number of new line items created. */
|
|
13
|
+
created: number;
|
|
14
|
+
/** Total number of line items in the cart after the mutation. */
|
|
15
|
+
total: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Manages checkout sessions — load, update cart, apply promo codes, handle shipping.
|
|
19
|
+
*
|
|
20
|
+
* Works for both **shipped** and **digital** products:
|
|
5
21
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
22
|
+
* **Shipped products** (physical goods):
|
|
23
|
+
* ```
|
|
24
|
+
* updateCustomer(id, { email, firstName, lastName })
|
|
25
|
+
* updateAddress(id, { shippingAddress: { line1, city, ... } })
|
|
26
|
+
* getShippingRates(id)
|
|
27
|
+
* selectShippingRate(id, rateId)
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* **Digital products** (no shipping needed):
|
|
31
|
+
* ```
|
|
32
|
+
* updateCustomer(id, { email, firstName, lastName })
|
|
33
|
+
* updateAddress(id, { billingAddress: { line1, city, country } })
|
|
34
|
+
* // Skip shipping rates — go straight to payment
|
|
35
|
+
* ```
|
|
8
36
|
*/
|
|
9
37
|
export declare class CheckoutModule {
|
|
10
38
|
private readonly http;
|
|
11
39
|
private readonly storeId;
|
|
12
40
|
private readonly onTokenChange?;
|
|
13
41
|
private sessionToken;
|
|
42
|
+
private customerEmail;
|
|
43
|
+
private customerFirstName;
|
|
44
|
+
private customerLastName;
|
|
45
|
+
private customerPhone;
|
|
14
46
|
constructor(http: HttpClient, storeId: string, onTokenChange?: ((token: string) => void) | undefined);
|
|
15
47
|
/**
|
|
16
48
|
* Load an existing checkout session by its checkout token.
|
|
17
49
|
*
|
|
18
50
|
* @param checkoutToken The checkout token (from URL param `checkoutToken`).
|
|
19
51
|
* @param sessionToken The JWT session token (from URL param `token`). Required for auth.
|
|
52
|
+
* @param opts.currency Optional presentment currency override (e.g. 'EUR').
|
|
53
|
+
* Only applied when the session has no currency set yet (first load).
|
|
54
|
+
* Once set, currency is locked to the session and this param is ignored.
|
|
20
55
|
*
|
|
21
|
-
* Both
|
|
56
|
+
* Both `checkoutToken` and `sessionToken` come from the redirect URL returned by `createSession()`.
|
|
22
57
|
* Example URL: `/checkout?checkoutToken=abc123&token=eyJ...`
|
|
23
58
|
*/
|
|
24
|
-
loadSession(checkoutToken: string, sessionToken?: string
|
|
59
|
+
loadSession(checkoutToken: string, sessionToken?: string, opts?: {
|
|
60
|
+
currency?: string;
|
|
61
|
+
}): Promise<CheckoutSession>;
|
|
25
62
|
/**
|
|
26
63
|
* Create a new checkout session.
|
|
27
64
|
*
|
|
@@ -41,34 +78,98 @@ export declare class CheckoutModule {
|
|
|
41
78
|
sessionToken: string;
|
|
42
79
|
customerId: string;
|
|
43
80
|
}>;
|
|
44
|
-
/** Replace the cart items for an existing session. */
|
|
45
|
-
updateCart(sessionId: string, items: LineItem[]): Promise<CheckoutSession>;
|
|
46
81
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
82
|
+
* Replace the cart items for an existing session.
|
|
83
|
+
*
|
|
84
|
+
* Returns a server-side mutation summary (counts of created/updated rows).
|
|
85
|
+
* It does NOT return the updated `CheckoutSession` — the underlying
|
|
86
|
+
* `POST /checkout-sessions/:id/line-items` endpoint never has and the
|
|
87
|
+
* previous typing was a lie that quietly assigned `{ success, updated, ... }`
|
|
88
|
+
* into a `CheckoutSession` slot in `useCheckout`.
|
|
89
|
+
*
|
|
90
|
+
* Call `loadSession()` after this if you need the refreshed session
|
|
91
|
+
* (the React `useCheckout` hook does this for you).
|
|
92
|
+
*/
|
|
93
|
+
updateCart(sessionId: string, items: LineItem[]): Promise<UpdateCartResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Update customer identity (email, name, phone).
|
|
96
|
+
*
|
|
97
|
+
* Call this before `updateAddress()` — the SDK remembers the values and
|
|
98
|
+
* includes them automatically when addresses are submitted.
|
|
99
|
+
*
|
|
100
|
+
* If you prefer a single call, use `updateCustomerAndAddress()` instead.
|
|
49
101
|
*/
|
|
50
102
|
updateCustomer(sessionId: string, customer: Partial<CheckoutCustomer>): Promise<void>;
|
|
51
103
|
/**
|
|
52
104
|
* Update shipping and/or billing address on the session.
|
|
53
105
|
*
|
|
54
|
-
*
|
|
106
|
+
* Automatically includes customer name/phone stored from `updateCustomer()`.
|
|
107
|
+
* Uses the same atomic API call as the production checkout, so email,
|
|
108
|
+
* customer name, and addresses are all persisted together.
|
|
109
|
+
*
|
|
110
|
+
* **Shipped products**: pass `shippingAddress`. If `billingAddress` is omitted,
|
|
111
|
+
* the shipping address is automatically used as billing.
|
|
112
|
+
*
|
|
113
|
+
* **Digital products**: pass only `billingAddress` (no shipping needed).
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // Shipped product — billing = shipping automatically
|
|
117
|
+
* await checkout.updateAddress(sessionId, {
|
|
118
|
+
* shippingAddress: { line1: '10 Rue de la Paix', city: 'Paris', postalCode: '75002', country: 'FR' },
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* // Digital product — billing only
|
|
123
|
+
* await checkout.updateAddress(sessionId, {
|
|
124
|
+
* billingAddress: { country: 'FR' },
|
|
125
|
+
* });
|
|
55
126
|
*/
|
|
56
127
|
updateAddress(sessionId: string, addresses: {
|
|
57
128
|
shippingAddress?: Address;
|
|
58
129
|
billingAddress?: Address;
|
|
59
130
|
}): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Set customer info + addresses in one call (mirrors production checkout).
|
|
133
|
+
*
|
|
134
|
+
* Equivalent to calling `updateCustomer()` then `updateAddress()`, but
|
|
135
|
+
* in a single network request.
|
|
136
|
+
*/
|
|
137
|
+
updateCustomerAndAddress(sessionId: string, data: {
|
|
138
|
+
customer: Partial<CheckoutCustomer>;
|
|
139
|
+
shippingAddress?: Address;
|
|
140
|
+
billingAddress?: Address;
|
|
141
|
+
}): Promise<void>;
|
|
142
|
+
/** Map an SDK Address to the API shape, injecting stored customer fields. */
|
|
143
|
+
private mapAddress;
|
|
60
144
|
/** Apply a promotion code to the session. */
|
|
61
145
|
applyPromoCode(sessionId: string, code: string): Promise<void>;
|
|
62
146
|
/** Remove a promotion from the session by promotion ID. */
|
|
63
147
|
removePromoCode(sessionId: string, promotionId?: string): Promise<void>;
|
|
64
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Fetch available shipping rates for the session's address.
|
|
150
|
+
* Only relevant for **shipped products** — digital products can skip this step.
|
|
151
|
+
*
|
|
152
|
+
* Requires a shipping address to be set first via `updateAddress()`.
|
|
153
|
+
* Returns an empty array if no rates are configured or address is missing.
|
|
154
|
+
*/
|
|
65
155
|
getShippingRates(sessionId: string): Promise<ShippingRate[]>;
|
|
66
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Select a shipping rate for the session.
|
|
158
|
+
* Only relevant for **shipped products** — digital products can skip this step.
|
|
159
|
+
*/
|
|
67
160
|
selectShippingRate(sessionId: string, rateId: string): Promise<void>;
|
|
68
161
|
/**
|
|
69
162
|
* Normalize the raw v2 API response into a cleaner CheckoutSession shape.
|
|
70
163
|
* The raw response has nested `checkoutSession` + `summary` -- we flatten it.
|
|
71
164
|
*/
|
|
72
165
|
private normalizeSession;
|
|
166
|
+
/**
|
|
167
|
+
* Map the raw API address shape (`address1`, `address2`, `postal`) onto
|
|
168
|
+
* the SDK's `Address` shape (`line1`, `line2`, `postalCode`). Without
|
|
169
|
+
* this, `session.shippingAddress.line1` is silently undefined after a
|
|
170
|
+
* reload — the type was lying about the actual key names — which is
|
|
171
|
+
* what makes the demo lose form state on refresh.
|
|
172
|
+
*/
|
|
173
|
+
private normalizeAddress;
|
|
73
174
|
}
|
|
74
175
|
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../src/core/modules/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../src/core/modules/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,cAAc;IAQvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IATjC,OAAO,CAAC,YAAY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