@tagadapay/plugin-sdk 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -63
- package/dist/index.d.ts +8 -25
- package/dist/index.js +9 -29
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TagadaPay Plugin SDK
|
|
2
2
|
|
|
3
|
-
A comprehensive SDK for building
|
|
3
|
+
A comprehensive React SDK for building plugins on the TagadaPay platform. Create custom checkout experiences, landing pages, and interactive components with automatic configuration injection and advanced routing capabilities.pnpm
|
|
4
4
|
|
|
5
5
|
## 📚 Documentation
|
|
6
6
|
|
|
@@ -122,11 +122,11 @@ npm install @tagadapay/plugin-sdk
|
|
|
122
122
|
|
|
123
123
|
```tsx
|
|
124
124
|
import React from 'react';
|
|
125
|
-
import {
|
|
126
|
-
TagadaProvider,
|
|
125
|
+
import {
|
|
126
|
+
TagadaProvider,
|
|
127
127
|
usePluginConfig,
|
|
128
128
|
useGoogleAutocomplete,
|
|
129
|
-
useISOData
|
|
129
|
+
useISOData,
|
|
130
130
|
} from '@tagadapay/plugin-sdk/react';
|
|
131
131
|
|
|
132
132
|
function MyPlugin() {
|
|
@@ -134,7 +134,7 @@ function MyPlugin() {
|
|
|
134
134
|
|
|
135
135
|
// Optional: Add address autocomplete
|
|
136
136
|
const { searchPlaces, predictions } = useGoogleAutocomplete({
|
|
137
|
-
apiKey: config?.googleMapsApiKey || 'YOUR_API_KEY'
|
|
137
|
+
apiKey: config?.googleMapsApiKey || 'YOUR_API_KEY',
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
// Optional: Add country/region data
|
|
@@ -181,33 +181,40 @@ const { storeId, accountId, basePath, config } = usePluginConfig();
|
|
|
181
181
|
|
|
182
182
|
## 🎯 Key Features
|
|
183
183
|
|
|
184
|
-
###
|
|
184
|
+
### 🔧 **Plugin Configuration System**
|
|
185
|
+
|
|
186
|
+
- **Automatic Context Injection** - Store ID, Account ID, and custom config
|
|
187
|
+
- **Development & Production** - Seamless environment switching
|
|
188
|
+
- **Generic Configuration** - Support for any JSON structure
|
|
189
|
+
- **React Hooks** - Clean, type-safe configuration access
|
|
190
|
+
|
|
191
|
+
### 💳 **Payment Processing**
|
|
185
192
|
|
|
186
193
|
- Secure tokenized payments
|
|
187
194
|
- Multiple payment method support
|
|
188
195
|
- Real-time validation
|
|
189
196
|
- PCI compliance
|
|
190
197
|
|
|
191
|
-
###
|
|
198
|
+
### 🌍 **Address & Location**
|
|
192
199
|
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
200
|
+
- **Google Places Autocomplete** - Automatic API loading and address parsing
|
|
201
|
+
- **ISO Country/Region Data** - Complete ISO 3166-1/3166-2 database
|
|
202
|
+
- **Address Validation** - Structured component extraction
|
|
203
|
+
- **Multi-language Support** - 11+ languages for international users
|
|
197
204
|
|
|
198
|
-
###
|
|
205
|
+
### 🛒 **E-commerce Features**
|
|
199
206
|
|
|
200
|
-
- Dynamic pricing
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
207
|
+
- Dynamic pricing and promotional offers
|
|
208
|
+
- Cart management and tax calculations
|
|
209
|
+
- Currency conversion and formatting
|
|
210
|
+
- Customer profile management
|
|
204
211
|
|
|
205
|
-
### UI
|
|
212
|
+
### 🎨 **UI & Development**
|
|
206
213
|
|
|
207
|
-
- Pre-built
|
|
208
|
-
- Customizable themes
|
|
209
|
-
- Mobile-optimized
|
|
210
|
-
-
|
|
214
|
+
- Pre-built React components
|
|
215
|
+
- Customizable themes with configuration
|
|
216
|
+
- Mobile-optimized and accessible
|
|
217
|
+
- TypeScript support throughout
|
|
211
218
|
|
|
212
219
|
## 📖 API Reference
|
|
213
220
|
|
|
@@ -347,48 +354,6 @@ npx @tagadapay/plugin-cli deploy --env production
|
|
|
347
354
|
}
|
|
348
355
|
```
|
|
349
356
|
|
|
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
357
|
## 🔐 Security
|
|
393
358
|
|
|
394
359
|
### Best Practices
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tagada Pay Plugin SDK
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Core SDK for building Tagada Pay plugins
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* For React-specific functionality, use:
|
|
7
7
|
* ```tsx
|
|
8
8
|
* import { TagadaProvider, useCustomer } from '@tagadapay/plugin-sdk/react';
|
|
9
|
-
*
|
|
10
|
-
* function App() {
|
|
11
|
-
* return (
|
|
12
|
-
* <TagadaProvider>
|
|
13
|
-
* <MyPlugin />
|
|
14
|
-
* </TagadaProvider>
|
|
15
|
-
* );
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* function MyPlugin() {
|
|
19
|
-
* const { customer, isAuthenticated } = useCustomer();
|
|
20
|
-
*
|
|
21
|
-
* return (
|
|
22
|
-
* <div>
|
|
23
|
-
* {isAuthenticated ? (
|
|
24
|
-
* <p>Welcome back, {customer.firstName}!</p>
|
|
25
|
-
* ) : (
|
|
26
|
-
* <p>Welcome, guest!</p>
|
|
27
|
-
* )}
|
|
28
|
-
* </div>
|
|
29
|
-
* );
|
|
30
|
-
* }
|
|
31
9
|
* ```
|
|
10
|
+
*
|
|
11
|
+
* This main export contains non-React utilities and types.
|
|
32
12
|
*/
|
|
33
|
-
export
|
|
13
|
+
export type { Currency, Customer, Environment, EnvironmentConfig, Locale, Order, OrderAddress, OrderItem, OrderSummary, PickupPoint, Session, Store, } from './react/types';
|
|
14
|
+
export { convertCurrency, formatMoney, formatMoneyWithoutSymbol, formatSimpleMoney, getCurrencyInfo, minorUnitsToMajorUnits, moneyStringOrNumberToMinorUnits, } from './react/utils/money';
|
|
15
|
+
export * from './data/countries';
|
|
16
|
+
export * from './data/iso3166';
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tagada Pay Plugin SDK
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Core SDK for building Tagada Pay plugins
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* For React-specific functionality, use:
|
|
7
7
|
* ```tsx
|
|
8
8
|
* import { TagadaProvider, useCustomer } from '@tagadapay/plugin-sdk/react';
|
|
9
|
-
*
|
|
10
|
-
* function App() {
|
|
11
|
-
* return (
|
|
12
|
-
* <TagadaProvider>
|
|
13
|
-
* <MyPlugin />
|
|
14
|
-
* </TagadaProvider>
|
|
15
|
-
* );
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* function MyPlugin() {
|
|
19
|
-
* const { customer, isAuthenticated } = useCustomer();
|
|
20
|
-
*
|
|
21
|
-
* return (
|
|
22
|
-
* <div>
|
|
23
|
-
* {isAuthenticated ? (
|
|
24
|
-
* <p>Welcome back, {customer.firstName}!</p>
|
|
25
|
-
* ) : (
|
|
26
|
-
* <p>Welcome, guest!</p>
|
|
27
|
-
* )}
|
|
28
|
-
* </div>
|
|
29
|
-
* );
|
|
30
|
-
* }
|
|
31
9
|
* ```
|
|
10
|
+
*
|
|
11
|
+
* This main export contains non-React utilities and types.
|
|
32
12
|
*/
|
|
33
|
-
// Export
|
|
34
|
-
export
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
// Export utility functions that don't depend on React
|
|
14
|
+
export { convertCurrency, formatMoney, formatMoneyWithoutSymbol, formatSimpleMoney, getCurrencyInfo, minorUnitsToMajorUnits, moneyStringOrNumberToMinorUnits, } from './react/utils/money';
|
|
15
|
+
// Export data utilities
|
|
16
|
+
export * from './data/countries';
|
|
17
|
+
export * from './data/iso3166';
|
package/package.json
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagadapay/plugin-sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./react": {
|
|
14
|
+
"types": "./dist/react/index.d.ts",
|
|
15
|
+
"import": "./dist/react/index.js",
|
|
16
|
+
"require": "./dist/react/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
7
19
|
"scripts": {
|
|
8
20
|
"build": "tsc",
|
|
9
21
|
"clean": "rm -rf dist",
|