@tagadapay/plugin-sdk 1.0.30 → 2.0.1

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 CHANGED
@@ -1,414 +1,546 @@
1
- # TagadaPay Plugin SDK
2
-
3
- A comprehensive SDK for building checkout plugins on the TagadaPay platform. Create custom checkout experiences with React components, payment processing, and advanced features.
4
-
5
- ## 📚 Documentation
6
-
7
- ### Core APIs
8
-
9
- - **[useCheckout](./README-useCheckout.md)** - Checkout state management and flow control
10
- - **[setCheckoutInfo](./README-setCheckoutInfo.md)** - Customer information and validation
11
- - **[useOffers](./README-useOffers.md)** - Dynamic pricing and promotional offers
12
- - **[Money utilities](./README-money.md)** - Currency formatting and calculations
13
- - **[URL utilities](./README-urlUtils.md)** - Navigation and routing helpers
14
-
15
- ### Examples
16
-
17
- - **[Vite Checkout Demo](../checkout-vite)** - Complete checkout implementation
18
-
19
- ## 🚀 Quick Start
20
-
21
- ### Installation
22
-
23
- ```bash
24
- npm install @tagadapay/plugin-sdk
25
- ```
26
-
27
- ### Basic Usage
28
-
29
- ```typescript
30
- import { useCheckout, setCheckoutInfo } from '@tagadapay/plugin-sdk';
31
-
32
- function CheckoutPage() {
33
- const { customer, cart, payment } = useCheckout();
34
-
35
- const handleSubmit = async (data) => {
36
- await setCheckoutInfo({
37
- customer: data.customer,
38
- payment: data.payment
39
- });
40
- };
41
-
42
- return (
43
- <div>
44
- {/* Your checkout UI */}
45
- </div>
46
- );
47
- }
48
- ```
49
-
50
- ## 🎯 Key Features
51
-
52
- ### Payment Processing
53
-
54
- - Secure tokenized payments
55
- - Multiple payment method support
56
- - Real-time validation
57
- - PCI compliance
58
-
59
- ### Customer Management
60
-
61
- - Profile management
62
- - Address validation
63
- - Order history
64
- - Preferences
65
-
66
- ### Cart & Pricing
67
-
68
- - Dynamic pricing
69
- - Promotional offers
70
- - Tax calculations
71
- - Currency conversion
72
-
73
- ### UI Components
74
-
75
- - Pre-built checkout components
76
- - Customizable themes
77
- - Mobile-optimized
78
- - Accessibility features
79
-
80
- ## 📖 API Reference
81
-
82
- ### Core Hooks
83
-
84
- #### useCheckout()
85
-
86
- Primary hook for checkout state management.
87
-
88
- ```typescript
89
- const {
90
- customer, // Customer information
91
- cart, // Shopping cart state
92
- payment, // Payment details
93
- shipping, // Shipping information
94
- loading, // Loading states
95
- errors, // Error handling
96
- } = useCheckout();
97
- ```
98
-
99
- #### useOffers()
100
-
101
- Hook for managing dynamic offers and pricing.
102
-
103
- ```typescript
104
- const {
105
- offers, // Available offers
106
- applyOffer, // Apply offer function
107
- removeOffer, // Remove offer function
108
- total, // Calculated total
109
- } = useOffers();
110
- ```
111
-
112
- ### Utility Functions
113
-
114
- #### setCheckoutInfo()
115
-
116
- Update checkout information with validation.
117
-
118
- ```typescript
119
- await setCheckoutInfo({
120
- customer: {
121
- email: 'user@example.com',
122
- firstName: 'John',
123
- lastName: 'Doe',
124
- },
125
- payment: {
126
- method: 'card',
127
- token: 'pm_token_123',
128
- },
129
- });
130
- ```
131
-
132
- #### Money utilities
133
-
134
- Format and calculate monetary values.
135
-
136
- ```typescript
137
- import { formatMoney, convertCurrency } from '@tagadapay/plugin-sdk';
138
-
139
- const formatted = formatMoney(2999, 'USD'); // "$29.99"
140
- const converted = convertCurrency(2999, 'USD', 'EUR'); // 2699
141
- ```
142
-
143
- ## 🛠️ Development
144
-
145
- ### Local Development
146
-
147
- ```bash
148
- # Install dependencies
149
- npm install
150
-
151
- # Start development server
152
- npm run dev
153
-
154
- # Build for production
155
- npm run build
156
- ```
157
-
158
- ### Testing
159
-
160
- ```bash
161
- # Run tests
162
- npm test
163
-
164
- # Run tests with coverage
165
- npm run test:coverage
166
- ```
167
-
168
- ### Linting
169
-
170
- ```bash
171
- # Check code style
172
- npm run lint
173
-
174
- # Fix linting issues
175
- npm run lint:fix
176
- ```
177
-
178
- ## 📦 Build & Deploy
179
-
180
- ### Building Your Plugin
181
-
182
- ```bash
183
- # Build optimized bundle
184
- npm run build
185
-
186
- # Analyze bundle size
187
- npm run analyze
188
- ```
189
-
190
- ### Deployment
191
-
192
- ```bash
193
- # Deploy using TagadaPay CLI
194
- npx @tagadapay/plugin-cli deploy
195
-
196
- # Deploy specific environment
197
- npx @tagadapay/plugin-cli deploy --env production
198
- ```
199
-
200
- ## 🔧 Configuration
201
-
202
- ### Plugin Configuration
203
-
204
- ```json
205
- {
206
- "name": "My Checkout Plugin",
207
- "version": "1.0.0",
208
- "description": "Custom checkout experience",
209
- "main": "dist/index.js",
210
- "tagadapay": {
211
- "type": "checkout",
212
- "mode": "direct",
213
- "framework": "react"
214
- }
215
- }
216
- ```
217
-
218
- ### Environment Variables
219
-
220
- ```env
221
- TAGADAPAY_API_KEY=your_api_key
222
- TAGADAPAY_ENVIRONMENT=sandbox
223
- TAGADAPAY_STORE_ID=your_store_id
224
- ```
225
-
226
- ## 🎨 Styling & Themes
227
-
228
- ### CSS Custom Properties
229
-
230
- ```css
231
- :root {
232
- --tagada-primary: #007bff;
233
- --tagada-secondary: #6c757d;
234
- --tagada-success: #28a745;
235
- --tagada-danger: #dc3545;
236
- --tagada-border-radius: 4px;
237
- --tagada-font-family: -apple-system, BlinkMacSystemFont, sans-serif;
238
- }
239
- ```
240
-
241
- ### Component Styling
242
-
243
- ```typescript
244
- import { styled } from '@tagadapay/plugin-sdk';
245
-
246
- const StyledButton = styled.button`
247
- background: var(--tagada-primary);
248
- color: white;
249
- border-radius: var(--tagada-border-radius);
250
- padding: 12px 24px;
251
- border: none;
252
- cursor: pointer;
253
-
254
- &:hover {
255
- opacity: 0.9;
256
- }
257
- `;
258
- ```
259
-
260
- ## 🔐 Security
261
-
262
- ### Best Practices
263
-
264
- - Never store sensitive payment data
265
- - Always validate user inputs
266
- - Use HTTPS in production
267
- - Implement proper error handling
268
- - Follow PCI DSS guidelines
269
-
270
- ### Token Management
271
-
272
- ```typescript
273
- // ✅ Good: Use tokenized payments
274
- const paymentToken = await tokenizePayment(cardData);
275
- await processPayment({ token: paymentToken });
276
-
277
- // Bad: Never store raw card data
278
- // const cardNumber = '4111111111111111'; // Don't do this
279
- ```
280
-
281
- ## 📱 Mobile Optimization
282
-
283
- ### Responsive Design
284
-
285
- ```css
286
- .checkout-container {
287
- max-width: 600px;
288
- margin: 0 auto;
289
- padding: 16px;
290
- }
291
-
292
- @media (max-width: 768px) {
293
- .checkout-container {
294
- padding: 8px;
295
- }
296
-
297
- .checkout-form {
298
- font-size: 16px; /* Prevent zoom on iOS */
299
- }
300
- }
301
- ```
302
-
303
- ### Touch Interactions
304
-
305
- ```typescript
306
- const handleTouchStart = (e) => {
307
- // Optimize for touch devices
308
- e.preventDefault();
309
- // Handle touch interaction
310
- };
311
- ```
312
-
313
- ## 🌐 Internationalization
314
-
315
- ### Multi-language Support
316
-
317
- ```typescript
318
- import { useTranslation } from '@tagadapay/plugin-sdk';
319
-
320
- function CheckoutForm() {
321
- const { t } = useTranslation();
322
-
323
- return (
324
- <form>
325
- <label>{t('checkout.email')}</label>
326
- <input type="email" placeholder={t('checkout.email_placeholder')} />
327
- </form>
328
- );
329
- }
330
- ```
331
-
332
- ### Currency Support
333
-
334
- ```typescript
335
- import { useCurrency } from '@tagadapay/plugin-sdk';
336
-
337
- function PriceDisplay({ amount }) {
338
- const { formatPrice, currency } = useCurrency();
339
-
340
- return <span>{formatPrice(amount, currency)}</span>;
341
- }
342
- ```
343
-
344
- ## 📊 Analytics & Monitoring
345
-
346
- ### Event Tracking
347
-
348
- ```typescript
349
- import { trackEvent } from '@tagadapay/plugin-sdk';
350
-
351
- // Track user interactions
352
- trackEvent('checkout_started', {
353
- product_id: 'prod_123',
354
- value: 2999,
355
- currency: 'USD',
356
- });
357
-
358
- // Track conversions
359
- trackEvent('purchase_completed', {
360
- transaction_id: 'txn_456',
361
- value: 2999,
362
- currency: 'USD',
363
- });
364
- ```
365
-
366
- ### Performance Monitoring
367
-
368
- ```typescript
369
- import { performance } from '@tagadapay/plugin-sdk';
370
-
371
- // Measure load times
372
- performance.mark('checkout-start');
373
- // ... checkout logic
374
- performance.mark('checkout-end');
375
- performance.measure('checkout-duration', 'checkout-start', 'checkout-end');
376
- ```
377
-
378
- ## 🤝 Contributing
379
-
380
- ### Development Setup
381
-
382
- ```bash
383
- # Clone the repository
384
- git clone https://github.com/tagadapay/plugin-sdk.git
385
-
386
- # Install dependencies
387
- npm install
388
-
389
- # Start development
390
- npm run dev
391
- ```
392
-
393
- ### Submitting Changes
394
-
395
- 1. Fork the repository
396
- 2. Create a feature branch
397
- 3. Make your changes
398
- 4. Add tests
399
- 5. Submit a pull request
400
-
401
- ## 📄 License
402
-
403
- MIT License - see [LICENSE](./LICENSE) for details.
404
-
405
- ## 🆘 Support
406
-
407
- - **Documentation**: [docs.tagadapay.com](https://docs.tagadapay.com)
408
- - **Discord**: [discord.gg/tagadapay](https://discord.gg/tagadapay)
409
- - **Email**: support@tagadapay.com
410
- - **GitHub Issues**: [github.com/tagadapay/plugin-sdk/issues](https://github.com/tagadapay/plugin-sdk/issues)
411
-
412
- ---
413
-
414
- Built with ❤️ by the TagadaPay team
1
+ # TagadaPay Plugin SDK
2
+
3
+ A comprehensive SDK for building checkout plugins on the TagadaPay platform. Create custom checkout experiences with React components, payment processing, and advanced features.
4
+
5
+ ## 📚 Documentation
6
+
7
+ ### Core APIs
8
+
9
+ - **[useCheckout](./docs/README-useCheckout.md)** - Checkout state management and flow control
10
+ - **[setCheckoutInfo](./docs/README-setCheckoutInfo.md)** - Customer information and validation
11
+ - **[useOffers](./docs/README-useOffers.md)** - Dynamic pricing and promotional offers
12
+ - **[Money utilities](./docs/README-money.md)** - Currency formatting and calculations
13
+ - **[URL utilities](./docs/README-urlUtils.md)** - Navigation and routing helpers
14
+
15
+ ### Plugin Development
16
+
17
+ - **[Plugin Configuration](./docs/PLUGIN_CONFIG.md)** - How to access store context, config, and branding
18
+ - **[Google Autocomplete](./docs/README-google-autocomplete.md)** - Address autocomplete with Google Places API
19
+ - **[ISO Data](./docs/README-iso-data.md)** - Country and region data with Google integration
20
+
21
+ ### Examples
22
+
23
+ - **[Vite Checkout Demo](../checkout-vite)** - Complete checkout implementation
24
+
25
+ ## 🏗️ Building a Plugin
26
+
27
+ ### Plugin Structure
28
+
29
+ Every TagadaPay plugin follows this simple structure:
30
+
31
+ ```
32
+ my-plugin/
33
+ ├── plugin.manifest.json # Plugin metadata & routing
34
+ ├── .local.json # Local dev config (auto-injected in production)
35
+ ├── config/ # Optional deployment configs
36
+ │ ├── theme-green.json # Config variant A
37
+ │ └── theme-blue.json # Config variant B
38
+ ├── src/
39
+ │ └── App.tsx # Your plugin code
40
+ └── dist/ # Built plugin files
41
+ ```
42
+
43
+ ### Configuration Flow
44
+
45
+ ```mermaid
46
+ graph TD
47
+ A[🛠️ Local Development] --> B[.local.json]
48
+ A --> C[config/*.json]
49
+ B --> D[usePluginConfig()]
50
+ C --> D
51
+
52
+ E[🚀 Production] --> F[Platform Injection]
53
+ F --> G[HTTP Headers & Meta Tags]
54
+ G --> D
55
+
56
+ D --> H[Your Plugin Component]
57
+
58
+ style A fill:#e1f5fe
59
+ style E fill:#f3e5f5
60
+ style D fill:#fff3e0
61
+ style H fill:#e8f5e8
62
+ ```
63
+
64
+ ### Essential Files
65
+
66
+ #### 1. **`plugin.manifest.json`** - Plugin Metadata
67
+
68
+ ```json
69
+ {
70
+ "pluginId": "my-awesome-plugin",
71
+ "name": "My Awesome Plugin",
72
+ "version": "1.0.0",
73
+ "mode": "direct-mode",
74
+ "router": {
75
+ "basePath": "/",
76
+ "matcher": ".*",
77
+ "excluder": "/checkout"
78
+ }
79
+ }
80
+ ```
81
+
82
+ #### 2. **`.local.json`** - Local Development Context
83
+
84
+ ```json
85
+ {
86
+ "storeId": "store_abc123",
87
+ "accountId": "acc_xyz789",
88
+ "basePath": "/"
89
+ }
90
+ ```
91
+
92
+ > ⚠️ **Auto-managed**: This file is only for local dev. In production, the platform injects this data automatically.
93
+
94
+ #### 3. **`config/my-theme.json`** - Optional Deployment Config
95
+
96
+ ```json
97
+ {
98
+ "configName": "green-theme",
99
+ "branding": {
100
+ "primaryColor": "#059669",
101
+ "companyName": "My Store",
102
+ "logoUrl": "https://example.com/logo.png"
103
+ },
104
+ "features": {
105
+ "enableChat": true,
106
+ "maxItems": 10
107
+ }
108
+ }
109
+ ```
110
+
111
+ > 📝 **Note**: Config can contain any keys you need - the SDK doesn't enforce a specific structure.
112
+
113
+ ## 🚀 Quick Start
114
+
115
+ ### Installation
116
+
117
+ ```bash
118
+ npm install @tagadapay/plugin-sdk
119
+ ```
120
+
121
+ ### Basic Plugin Setup
122
+
123
+ ```tsx
124
+ import React from 'react';
125
+ import {
126
+ TagadaProvider,
127
+ usePluginConfig,
128
+ useGoogleAutocomplete,
129
+ useISOData
130
+ } from '@tagadapay/plugin-sdk/react';
131
+
132
+ function MyPlugin() {
133
+ const { storeId, accountId, basePath, config, loading } = usePluginConfig();
134
+
135
+ // Optional: Add address autocomplete
136
+ const { searchPlaces, predictions } = useGoogleAutocomplete({
137
+ apiKey: config?.googleMapsApiKey || 'YOUR_API_KEY'
138
+ });
139
+
140
+ // Optional: Add country/region data
141
+ const { countries } = useISOData('en');
142
+
143
+ if (loading) return <div>Loading...</div>;
144
+
145
+ return (
146
+ <div style={{ '--primary': config?.branding?.primaryColor }}>
147
+ <h1>Welcome to {config?.branding?.companyName}</h1>
148
+ <p>Store: {storeId}</p>
149
+ <p>Base Path: {basePath}</p>
150
+ <p>Available Countries: {Object.keys(countries).length}</p>
151
+ </div>
152
+ );
153
+ }
154
+
155
+ // Wrap your plugin with TagadaProvider
156
+ function App() {
157
+ return (
158
+ <TagadaProvider>
159
+ <MyPlugin />
160
+ </TagadaProvider>
161
+ );
162
+ }
163
+
164
+ export default App;
165
+ ```
166
+
167
+ ### Development vs Production
168
+
169
+ | Environment | Store/Account ID | Deployment Config | How it Works |
170
+ | -------------- | ---------------- | ----------------- | ------------------ |
171
+ | **Local Dev** | `.local.json` | `config/*.json` | Files on disk |
172
+ | **Production** | HTTP Headers | Meta Tags | Platform injection |
173
+
174
+ ```tsx
175
+ // ALWAYS use hooks - works in both environments
176
+ const { storeId, accountId, basePath, config } = usePluginConfig();
177
+
178
+ // NEVER access directly
179
+ // const config = window.__PLUGIN_CONFIG__; // Doesn't exist!
180
+ ```
181
+
182
+ ## 🎯 Key Features
183
+
184
+ ### Payment Processing
185
+
186
+ - Secure tokenized payments
187
+ - Multiple payment method support
188
+ - Real-time validation
189
+ - PCI compliance
190
+
191
+ ### Customer Management
192
+
193
+ - Profile management
194
+ - Address validation
195
+ - Order history
196
+ - Preferences
197
+
198
+ ### Cart & Pricing
199
+
200
+ - Dynamic pricing
201
+ - Promotional offers
202
+ - Tax calculations
203
+ - Currency conversion
204
+
205
+ ### UI Components
206
+
207
+ - Pre-built checkout components
208
+ - Customizable themes
209
+ - Mobile-optimized
210
+ - Accessibility features
211
+
212
+ ## 📖 API Reference
213
+
214
+ ### Core Hooks
215
+
216
+ #### useCheckout()
217
+
218
+ Primary hook for checkout state management.
219
+
220
+ ```typescript
221
+ const {
222
+ customer, // Customer information
223
+ cart, // Shopping cart state
224
+ payment, // Payment details
225
+ shipping, // Shipping information
226
+ loading, // Loading states
227
+ errors, // Error handling
228
+ } = useCheckout();
229
+ ```
230
+
231
+ #### useOffers()
232
+
233
+ Hook for managing dynamic offers and pricing.
234
+
235
+ ```typescript
236
+ const {
237
+ offers, // Available offers
238
+ applyOffer, // Apply offer function
239
+ removeOffer, // Remove offer function
240
+ total, // Calculated total
241
+ } = useOffers();
242
+ ```
243
+
244
+ ### Utility Functions
245
+
246
+ #### setCheckoutInfo()
247
+
248
+ Update checkout information with validation.
249
+
250
+ ```typescript
251
+ await setCheckoutInfo({
252
+ customer: {
253
+ email: 'user@example.com',
254
+ firstName: 'John',
255
+ lastName: 'Doe',
256
+ },
257
+ payment: {
258
+ method: 'card',
259
+ token: 'pm_token_123',
260
+ },
261
+ });
262
+ ```
263
+
264
+ #### Money utilities
265
+
266
+ Format and calculate monetary values.
267
+
268
+ ```typescript
269
+ import { formatMoney, convertCurrency } from '@tagadapay/plugin-sdk';
270
+
271
+ const formatted = formatMoney(2999, 'USD'); // "$29.99"
272
+ const converted = convertCurrency(2999, 'USD', 'EUR'); // 2699
273
+ ```
274
+
275
+ ## 🛠️ Development
276
+
277
+ ### Local Development
278
+
279
+ ```bash
280
+ # Install dependencies
281
+ npm install
282
+
283
+ # Start development server
284
+ npm run dev
285
+
286
+ # Build for production
287
+ npm run build
288
+ ```
289
+
290
+ ### Testing
291
+
292
+ ```bash
293
+ # Run tests
294
+ npm test
295
+
296
+ # Run tests with coverage
297
+ npm run test:coverage
298
+ ```
299
+
300
+ ### Linting
301
+
302
+ ```bash
303
+ # Check code style
304
+ npm run lint
305
+
306
+ # Fix linting issues
307
+ npm run lint:fix
308
+ ```
309
+
310
+ ## 📦 Build & Deploy
311
+
312
+ ### Building Your Plugin
313
+
314
+ ```bash
315
+ # Build optimized bundle
316
+ npm run build
317
+
318
+ # Analyze bundle size
319
+ npm run analyze
320
+ ```
321
+
322
+ ### Deployment
323
+
324
+ ```bash
325
+ # Deploy using TagadaPay CLI
326
+ npx @tagadapay/plugin-cli deploy
327
+
328
+ # Deploy specific environment
329
+ npx @tagadapay/plugin-cli deploy --env production
330
+ ```
331
+
332
+ ## 🔧 Configuration
333
+
334
+ ### Plugin Configuration
335
+
336
+ ```json
337
+ {
338
+ "name": "My Checkout Plugin",
339
+ "version": "1.0.0",
340
+ "description": "Custom checkout experience",
341
+ "main": "dist/index.js",
342
+ "tagadapay": {
343
+ "type": "checkout",
344
+ "mode": "direct",
345
+ "framework": "react"
346
+ }
347
+ }
348
+ ```
349
+
350
+ ### Environment Variables
351
+
352
+ ```env
353
+ TAGADAPAY_API_KEY=your_api_key
354
+ TAGADAPAY_ENVIRONMENT=sandbox
355
+ TAGADAPAY_STORE_ID=your_store_id
356
+ ```
357
+
358
+ ## 🎨 Styling & Themes
359
+
360
+ ### CSS Custom Properties
361
+
362
+ ```css
363
+ :root {
364
+ --tagada-primary: #007bff;
365
+ --tagada-secondary: #6c757d;
366
+ --tagada-success: #28a745;
367
+ --tagada-danger: #dc3545;
368
+ --tagada-border-radius: 4px;
369
+ --tagada-font-family: -apple-system, BlinkMacSystemFont, sans-serif;
370
+ }
371
+ ```
372
+
373
+ ### Component Styling
374
+
375
+ ```typescript
376
+ import { styled } from '@tagadapay/plugin-sdk';
377
+
378
+ const StyledButton = styled.button`
379
+ background: var(--tagada-primary);
380
+ color: white;
381
+ border-radius: var(--tagada-border-radius);
382
+ padding: 12px 24px;
383
+ border: none;
384
+ cursor: pointer;
385
+
386
+ &:hover {
387
+ opacity: 0.9;
388
+ }
389
+ `;
390
+ ```
391
+
392
+ ## 🔐 Security
393
+
394
+ ### Best Practices
395
+
396
+ - Never store sensitive payment data
397
+ - Always validate user inputs
398
+ - Use HTTPS in production
399
+ - Implement proper error handling
400
+ - Follow PCI DSS guidelines
401
+
402
+ ### Token Management
403
+
404
+ ```typescript
405
+ // Good: Use tokenized payments
406
+ const paymentToken = await tokenizePayment(cardData);
407
+ await processPayment({ token: paymentToken });
408
+
409
+ // Bad: Never store raw card data
410
+ // const cardNumber = '4111111111111111'; // Don't do this
411
+ ```
412
+
413
+ ## 📱 Mobile Optimization
414
+
415
+ ### Responsive Design
416
+
417
+ ```css
418
+ .checkout-container {
419
+ max-width: 600px;
420
+ margin: 0 auto;
421
+ padding: 16px;
422
+ }
423
+
424
+ @media (max-width: 768px) {
425
+ .checkout-container {
426
+ padding: 8px;
427
+ }
428
+
429
+ .checkout-form {
430
+ font-size: 16px; /* Prevent zoom on iOS */
431
+ }
432
+ }
433
+ ```
434
+
435
+ ### Touch Interactions
436
+
437
+ ```typescript
438
+ const handleTouchStart = (e) => {
439
+ // Optimize for touch devices
440
+ e.preventDefault();
441
+ // Handle touch interaction
442
+ };
443
+ ```
444
+
445
+ ## 🌐 Internationalization
446
+
447
+ ### Multi-language Support
448
+
449
+ ```typescript
450
+ import { useTranslation } from '@tagadapay/plugin-sdk';
451
+
452
+ function CheckoutForm() {
453
+ const { t } = useTranslation();
454
+
455
+ return (
456
+ <form>
457
+ <label>{t('checkout.email')}</label>
458
+ <input type="email" placeholder={t('checkout.email_placeholder')} />
459
+ </form>
460
+ );
461
+ }
462
+ ```
463
+
464
+ ### Currency Support
465
+
466
+ ```typescript
467
+ import { useCurrency } from '@tagadapay/plugin-sdk';
468
+
469
+ function PriceDisplay({ amount }) {
470
+ const { formatPrice, currency } = useCurrency();
471
+
472
+ return <span>{formatPrice(amount, currency)}</span>;
473
+ }
474
+ ```
475
+
476
+ ## 📊 Analytics & Monitoring
477
+
478
+ ### Event Tracking
479
+
480
+ ```typescript
481
+ import { trackEvent } from '@tagadapay/plugin-sdk';
482
+
483
+ // Track user interactions
484
+ trackEvent('checkout_started', {
485
+ product_id: 'prod_123',
486
+ value: 2999,
487
+ currency: 'USD',
488
+ });
489
+
490
+ // Track conversions
491
+ trackEvent('purchase_completed', {
492
+ transaction_id: 'txn_456',
493
+ value: 2999,
494
+ currency: 'USD',
495
+ });
496
+ ```
497
+
498
+ ### Performance Monitoring
499
+
500
+ ```typescript
501
+ import { performance } from '@tagadapay/plugin-sdk';
502
+
503
+ // Measure load times
504
+ performance.mark('checkout-start');
505
+ // ... checkout logic
506
+ performance.mark('checkout-end');
507
+ performance.measure('checkout-duration', 'checkout-start', 'checkout-end');
508
+ ```
509
+
510
+ ## 🤝 Contributing
511
+
512
+ ### Development Setup
513
+
514
+ ```bash
515
+ # Clone the repository
516
+ git clone https://github.com/tagadapay/plugin-sdk.git
517
+
518
+ # Install dependencies
519
+ npm install
520
+
521
+ # Start development
522
+ npm run dev
523
+ ```
524
+
525
+ ### Submitting Changes
526
+
527
+ 1. Fork the repository
528
+ 2. Create a feature branch
529
+ 3. Make your changes
530
+ 4. Add tests
531
+ 5. Submit a pull request
532
+
533
+ ## 📄 License
534
+
535
+ MIT License - see [LICENSE](./LICENSE) for details.
536
+
537
+ ## 🆘 Support
538
+
539
+ - **Documentation**: [docs.tagadapay.com](https://docs.tagadapay.com)
540
+ - **Discord**: [discord.gg/tagadapay](https://discord.gg/tagadapay)
541
+ - **Email**: support@tagadapay.com
542
+ - **GitHub Issues**: [github.com/tagadapay/plugin-sdk/issues](https://github.com/tagadapay/plugin-sdk/issues)
543
+
544
+ ---
545
+
546
+ Built with ❤️ by the TagadaPay team