@tagadapay/headless-sdk 1.6.0 → 1.8.0-rc.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 +1 -186
- package/package.json +6 -11
- package/dist/core/client.d.ts +0 -54
- package/dist/core/client.d.ts.map +0 -1
- package/dist/core/client.js +0 -67
- package/dist/core/client.js.map +0 -1
- package/dist/core/errors.d.ts +0 -46
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -57
- package/dist/core/errors.js.map +0 -1
- package/dist/core/helpers/autocomplete.d.ts +0 -89
- package/dist/core/helpers/autocomplete.d.ts.map +0 -1
- package/dist/core/helpers/autocomplete.js +0 -186
- package/dist/core/helpers/autocomplete.js.map +0 -1
- package/dist/core/helpers/countries.d.ts +0 -45
- package/dist/core/helpers/countries.d.ts.map +0 -1
- package/dist/core/helpers/countries.js +0 -65
- package/dist/core/helpers/countries.js.map +0 -1
- package/dist/core/helpers/currency.d.ts +0 -26
- package/dist/core/helpers/currency.d.ts.map +0 -1
- package/dist/core/helpers/currency.js +0 -72
- package/dist/core/helpers/currency.js.map +0 -1
- package/dist/core/helpers/index.d.ts +0 -5
- package/dist/core/helpers/index.d.ts.map +0 -1
- package/dist/core/helpers/index.js +0 -5
- package/dist/core/helpers/index.js.map +0 -1
- package/dist/core/helpers/iso3166.d.ts +0 -28
- package/dist/core/helpers/iso3166.d.ts.map +0 -1
- package/dist/core/helpers/iso3166.js +0 -84
- package/dist/core/helpers/iso3166.js.map +0 -1
- package/dist/core/http.d.ts +0 -27
- package/dist/core/http.d.ts.map +0 -1
- package/dist/core/http.js +0 -116
- package/dist/core/http.js.map +0 -1
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -11
- package/dist/core/index.js.map +0 -1
- package/dist/core/modules/catalog.d.ts +0 -27
- package/dist/core/modules/catalog.d.ts.map +0 -1
- package/dist/core/modules/catalog.js +0 -38
- package/dist/core/modules/catalog.js.map +0 -1
- package/dist/core/modules/checkout.d.ts +0 -249
- package/dist/core/modules/checkout.d.ts.map +0 -1
- package/dist/core/modules/checkout.js +0 -448
- package/dist/core/modules/checkout.js.map +0 -1
- package/dist/core/modules/customer.d.ts +0 -33
- package/dist/core/modules/customer.d.ts.map +0 -1
- package/dist/core/modules/customer.js +0 -53
- package/dist/core/modules/customer.js.map +0 -1
- package/dist/core/modules/offers.d.ts +0 -137
- package/dist/core/modules/offers.d.ts.map +0 -1
- package/dist/core/modules/offers.js +0 -141
- package/dist/core/modules/offers.js.map +0 -1
- package/dist/core/modules/payment.d.ts +0 -298
- package/dist/core/modules/payment.d.ts.map +0 -1
- package/dist/core/modules/payment.js +0 -701
- package/dist/core/modules/payment.js.map +0 -1
- package/dist/core/types.d.ts +0 -460
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -5
- package/dist/core/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/hooks/useCatalog.d.ts +0 -25
- package/dist/react/hooks/useCatalog.d.ts.map +0 -1
- package/dist/react/hooks/useCatalog.js +0 -58
- package/dist/react/hooks/useCatalog.js.map +0 -1
- package/dist/react/hooks/useCheckout.d.ts +0 -58
- package/dist/react/hooks/useCheckout.d.ts.map +0 -1
- package/dist/react/hooks/useCheckout.js +0 -168
- package/dist/react/hooks/useCheckout.js.map +0 -1
- package/dist/react/hooks/useCustomer.d.ts +0 -28
- package/dist/react/hooks/useCustomer.d.ts.map +0 -1
- package/dist/react/hooks/useCustomer.js +0 -77
- package/dist/react/hooks/useCustomer.js.map +0 -1
- package/dist/react/hooks/useGoogleAutocomplete.d.ts +0 -26
- package/dist/react/hooks/useGoogleAutocomplete.d.ts.map +0 -1
- package/dist/react/hooks/useGoogleAutocomplete.js +0 -70
- package/dist/react/hooks/useGoogleAutocomplete.js.map +0 -1
- package/dist/react/hooks/useISOData.d.ts +0 -23
- package/dist/react/hooks/useISOData.d.ts.map +0 -1
- package/dist/react/hooks/useISOData.js +0 -63
- package/dist/react/hooks/useISOData.js.map +0 -1
- package/dist/react/hooks/useOffers.d.ts +0 -134
- package/dist/react/hooks/useOffers.d.ts.map +0 -1
- package/dist/react/hooks/useOffers.js +0 -171
- package/dist/react/hooks/useOffers.js.map +0 -1
- package/dist/react/hooks/usePayment.d.ts +0 -108
- package/dist/react/hooks/usePayment.d.ts.map +0 -1
- package/dist/react/hooks/usePayment.js +0 -233
- package/dist/react/hooks/usePayment.js.map +0 -1
- package/dist/react/index.d.ts +0 -20
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -11
- package/dist/react/index.js.map +0 -1
- package/dist/react/internal/redirectGuard.d.ts +0 -9
- package/dist/react/internal/redirectGuard.d.ts.map +0 -1
- package/dist/react/internal/redirectGuard.js +0 -25
- package/dist/react/internal/redirectGuard.js.map +0 -1
- package/dist/react/provider.d.ts +0 -31
- package/dist/react/provider.d.ts.map +0 -1
- package/dist/react/provider.js +0 -32
- package/dist/react/provider.js.map +0 -1
- package/dist/stripe/StripeExpressButton.d.ts +0 -30
- package/dist/stripe/StripeExpressButton.d.ts.map +0 -1
- package/dist/stripe/StripeExpressButton.js +0 -32
- package/dist/stripe/StripeExpressButton.js.map +0 -1
- package/dist/stripe/StripeExpressCheckout.d.ts +0 -98
- package/dist/stripe/StripeExpressCheckout.d.ts.map +0 -1
- package/dist/stripe/StripeExpressCheckout.js +0 -198
- package/dist/stripe/StripeExpressCheckout.js.map +0 -1
- package/dist/stripe/index.d.ts +0 -8
- package/dist/stripe/index.d.ts.map +0 -1
- package/dist/stripe/index.js +0 -15
- package/dist/stripe/index.js.map +0 -1
- package/dist/stripe/useStripeExpress.d.ts +0 -54
- package/dist/stripe/useStripeExpress.d.ts.map +0 -1
- package/dist/stripe/useStripeExpress.js +0 -126
- package/dist/stripe/useStripeExpress.js.map +0 -1
- package/dist/tagada-headless-react.min.js +0 -8
- package/dist/tagada-headless-react.min.js.map +0 -7
- package/dist/tagada-headless.js +0 -2070
- package/dist/tagada-headless.min.js +0 -8
- package/dist/tagada-headless.min.js.map +0 -7
package/README.md
CHANGED
|
@@ -1,186 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Use TagadaPay as a **headless checkout and CRM backend** from any website — React, Vue, vanilla JS, or plain HTML. Zero runtime dependencies in core.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @tagadapay/headless-sdk
|
|
9
|
-
# Optional: for card tokenization
|
|
10
|
-
npm install @tagadapay/core-js
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Quick Start (Vanilla JS)
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { createHeadlessClient } from '@tagadapay/headless-sdk';
|
|
17
|
-
|
|
18
|
-
const tagada = createHeadlessClient({
|
|
19
|
-
storeId: 'store_abc123',
|
|
20
|
-
environment: 'production',
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Load checkout session
|
|
24
|
-
const session = await tagada.checkout.loadSession(checkoutToken, sessionToken);
|
|
25
|
-
|
|
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
|
|
39
|
-
const { tagadaToken } = await tagada.payment.tokenizeCard({
|
|
40
|
-
cardNumber: '4242424242424242',
|
|
41
|
-
expiryDate: '12/28',
|
|
42
|
-
cvc: '123',
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const result = await tagada.payment.processPayment({
|
|
46
|
-
checkoutSessionId: session.id,
|
|
47
|
-
tagadaToken,
|
|
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
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Quick Start (React)
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
import { TagadaHeadlessProvider, useCheckout, usePayment } from '@tagadapay/headless-sdk/react';
|
|
64
|
-
|
|
65
|
-
function App() {
|
|
66
|
-
return (
|
|
67
|
-
<TagadaHeadlessProvider storeId="store_abc123" environment="production">
|
|
68
|
-
<CheckoutPage />
|
|
69
|
-
</TagadaHeadlessProvider>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function CheckoutPage() {
|
|
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
|
-
});
|
|
79
|
-
|
|
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
|
|
86
|
-
const { tagadaToken } = await tokenizeCard({ cardNumber, expiryDate, cvc });
|
|
87
|
-
await processPayment({ checkoutSessionId: session.id, tagadaToken });
|
|
88
|
-
// onPaymentSuccess / onPaymentFailed callbacks fire automatically
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return <button onClick={handlePay} disabled={isProcessing}>Pay Now</button>;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
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
|
-
|
|
142
|
-
## Modules
|
|
143
|
-
|
|
144
|
-
| Module | What it does |
|
|
145
|
-
|--------|-------------|
|
|
146
|
-
| `tagada.checkout` | Session management — load, update cart, promo codes, shipping |
|
|
147
|
-
| `tagada.payment` | Full payment lifecycle — APMs, tokenize, 3DS, pay, poll, express checkout |
|
|
148
|
-
| `tagada.offers` | Upsells & order bumps — preview, pay, post-purchase accept/decline |
|
|
149
|
-
| `tagada.customer` | CRM data — profile, orders, subscriptions |
|
|
150
|
-
| `tagada.catalog` | Product browsing — list products, variants, prices |
|
|
151
|
-
|
|
152
|
-
## CDN Usage
|
|
153
|
-
|
|
154
|
-
```html
|
|
155
|
-
<script src="https://cdn.jsdelivr.net/npm/@tagadapay/headless-sdk/dist/tagada-headless.min.js"></script>
|
|
156
|
-
<script>
|
|
157
|
-
const tagada = TagadaHeadless.create({ storeId: 'store_abc123' });
|
|
158
|
-
</script>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Example
|
|
162
|
-
|
|
163
|
-
A complete React checkout app is available as a live demo and open-source reference:
|
|
164
|
-
|
|
165
|
-
- **Live demo**: [headless-react-eta.vercel.app](https://headless-react-eta.vercel.app)
|
|
166
|
-
- **Source code**: [github.com/TagadaPay/examples/tree/main/headless-react](https://github.com/TagadaPay/examples/tree/main/headless-react)
|
|
167
|
-
|
|
168
|
-
## Architecture
|
|
169
|
-
|
|
170
|
-
- **Zero dependencies** in core — native `fetch`, no axios
|
|
171
|
-
- **Tree-shakeable ESM** — unused modules are eliminated by bundlers
|
|
172
|
-
- **Framework-agnostic core** + thin React hooks layer
|
|
173
|
-
- **TypeScript first** — full type coverage, JSDoc on every method
|
|
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
|
|
176
|
-
|
|
177
|
-
## Package Exports
|
|
178
|
-
|
|
179
|
-
| Import path | What you get |
|
|
180
|
-
|------------|--------------|
|
|
181
|
-
| `@tagadapay/headless-sdk` | Core client + all modules |
|
|
182
|
-
| `@tagadapay/headless-sdk/react` | React hooks + provider |
|
|
183
|
-
|
|
184
|
-
## License
|
|
185
|
-
|
|
186
|
-
MIT
|
|
1
|
+
test
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagadapay/headless-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-rc.0",
|
|
4
4
|
"description": "Headless SDK for using TagadaPay as a checkout, offers, and CRM backend from any external website",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/core/index.js",
|
|
@@ -18,14 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"
|
|
22
|
-
"build:types": "tsc",
|
|
23
|
-
"build:cdn": "node build-cdn.js",
|
|
24
|
-
"clean": "rm -rf dist",
|
|
25
|
-
"dev": "tsc --watch",
|
|
26
|
-
"lint": "echo \"No linting configured\"",
|
|
27
|
-
"test": "echo \"No tests yet\" && exit 0",
|
|
28
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
21
|
+
"prepublishOnly": "echo skip"
|
|
29
22
|
},
|
|
30
23
|
"keywords": [
|
|
31
24
|
"tagadapay",
|
|
@@ -45,7 +38,8 @@
|
|
|
45
38
|
"@types/node": "^18.0.0",
|
|
46
39
|
"@types/react": "^19",
|
|
47
40
|
"esbuild": "^0.20.0",
|
|
48
|
-
"typescript": "^5.0.0"
|
|
41
|
+
"typescript": "^5.0.0",
|
|
42
|
+
"vitest": "^3.2.4"
|
|
49
43
|
},
|
|
50
44
|
"peerDependencies": {
|
|
51
45
|
"@stripe/stripe-js": "^7.0.0 || ^8.0.0",
|
|
@@ -64,7 +58,8 @@
|
|
|
64
58
|
}
|
|
65
59
|
},
|
|
66
60
|
"files": [
|
|
67
|
-
"dist
|
|
61
|
+
"dist/index.js",
|
|
62
|
+
"dist/index.d.ts",
|
|
68
63
|
"README.md"
|
|
69
64
|
],
|
|
70
65
|
"repository": {
|
package/dist/core/client.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { CheckoutModule } from './modules/checkout.js';
|
|
2
|
-
import { PaymentModule } from './modules/payment.js';
|
|
3
|
-
import { OffersModule } from './modules/offers.js';
|
|
4
|
-
import { CustomerModule } from './modules/customer.js';
|
|
5
|
-
import { CatalogModule } from './modules/catalog.js';
|
|
6
|
-
import type { HeadlessConfig } from './types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Main entry point for the TagadaPay Headless SDK.
|
|
9
|
-
*
|
|
10
|
-
* Composes all domain modules (checkout, payment, offers, customer, catalog)
|
|
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
|
|
18
|
-
*/
|
|
19
|
-
export declare class HeadlessClient {
|
|
20
|
-
readonly config: Required<Pick<HeadlessConfig, 'storeId' | 'environment'>> & HeadlessConfig;
|
|
21
|
-
private readonly http;
|
|
22
|
-
/** Shared session token used by all modules for authenticated API calls. */
|
|
23
|
-
private _sessionToken;
|
|
24
|
-
/** Checkout session management -- load, update cart, apply promos, shipping. */
|
|
25
|
-
readonly checkout: CheckoutModule;
|
|
26
|
-
/** Payment processing -- setup config, APMs, tokenize, pay, 3DS, poll. */
|
|
27
|
-
readonly payment: PaymentModule;
|
|
28
|
-
/** Offers -- preview, pay, accept/decline upsells and order bumps. */
|
|
29
|
-
readonly offers: OffersModule;
|
|
30
|
-
/** Customer data -- profile, orders, subscriptions. */
|
|
31
|
-
readonly customer: CustomerModule;
|
|
32
|
-
/** Product catalog -- list products, variants, and prices. */
|
|
33
|
-
readonly catalog: CatalogModule;
|
|
34
|
-
constructor(config: HeadlessConfig);
|
|
35
|
-
/** Manually set the session token (e.g. from URL params on page load). */
|
|
36
|
-
setSessionToken(token: string): void;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create a new HeadlessClient instance.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* import { createHeadlessClient } from '@tagadapay/headless-sdk';
|
|
44
|
-
*
|
|
45
|
-
* const tagada = createHeadlessClient({
|
|
46
|
-
* storeId: 'store_abc123',
|
|
47
|
-
* environment: 'production',
|
|
48
|
-
* });
|
|
49
|
-
*
|
|
50
|
-
* const session = await tagada.checkout.loadSession(checkoutToken);
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare function createHeadlessClient(config: HeadlessConfig): HeadlessClient;
|
|
54
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from './http.js';
|
|
2
|
-
import { CheckoutModule } from './modules/checkout.js';
|
|
3
|
-
import { PaymentModule } from './modules/payment.js';
|
|
4
|
-
import { OffersModule } from './modules/offers.js';
|
|
5
|
-
import { CustomerModule } from './modules/customer.js';
|
|
6
|
-
import { CatalogModule } from './modules/catalog.js';
|
|
7
|
-
/**
|
|
8
|
-
* Main entry point for the TagadaPay Headless SDK.
|
|
9
|
-
*
|
|
10
|
-
* Composes all domain modules (checkout, payment, offers, customer, catalog)
|
|
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
|
|
18
|
-
*/
|
|
19
|
-
export class HeadlessClient {
|
|
20
|
-
constructor(config) {
|
|
21
|
-
const environment = config.environment ?? 'production';
|
|
22
|
-
const baseUrl = HttpClient.resolveBaseUrl(environment, config.baseUrl);
|
|
23
|
-
this.config = {
|
|
24
|
-
...config,
|
|
25
|
-
environment,
|
|
26
|
-
baseUrl,
|
|
27
|
-
timeout: config.timeout ?? 30000,
|
|
28
|
-
};
|
|
29
|
-
this.http = new HttpClient({
|
|
30
|
-
baseUrl,
|
|
31
|
-
timeout: this.config.timeout,
|
|
32
|
-
apiKey: config.apiKey,
|
|
33
|
-
getToken: () => this._sessionToken,
|
|
34
|
-
});
|
|
35
|
-
const setToken = (token) => {
|
|
36
|
-
this._sessionToken = token;
|
|
37
|
-
};
|
|
38
|
-
this.checkout = new CheckoutModule(this.http, this.config.storeId, setToken);
|
|
39
|
-
this.payment = new PaymentModule(this.http, this.config.storeId, environment);
|
|
40
|
-
this.offers = new OffersModule(this.http, this.config.storeId, this.payment);
|
|
41
|
-
this.customer = new CustomerModule(this.http, this.config.storeId);
|
|
42
|
-
this.catalog = new CatalogModule(this.http, this.config.storeId);
|
|
43
|
-
}
|
|
44
|
-
/** Manually set the session token (e.g. from URL params on page load). */
|
|
45
|
-
setSessionToken(token) {
|
|
46
|
-
this._sessionToken = token;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Create a new HeadlessClient instance.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* import { createHeadlessClient } from '@tagadapay/headless-sdk';
|
|
55
|
-
*
|
|
56
|
-
* const tagada = createHeadlessClient({
|
|
57
|
-
* storeId: 'store_abc123',
|
|
58
|
-
* environment: 'production',
|
|
59
|
-
* });
|
|
60
|
-
*
|
|
61
|
-
* const session = await tagada.checkout.loadSession(checkoutToken);
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export function createHeadlessClient(config) {
|
|
65
|
-
return new HeadlessClient(config);
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=client.js.map
|
package/dist/core/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;IAuBzB,YAAY,MAAsB;QAChC,MAAM,WAAW,GAAgB,MAAM,CAAC,WAAW,IAAI,YAAY,CAAC;QACpE,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAEvE,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,MAAM;YACT,WAAW;YACX,OAAO;YACP,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAM;SAClC,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC;YACzB,OAAO;YACP,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAQ;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa;SACnC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;YACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC9E,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;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/errors.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** Base error for all TagadaPay headless SDK errors. */
|
|
2
|
-
export declare class TagadaError extends Error {
|
|
3
|
-
readonly code: string;
|
|
4
|
-
readonly statusCode?: number;
|
|
5
|
-
readonly details?: Record<string, unknown>;
|
|
6
|
-
constructor(message: string, code: string, statusCode?: number, details?: Record<string, unknown>);
|
|
7
|
-
}
|
|
8
|
-
/** Thrown when the API returns 401/403. */
|
|
9
|
-
export declare class TagadaAuthError extends TagadaError {
|
|
10
|
-
constructor(message?: string);
|
|
11
|
-
}
|
|
12
|
-
/** Thrown when the API returns 422 with validation errors. */
|
|
13
|
-
export declare class TagadaValidationError extends TagadaError {
|
|
14
|
-
readonly errors: Array<{
|
|
15
|
-
field: string;
|
|
16
|
-
message: string;
|
|
17
|
-
}>;
|
|
18
|
-
constructor(message: string, errors?: Array<{
|
|
19
|
-
field: string;
|
|
20
|
-
message: string;
|
|
21
|
-
}>);
|
|
22
|
-
}
|
|
23
|
-
/** Thrown when a resource is not found (404). */
|
|
24
|
-
export declare class TagadaNotFoundError extends TagadaError {
|
|
25
|
-
constructor(resource: string, id: string);
|
|
26
|
-
}
|
|
27
|
-
/** Thrown when the API returns 429. */
|
|
28
|
-
export declare class TagadaRateLimitError extends TagadaError {
|
|
29
|
-
readonly retryAfterMs: number;
|
|
30
|
-
constructor(retryAfterMs?: number);
|
|
31
|
-
}
|
|
32
|
-
/** Thrown when a payment fails or requires action. */
|
|
33
|
-
export declare class TagadaPaymentError extends TagadaError {
|
|
34
|
-
readonly paymentId?: string;
|
|
35
|
-
readonly requireAction?: string;
|
|
36
|
-
constructor(message: string, opts?: {
|
|
37
|
-
paymentId?: string;
|
|
38
|
-
requireAction?: string;
|
|
39
|
-
details?: Record<string, unknown>;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/** Thrown on network / fetch failures. */
|
|
43
|
-
export declare class TagadaNetworkError extends TagadaError {
|
|
44
|
-
constructor(message?: string);
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,qBAAa,WAAY,SAAQ,KAA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F;AAED,0CAA0C;AAC1C,qBAAa,kBAAmB,SAAQ,WAAW;gBACrC,OAAO,SAAmD;CAIvE"}
|
package/dist/core/errors.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/** Base error for all TagadaPay headless SDK errors. */
|
|
2
|
-
export class TagadaError extends Error {
|
|
3
|
-
constructor(message, code, statusCode, details) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.name = 'TagadaError';
|
|
6
|
-
this.code = code;
|
|
7
|
-
this.statusCode = statusCode;
|
|
8
|
-
this.details = details;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/** Thrown when the API returns 401/403. */
|
|
12
|
-
export class TagadaAuthError extends TagadaError {
|
|
13
|
-
constructor(message = 'Authentication failed. Check your API key or checkout token.') {
|
|
14
|
-
super(message, 'auth_error', 401);
|
|
15
|
-
this.name = 'TagadaAuthError';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/** Thrown when the API returns 422 with validation errors. */
|
|
19
|
-
export class TagadaValidationError extends TagadaError {
|
|
20
|
-
constructor(message, errors = []) {
|
|
21
|
-
super(message, 'validation_error', 422, { errors });
|
|
22
|
-
this.name = 'TagadaValidationError';
|
|
23
|
-
this.errors = errors;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/** Thrown when a resource is not found (404). */
|
|
27
|
-
export class TagadaNotFoundError extends TagadaError {
|
|
28
|
-
constructor(resource, id) {
|
|
29
|
-
super(`${resource} "${id}" not found.`, 'not_found', 404);
|
|
30
|
-
this.name = 'TagadaNotFoundError';
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/** Thrown when the API returns 429. */
|
|
34
|
-
export class TagadaRateLimitError extends TagadaError {
|
|
35
|
-
constructor(retryAfterMs = 1000) {
|
|
36
|
-
super(`Rate limited. Retry after ${retryAfterMs}ms.`, 'rate_limit', 429);
|
|
37
|
-
this.name = 'TagadaRateLimitError';
|
|
38
|
-
this.retryAfterMs = retryAfterMs;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/** Thrown when a payment fails or requires action. */
|
|
42
|
-
export class TagadaPaymentError extends TagadaError {
|
|
43
|
-
constructor(message, opts) {
|
|
44
|
-
super(message, 'payment_error', undefined, opts?.details);
|
|
45
|
-
this.name = 'TagadaPaymentError';
|
|
46
|
-
this.paymentId = opts?.paymentId;
|
|
47
|
-
this.requireAction = opts?.requireAction;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/** Thrown on network / fetch failures. */
|
|
51
|
-
export class TagadaNetworkError extends TagadaError {
|
|
52
|
-
constructor(message = 'Network request failed. Check your connection.') {
|
|
53
|
-
super(message, 'network_error');
|
|
54
|
-
this.name = 'TagadaNetworkError';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/core/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,OAAO,WAAY,SAAQ,KAAK;IAKpC,YACE,OAAe,EACf,IAAY,EACZ,UAAmB,EACnB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,2CAA2C;AAC3C,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,YAAY,OAAO,GAAG,8DAA8D;QAClF,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,8DAA8D;AAC9D,MAAM,OAAO,qBAAsB,SAAQ,WAAW;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oB,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Google Places Autocomplete — script injection + address extraction.
|
|
3
|
-
* Works standalone (no external dependencies beyond the Google Maps JS API).
|
|
4
|
-
*/
|
|
5
|
-
declare global {
|
|
6
|
-
interface Window {
|
|
7
|
-
google?: {
|
|
8
|
-
maps?: {
|
|
9
|
-
places?: {
|
|
10
|
-
AutocompleteService: new () => any;
|
|
11
|
-
PlacesService: new (el: any) => any;
|
|
12
|
-
PlacesServiceStatus: {
|
|
13
|
-
OK: string;
|
|
14
|
-
ZERO_RESULTS: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
Map: new (el: HTMLElement) => any;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export interface GooglePrediction {
|
|
23
|
-
place_id: string;
|
|
24
|
-
description: string;
|
|
25
|
-
structured_formatting?: {
|
|
26
|
-
main_text: string;
|
|
27
|
-
secondary_text: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface GooglePlaceDetails {
|
|
31
|
-
place_id: string;
|
|
32
|
-
formatted_address: string;
|
|
33
|
-
address_components: Array<{
|
|
34
|
-
long_name: string;
|
|
35
|
-
short_name: string;
|
|
36
|
-
types: string[];
|
|
37
|
-
}>;
|
|
38
|
-
geometry?: {
|
|
39
|
-
location: {
|
|
40
|
-
lat: number;
|
|
41
|
-
lng: number;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export interface ExtractedAddress {
|
|
46
|
-
subpremise: string;
|
|
47
|
-
streetNumber: string;
|
|
48
|
-
route: string;
|
|
49
|
-
locality: string;
|
|
50
|
-
administrativeAreaLevel1: string;
|
|
51
|
-
administrativeAreaLevel1Long: string;
|
|
52
|
-
administrativeAreaLevel2: string;
|
|
53
|
-
administrativeAreaLevel2Long: string;
|
|
54
|
-
country: string;
|
|
55
|
-
postalCode: string;
|
|
56
|
-
fullStreetAddress: string;
|
|
57
|
-
}
|
|
58
|
-
export interface FormattedAddress {
|
|
59
|
-
address1: string;
|
|
60
|
-
city: string;
|
|
61
|
-
country: string;
|
|
62
|
-
state: string;
|
|
63
|
-
postal: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Inject the Google Maps JS SDK into the page (idempotent).
|
|
67
|
-
* Resolves once `window.google.maps.places` is available.
|
|
68
|
-
*/
|
|
69
|
-
export declare function loadGoogleMapsScript(apiKey: string, opts?: {
|
|
70
|
-
language?: string;
|
|
71
|
-
region?: string;
|
|
72
|
-
version?: string;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
export declare class GoogleAutocompleteCore {
|
|
75
|
-
/** Search for address predictions. */
|
|
76
|
-
static searchPlaces(input: string, options?: {
|
|
77
|
-
types?: string[];
|
|
78
|
-
componentRestrictions?: {
|
|
79
|
-
country: string;
|
|
80
|
-
};
|
|
81
|
-
}): Promise<GooglePrediction[]>;
|
|
82
|
-
/** Get full place details by place_id. */
|
|
83
|
-
static getPlaceDetails(placeId: string): Promise<GooglePlaceDetails | null>;
|
|
84
|
-
/** Extract structured address fields from a Google PlaceDetails result. */
|
|
85
|
-
static extractAddressComponents(place: GooglePlaceDetails): ExtractedAddress;
|
|
86
|
-
/** Shorthand: extract into the flat shape used by address forms. */
|
|
87
|
-
static extractFormattedAddress(place: GooglePlaceDetails): FormattedAddress;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/autocomplete.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,CAAC,EAAE;YACP,IAAI,CAAC,EAAE;gBACL,MAAM,CAAC,EAAE;oBACP,mBAAmB,EAAE,UAAU,GA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