@tagadapay/plugin-sdk 1.0.17 → 1.0.19

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,414 @@
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](./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
@@ -277,25 +277,25 @@ export function useAddress(options = {}) {
277
277
  // Custom styles for Google Places dropdown
278
278
  useEffect(() => {
279
279
  if (enableGooglePlaces && !document.getElementById('google-places-custom-styles')) {
280
- const autocompleteStyles = `
281
- .pac-container {
282
- border-radius: 8px;
283
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
284
- border: 1px solid #e2e8f0;
285
- margin-top: 4px;
286
- font-family: inherit;
287
- z-index: 9999;
288
- }
289
- .pac-item {
290
- padding: 10px 12px;
291
- font-size: 14px;
292
- cursor: pointer;
293
- border-top: 1px solid #f3f4f6;
294
- }
295
- .pac-item:first-child { border-top: none; }
296
- .pac-item:hover { background-color: #f8fafc; }
297
- .pac-item-selected, .pac-item-selected:hover { background-color: #eef2ff; }
298
- .pac-matched { font-weight: 600; }
280
+ const autocompleteStyles = `
281
+ .pac-container {
282
+ border-radius: 8px;
283
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
284
+ border: 1px solid #e2e8f0;
285
+ margin-top: 4px;
286
+ font-family: inherit;
287
+ z-index: 9999;
288
+ }
289
+ .pac-item {
290
+ padding: 10px 12px;
291
+ font-size: 14px;
292
+ cursor: pointer;
293
+ border-top: 1px solid #f3f4f6;
294
+ }
295
+ .pac-item:first-child { border-top: none; }
296
+ .pac-item:hover { background-color: #f8fafc; }
297
+ .pac-item-selected, .pac-item-selected:hover { background-color: #eef2ff; }
298
+ .pac-matched { font-weight: 600; }
299
299
  `;
300
300
  const styleElement = document.createElement('style');
301
301
  styleElement.id = 'google-places-custom-styles';
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useEffect } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  import { useTagadaContext } from '../providers/TagadaProvider';
3
3
  export function useOffers(options) {
4
4
  const { apiService, environment } = useTagadaContext();
@@ -17,7 +17,6 @@ export function useOffers(options) {
17
17
  method: 'GET',
18
18
  headers: {
19
19
  'Content-Type': 'application/json',
20
- 'X-Store-ID': apiService.getStoredStoreId() || '',
21
20
  },
22
21
  });
23
22
  if (!response.ok) {
@@ -42,7 +41,6 @@ export function useOffers(options) {
42
41
  method: 'POST',
43
42
  headers: {
44
43
  'Content-Type': 'application/json',
45
- 'X-Store-ID': apiService.getStoredStoreId() || '',
46
44
  },
47
45
  body: JSON.stringify({
48
46
  returnUrl: sessionOptions?.returnUrl || returnUrl || window.location.origin,
@@ -58,7 +56,6 @@ export function useOffers(options) {
58
56
  method: 'POST',
59
57
  headers: {
60
58
  'Content-Type': 'application/json',
61
- 'X-Store-ID': apiService.getStoredStoreId() || '',
62
59
  },
63
60
  });
64
61
  if (!response.ok) {
@@ -71,7 +68,6 @@ export function useOffers(options) {
71
68
  method: 'POST',
72
69
  headers: {
73
70
  'Content-Type': 'application/json',
74
- 'X-Store-ID': apiService.getStoredStoreId() || '',
75
71
  },
76
72
  body: JSON.stringify({
77
73
  returnUrl: sessionOptions?.returnUrl || returnUrl || window.location.origin,
@@ -86,14 +86,11 @@ export function useOrderBump(options) {
86
86
  }, [autoPreview, refreshPreview]);
87
87
  // Register refresh function with coordinator and cleanup on unmount
88
88
  useEffect(() => {
89
- // Only register with refresh coordinator if autoPreview is enabled
90
- if (autoPreview) {
91
- refreshCoordinator.registerOrderBumpRefresh(refreshPreview);
92
- return () => {
93
- refreshCoordinator.unregisterOrderBumpRefresh();
94
- };
95
- }
96
- }, [refreshPreview, refreshCoordinator, autoPreview]);
89
+ refreshCoordinator.registerOrderBumpRefresh(refreshPreview);
90
+ return () => {
91
+ refreshCoordinator.unregisterOrderBumpRefresh();
92
+ };
93
+ }, [refreshPreview, refreshCoordinator]);
97
94
  // Calculate current savings
98
95
  const savings = isSelected && preview?.savings ? preview.savings : preview?.savings || null;
99
96
  return {
@@ -22,11 +22,11 @@ const InitializationLoader = () => (_jsx("div", { style: {
22
22
  backgroundSize: '200% 100%',
23
23
  animation: 'tagada-loading 1.5s ease-in-out infinite',
24
24
  zIndex: 9999,
25
- }, children: _jsx("style", { children: `
26
- @keyframes tagada-loading {
27
- 0% { background-position: 200% 0; }
28
- 100% { background-position: -200% 0; }
29
- }
25
+ }, children: _jsx("style", { children: `
26
+ @keyframes tagada-loading {
27
+ 0% { background-position: 200% 0; }
28
+ 100% { background-position: -200% 0; }
29
+ }
30
30
  ` }) }));
31
31
  const TagadaContext = createContext(null);
32
32
  export function TagadaProvider({ children, environment, customApiConfig, debugMode, // Remove default, will be set based on environment
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
- {
2
- "name": "@tagadapay/plugin-sdk",
3
- "version": "1.0.17",
4
- "description": "Modern React SDK for building Tagada Pay plugins",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc",
9
- "clean": "rm -rf dist",
10
- "lint": "echo \"No linting configured\"",
11
- "test": "echo \"No tests yet\" && exit 0",
12
- "dev": "tsc --watch",
13
- "prepublishOnly": "npm run clean && npm run build",
14
- "publish:patch": "npm version patch && npm publish",
15
- "publish:minor": "npm version minor && npm publish",
16
- "publish:major": "npm version major && npm publish",
17
- "publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
18
- "publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
19
- "version:patch": "npm version patch",
20
- "version:minor": "npm version minor",
21
- "version:major": "npm version major",
22
- "version:beta": "npm version prerelease --preid=beta",
23
- "version:alpha": "npm version prerelease --preid=alpha"
24
- },
25
- "keywords": [
26
- "tagadapay",
27
- "cms",
28
- "plugin",
29
- "sdk",
30
- "react",
31
- "typescript"
32
- ],
33
- "author": "Tagada Pay",
34
- "license": "MIT",
35
- "dependencies": {
36
- "@basis-theory/apple-pay-js": "^2.0.2",
37
- "@basis-theory/basis-theory-js": "^4.30.0",
38
- "@basis-theory/basis-theory-react": "^1.32.5",
39
- "@basis-theory/web-threeds": "^1.0.1",
40
- "axios": "^1.6.0",
41
- "react-google-autocomplete": "^2.7.3",
42
- "react-intl": "^7.1.11"
43
- },
44
- "devDependencies": {
45
- "@types/node": "^18.0.0",
46
- "@types/react": "^19",
47
- "@types/react-dom": "^19",
48
- "typescript": "^5.0.0"
49
- },
50
- "peerDependencies": {
51
- "react": "^18.0.0 || ^19.0.0",
52
- "react-dom": "^18.0.0 || ^19.0.0"
53
- },
54
- "files": [
55
- "dist/**/*",
56
- "README.md"
57
- ],
58
- "repository": {
59
- "type": "git",
60
- "url": "git+https://github.com/tagadapay/plugin-sdk.git"
61
- },
62
- "bugs": {
63
- "url": "https://github.com/tagadapay/plugin-sdk/issues"
64
- },
65
- "homepage": "https://github.com/tagadapay/plugin-sdk#readme"
66
- }
1
+ {
2
+ "name": "@tagadapay/plugin-sdk",
3
+ "version": "1.0.19",
4
+ "description": "Modern React SDK for building Tagada Pay plugins",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "clean": "rm -rf dist",
10
+ "lint": "echo \"No linting configured\"",
11
+ "test": "echo \"No tests yet\" && exit 0",
12
+ "dev": "tsc --watch",
13
+ "prepublishOnly": "npm run clean && npm run build",
14
+ "publish:patch": "npm version patch && npm publish",
15
+ "publish:minor": "npm version minor && npm publish",
16
+ "publish:major": "npm version major && npm publish",
17
+ "publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
18
+ "publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
19
+ "version:patch": "npm version patch",
20
+ "version:minor": "npm version minor",
21
+ "version:major": "npm version major",
22
+ "version:beta": "npm version prerelease --preid=beta",
23
+ "version:alpha": "npm version prerelease --preid=alpha"
24
+ },
25
+ "keywords": [
26
+ "tagadapay",
27
+ "cms",
28
+ "plugin",
29
+ "sdk",
30
+ "react",
31
+ "typescript"
32
+ ],
33
+ "author": "Tagada Pay",
34
+ "license": "MIT",
35
+ "dependencies": {
36
+ "@basis-theory/apple-pay-js": "^2.0.2",
37
+ "@basis-theory/basis-theory-js": "^4.30.0",
38
+ "@basis-theory/basis-theory-react": "^1.32.5",
39
+ "@basis-theory/web-threeds": "^1.0.1",
40
+ "axios": "^1.6.0",
41
+ "react-google-autocomplete": "^2.7.3",
42
+ "react-intl": "^7.1.11"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^18.0.0",
46
+ "@types/react": "^19",
47
+ "@types/react-dom": "^19",
48
+ "typescript": "^5.0.0"
49
+ },
50
+ "peerDependencies": {
51
+ "react": "^18.0.0 || ^19.0.0",
52
+ "react-dom": "^18.0.0 || ^19.0.0"
53
+ },
54
+ "files": [
55
+ "dist/**/*",
56
+ "README.md"
57
+ ],
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/tagadapay/plugin-sdk.git"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/tagadapay/plugin-sdk/issues"
64
+ },
65
+ "homepage": "https://github.com/tagadapay/plugin-sdk#readme"
66
+ }