@tagadapay/plugin-sdk 4.0.6 → 4.0.7
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 +25 -46
- package/dist/external-tracker.js +1 -1
- package/dist/external-tracker.min.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js +1 -1
- package/dist/tagada-react-sdk.js +1 -1
- package/dist/tagada-react-sdk.min.js +1 -1
- package/dist/tagada-sdk.js +1 -1
- package/dist/tagada-sdk.min.js +1 -1
- package/package.json +114 -115
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
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.
|
|
4
4
|
|
|
5
|
-
> **🚀 V2
|
|
5
|
+
> **🚀 V2 is the supported surface.** TanStack Query integration, improved TypeScript support, and better performance. [See V2 Architecture](#-v2-architecture) for details.
|
|
6
6
|
>
|
|
7
|
-
> **Recommended**: Use `@tagadapay/plugin-sdk/
|
|
7
|
+
> **Recommended**: Use `@tagadapay/plugin-sdk/v2` for new projects. V1 (`/react`) is still supported for existing projects but no longer receives new features.
|
|
8
8
|
|
|
9
9
|
## 📚 Documentation
|
|
10
10
|
|
|
@@ -25,7 +25,6 @@ A comprehensive React SDK for building plugins on the TagadaPay platform. Create
|
|
|
25
25
|
- **[useCheckout (V1)](./docs/README-useCheckout.md)** - Legacy checkout state management
|
|
26
26
|
- **[setCheckoutInfo](./docs/README-setCheckoutInfo.md)** - Customer information and validation
|
|
27
27
|
- **[useOffers (V1)](./docs/README-useOffers.md)** - Legacy dynamic pricing
|
|
28
|
-
- **[usePromotionCodes](./docs/README-usePromotionCodes.md)** - Legacy promotion code management
|
|
29
28
|
- **[Money utilities](./docs/README-money.md)** - Currency formatting and calculations
|
|
30
29
|
- **[URL utilities](./docs/README-urlUtils.md)** - Navigation and routing helpers
|
|
31
30
|
|
|
@@ -147,7 +146,7 @@ import {
|
|
|
147
146
|
useISOData,
|
|
148
147
|
useCheckout,
|
|
149
148
|
formatMoney,
|
|
150
|
-
} from '@tagadapay/plugin-sdk/
|
|
149
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
151
150
|
|
|
152
151
|
function MyPlugin() {
|
|
153
152
|
const { config, storeId, accountId, basePath, loading } = usePluginConfig();
|
|
@@ -200,7 +199,7 @@ export default App;
|
|
|
200
199
|
|
|
201
200
|
### What's New in V2
|
|
202
201
|
|
|
203
|
-
The TagadaPay Plugin SDK
|
|
202
|
+
The TagadaPay Plugin SDK V2 introduces a clean architecture with significant improvements:
|
|
204
203
|
|
|
205
204
|
#### **🔄 TanStack Query Integration**
|
|
206
205
|
|
|
@@ -219,7 +218,7 @@ The TagadaPay Plugin SDK v3 introduces a clean architecture with significant imp
|
|
|
219
218
|
|
|
220
219
|
```tsx
|
|
221
220
|
// V2 (Recommended)
|
|
222
|
-
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
221
|
+
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
223
222
|
|
|
224
223
|
// Legacy (Still supported)
|
|
225
224
|
import { useCheckout, useOffers, TagadaProvider } from '@tagadapay/plugin-sdk/react';
|
|
@@ -258,7 +257,7 @@ import {
|
|
|
258
257
|
useProducts,
|
|
259
258
|
usePluginConfig,
|
|
260
259
|
formatMoney,
|
|
261
|
-
} from '@tagadapay/plugin-sdk/
|
|
260
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
262
261
|
|
|
263
262
|
function CheckoutPage() {
|
|
264
263
|
const [checkoutToken, setCheckoutToken] = useState<string>();
|
|
@@ -356,7 +355,7 @@ function App() {
|
|
|
356
355
|
|
|
357
356
|
```tsx
|
|
358
357
|
import React from 'react';
|
|
359
|
-
import { TagadaProvider, useCheckout, useOffers, formatMoney } from '@tagadapay/plugin-sdk/
|
|
358
|
+
import { TagadaProvider, useCheckout, useOffers, formatMoney } from '@tagadapay/plugin-sdk/v2';
|
|
360
359
|
|
|
361
360
|
// Component 1: Cart Summary
|
|
362
361
|
function CartSummary({ checkoutToken }: { checkoutToken: string }) {
|
|
@@ -412,7 +411,7 @@ function CheckoutWithOffers() {
|
|
|
412
411
|
|
|
413
412
|
```tsx
|
|
414
413
|
import React from 'react';
|
|
415
|
-
import { useCheckout } from '@tagadapay/plugin-sdk/
|
|
414
|
+
import { useCheckout } from '@tagadapay/plugin-sdk/v2';
|
|
416
415
|
|
|
417
416
|
function QuantitySelector({
|
|
418
417
|
checkoutToken,
|
|
@@ -556,7 +555,7 @@ interface TagadaProviderProps {
|
|
|
556
555
|
#### V2 Enhanced Provider Features
|
|
557
556
|
|
|
558
557
|
```tsx
|
|
559
|
-
import { TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
558
|
+
import { TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
560
559
|
|
|
561
560
|
function App() {
|
|
562
561
|
return (
|
|
@@ -578,7 +577,7 @@ function App() {
|
|
|
578
577
|
}
|
|
579
578
|
```
|
|
580
579
|
|
|
581
|
-
> **Version Compatibility:** V2 features require `@tagadapay/plugin-sdk/
|
|
580
|
+
> **Version Compatibility:** V2 features require `@tagadapay/plugin-sdk/v2`. The `blockUntilSessionReady` option was added in v2.3.0. For older versions, the blocking behavior was the default and only option.
|
|
582
581
|
|
|
583
582
|
### Development vs Production
|
|
584
583
|
|
|
@@ -819,7 +818,7 @@ const {
|
|
|
819
818
|
**Example:**
|
|
820
819
|
|
|
821
820
|
```tsx
|
|
822
|
-
import { useStoreConfig } from '@tagadapay/plugin-sdk/
|
|
821
|
+
import { useStoreConfig } from '@tagadapay/plugin-sdk/v2';
|
|
823
822
|
|
|
824
823
|
function StoreInfo() {
|
|
825
824
|
const { storeConfig, isLoading } = useStoreConfig();
|
|
@@ -898,7 +897,7 @@ import {
|
|
|
898
897
|
useInvalidateQuery,
|
|
899
898
|
usePreloadQuery,
|
|
900
899
|
queryKeys,
|
|
901
|
-
} from '@tagadapay/plugin-sdk/
|
|
900
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
902
901
|
|
|
903
902
|
// Custom API queries
|
|
904
903
|
const { data, isLoading } = useApiQuery({
|
|
@@ -928,7 +927,7 @@ preloadCheckout({
|
|
|
928
927
|
Enhanced money formatting with better TypeScript support:
|
|
929
928
|
|
|
930
929
|
```typescript
|
|
931
|
-
import { formatMoney, convertCurrency, getCurrencyInfo } from '@tagadapay/plugin-sdk/
|
|
930
|
+
import { formatMoney, convertCurrency, getCurrencyInfo } from '@tagadapay/plugin-sdk/v2';
|
|
932
931
|
|
|
933
932
|
// Format money with automatic currency detection
|
|
934
933
|
const formatted = formatMoney(2999, 'USD'); // "$29.99"
|
|
@@ -957,7 +956,7 @@ import {
|
|
|
957
956
|
ProductsResource,
|
|
958
957
|
PaymentsResource,
|
|
959
958
|
PluginConfigUtils,
|
|
960
|
-
} from '@tagadapay/plugin-sdk/
|
|
959
|
+
} from '@tagadapay/plugin-sdk/v2';
|
|
961
960
|
|
|
962
961
|
// Use core functions directly (useful for server-side or non-React contexts)
|
|
963
962
|
const checkoutResource = new CheckoutResource(apiClient);
|
|
@@ -973,7 +972,7 @@ const isValid = PluginConfigUtils.validateConfig(config);
|
|
|
973
972
|
V2 includes built-in debugging tools:
|
|
974
973
|
|
|
975
974
|
```tsx
|
|
976
|
-
import { TagadaProvider } from '@tagadapay/plugin-sdk/
|
|
975
|
+
import { TagadaProvider } from '@tagadapay/plugin-sdk/v2';
|
|
977
976
|
|
|
978
977
|
function App() {
|
|
979
978
|
return (
|
|
@@ -1120,7 +1119,7 @@ const handleTouchStart = (e) => {
|
|
|
1120
1119
|
### Multi-language Support
|
|
1121
1120
|
|
|
1122
1121
|
```typescript
|
|
1123
|
-
import { useTranslation } from '@tagadapay/plugin-sdk';
|
|
1122
|
+
import { useTranslation } from '@tagadapay/plugin-sdk/v2';
|
|
1124
1123
|
|
|
1125
1124
|
function CheckoutForm() {
|
|
1126
1125
|
const { t } = useTranslation();
|
|
@@ -1137,7 +1136,7 @@ function CheckoutForm() {
|
|
|
1137
1136
|
### Currency Support
|
|
1138
1137
|
|
|
1139
1138
|
```typescript
|
|
1140
|
-
import { useCurrency } from '@tagadapay/plugin-sdk';
|
|
1139
|
+
import { useCurrency } from '@tagadapay/plugin-sdk/v2';
|
|
1141
1140
|
|
|
1142
1141
|
function PriceDisplay({ amount }) {
|
|
1143
1142
|
const { formatPrice, currency } = useCurrency();
|
|
@@ -1146,39 +1145,19 @@ function PriceDisplay({ amount }) {
|
|
|
1146
1145
|
}
|
|
1147
1146
|
```
|
|
1148
1147
|
|
|
1149
|
-
## 📊 Analytics &
|
|
1148
|
+
## 📊 Analytics & Tracking
|
|
1150
1149
|
|
|
1151
|
-
|
|
1150
|
+
Pixel tracking (Facebook, TikTok, Snapchat, GTM) is configured per-step in
|
|
1151
|
+
the CRM step editor and auto-bootstrapped at runtime — no plugin code is
|
|
1152
|
+
required. For external (non-Tagadapay-hosted) pages, the lightweight
|
|
1153
|
+
external tracker is available:
|
|
1152
1154
|
|
|
1153
1155
|
```typescript
|
|
1154
|
-
import {
|
|
1155
|
-
|
|
1156
|
-
// Track user interactions
|
|
1157
|
-
trackEvent('checkout_started', {
|
|
1158
|
-
product_id: 'prod_123',
|
|
1159
|
-
value: 2999,
|
|
1160
|
-
currency: 'USD',
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
// Track conversions
|
|
1164
|
-
trackEvent('purchase_completed', {
|
|
1165
|
-
transaction_id: 'txn_456',
|
|
1166
|
-
value: 2999,
|
|
1167
|
-
currency: 'USD',
|
|
1168
|
-
});
|
|
1156
|
+
import { TagadaExternalTracker } from '@tagadapay/plugin-sdk/external-tracker';
|
|
1169
1157
|
```
|
|
1170
1158
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
```typescript
|
|
1174
|
-
import { performance } from '@tagadapay/plugin-sdk';
|
|
1175
|
-
|
|
1176
|
-
// Measure load times
|
|
1177
|
-
performance.mark('checkout-start');
|
|
1178
|
-
// ... checkout logic
|
|
1179
|
-
performance.mark('checkout-end');
|
|
1180
|
-
performance.measure('checkout-duration', 'checkout-start', 'checkout-end');
|
|
1181
|
-
```
|
|
1159
|
+
See [External Page Tracker docs](../../mintlify/developer-tools/web-integration/external-page-tracker.mdx)
|
|
1160
|
+
for the full integration guide.
|
|
1182
1161
|
|
|
1183
1162
|
## 🤝 Contributing
|
|
1184
1163
|
|
package/dist/external-tracker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TagadaPay React SDK MINIMAL v4.0.
|
|
2
|
+
* TagadaPay React SDK MINIMAL v4.0.7
|
|
3
3
|
* CDN Bundle - Slim checkout SDK (TagadaProvider + essential hooks only)
|
|
4
4
|
* Requires: React 18+ loaded before this script
|
|
5
5
|
* For full SDK with all hooks, use tagada-react-sdk.min.js instead
|
package/dist/tagada-react-sdk.js
CHANGED
package/dist/tagada-sdk.js
CHANGED
package/dist/tagada-sdk.min.js
CHANGED
package/package.json
CHANGED
|
@@ -1,115 +1,114 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tagadapay/plugin-sdk",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./react": {
|
|
15
|
-
"types": "./dist/react/index.d.ts",
|
|
16
|
-
"import": "./dist/react/index.js",
|
|
17
|
-
"require": "./dist/react/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./v2": {
|
|
20
|
-
"types": "./dist/v2/index.d.ts",
|
|
21
|
-
"import": "./dist/v2/index.js",
|
|
22
|
-
"require": "./dist/v2/index.js"
|
|
23
|
-
},
|
|
24
|
-
"./v2/standalone": {
|
|
25
|
-
"types": "./dist/v2/standalone/index.d.ts",
|
|
26
|
-
"import": "./dist/v2/standalone/index.js",
|
|
27
|
-
"require": "./dist/v2/standalone/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./external-tracker": {
|
|
30
|
-
"browser": "./dist/external-tracker.min.js",
|
|
31
|
-
"default": "./dist/external-tracker.min.js"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
},
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tagadapay/plugin-sdk",
|
|
3
|
+
"version": "4.0.7",
|
|
4
|
+
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"types": "./dist/react/index.d.ts",
|
|
16
|
+
"import": "./dist/react/index.js",
|
|
17
|
+
"require": "./dist/react/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./v2": {
|
|
20
|
+
"types": "./dist/v2/index.d.ts",
|
|
21
|
+
"import": "./dist/v2/index.js",
|
|
22
|
+
"require": "./dist/v2/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./v2/standalone": {
|
|
25
|
+
"types": "./dist/v2/standalone/index.d.ts",
|
|
26
|
+
"import": "./dist/v2/standalone/index.js",
|
|
27
|
+
"require": "./dist/v2/standalone/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./external-tracker": {
|
|
30
|
+
"browser": "./dist/external-tracker.min.js",
|
|
31
|
+
"default": "./dist/external-tracker.min.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"tagadapay",
|
|
36
|
+
"cms",
|
|
37
|
+
"plugin",
|
|
38
|
+
"sdk",
|
|
39
|
+
"react",
|
|
40
|
+
"typescript"
|
|
41
|
+
],
|
|
42
|
+
"author": "Tagada Pay",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@basis-theory/apple-pay-js": "^2.0.2",
|
|
46
|
+
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
47
|
+
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
48
|
+
"@basis-theory/web-threeds": "^1.0.1",
|
|
49
|
+
"@google-pay/button-react": "^3.0.10",
|
|
50
|
+
"@stripe/react-stripe-js": "^5.6.1",
|
|
51
|
+
"@stripe/stripe-js": "^8.11.0",
|
|
52
|
+
"@tagadapay/plugin-sdk": "link:",
|
|
53
|
+
"@tanstack/react-query": "^5.90.2",
|
|
54
|
+
"@whop/checkout": "^0.0.40",
|
|
55
|
+
"axios": "^1.10.0",
|
|
56
|
+
"path-to-regexp": "^8.2.0",
|
|
57
|
+
"react-intl": "^7.1.11",
|
|
58
|
+
"swr": "^2.3.6",
|
|
59
|
+
"@tagadapay/core-js": "3.0.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/jest": "^29.5.0",
|
|
63
|
+
"@types/node": "^18.19.130",
|
|
64
|
+
"@types/react": "^19",
|
|
65
|
+
"@types/react-dom": "^19",
|
|
66
|
+
"esbuild": "^0.24.2",
|
|
67
|
+
"jest": "^29.5.0",
|
|
68
|
+
"ts-jest": "^29.1.0",
|
|
69
|
+
"typescript": "^5.0.0"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
73
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
74
|
+
},
|
|
75
|
+
"files": [
|
|
76
|
+
"dist/**/*",
|
|
77
|
+
"README.md",
|
|
78
|
+
"build-cdn.js"
|
|
79
|
+
],
|
|
80
|
+
"repository": {
|
|
81
|
+
"type": "git",
|
|
82
|
+
"url": "git+https://github.com/tagadapay/plugin-sdk.git"
|
|
83
|
+
},
|
|
84
|
+
"bugs": {
|
|
85
|
+
"url": "https://github.com/tagadapay/plugin-sdk/issues"
|
|
86
|
+
},
|
|
87
|
+
"homepage": "https://github.com/tagadapay/plugin-sdk#readme",
|
|
88
|
+
"scripts": {
|
|
89
|
+
"build": "tsc && npm run build:cdn",
|
|
90
|
+
"build:cdn": "node build-cdn.js",
|
|
91
|
+
"build:ts": "tsc",
|
|
92
|
+
"clean": "rm -rf dist",
|
|
93
|
+
"lint": "echo \"No linting configured\"",
|
|
94
|
+
"test": "jest --no-watchman",
|
|
95
|
+
"test:watch": "jest --watch --no-watchman",
|
|
96
|
+
"test:coverage": "jest --coverage --no-watchman",
|
|
97
|
+
"dev": "tsc --watch",
|
|
98
|
+
"publish:patch": "npm version patch && pnpm publish --no-git-checks",
|
|
99
|
+
"publish:minor": "npm version minor && pnpm publish --no-git-checks",
|
|
100
|
+
"publish:major": "npm version major && pnpm publish --no-git-checks",
|
|
101
|
+
"publish:beta": "npm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
102
|
+
"publish:alpha": "npm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
103
|
+
"version:patch": "npm version patch",
|
|
104
|
+
"version:minor": "npm version minor",
|
|
105
|
+
"version:major": "npm version major",
|
|
106
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
107
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
108
|
+
"version:check": "node version-sync.js check",
|
|
109
|
+
"version:sync": "node version-sync.js sync",
|
|
110
|
+
"version:list": "node version-sync.js list",
|
|
111
|
+
"version:next": "node version-sync.js next",
|
|
112
|
+
"postversion": "echo \"✅ Version updated to $(node -p 'require(\"./package.json\").version')\" && (git push && git push --tags || echo \"⚠️ Git push failed - you may need to pull and push manually\")"
|
|
113
|
+
}
|
|
114
|
+
}
|