@tagadapay/plugin-sdk 3.1.1 → 3.1.5
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 +1129 -1129
- package/build-cdn.js +113 -113
- package/dist/external-tracker.js +1 -1
- package/dist/external-tracker.min.js +1 -1
- package/dist/external-tracker.min.js.map +1 -1
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/v2/react/components/FunnelScriptInjector.js +21 -21
- package/dist/v2/react/hooks/usePaymentQuery.js +23 -20
- package/dist/v2/react/providers/TagadaProvider.js +5 -5
- package/package.json +112 -112
|
@@ -38,11 +38,11 @@ const InitializationLoader = () => (_jsxs("div", { style: {
|
|
|
38
38
|
borderTop: '1.5px solid #9ca3af',
|
|
39
39
|
borderRadius: '50%',
|
|
40
40
|
animation: 'tagada-spin 1s linear infinite',
|
|
41
|
-
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
-
@keyframes tagada-spin {
|
|
43
|
-
0% { transform: rotate(0deg); }
|
|
44
|
-
100% { transform: rotate(360deg); }
|
|
45
|
-
}
|
|
41
|
+
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
+
@keyframes tagada-spin {
|
|
43
|
+
0% { transform: rotate(0deg); }
|
|
44
|
+
100% { transform: rotate(360deg); }
|
|
45
|
+
}
|
|
46
46
|
` })] }));
|
|
47
47
|
const TagadaContext = createContext(null);
|
|
48
48
|
export function TagadaProvider({ children, environment, customApiConfig, debugMode, // Remove default, will be set based on environment
|
|
@@ -197,27 +197,27 @@ export function FunnelScriptInjector({ context, isInitialized }) {
|
|
|
197
197
|
existingScript.remove();
|
|
198
198
|
}
|
|
199
199
|
// Wrap script content with error handling and context checks
|
|
200
|
-
const wrappedScript = `
|
|
201
|
-
(function() {
|
|
202
|
-
try {
|
|
203
|
-
// Check if we have basic DOM access
|
|
204
|
-
if (typeof document === 'undefined') {
|
|
205
|
-
console.error('[TagadaPay] Document not available');
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Check if we have Tagada
|
|
210
|
-
if (!window.Tagada) {
|
|
211
|
-
console.error('[TagadaPay] Tagada not available');
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Execute the original script
|
|
216
|
-
${scriptBody}
|
|
217
|
-
} catch (error) {
|
|
218
|
-
console.error('[TagadaPay] Script execution error:', error);
|
|
219
|
-
}
|
|
220
|
-
})();
|
|
200
|
+
const wrappedScript = `
|
|
201
|
+
(function() {
|
|
202
|
+
try {
|
|
203
|
+
// Check if we have basic DOM access
|
|
204
|
+
if (typeof document === 'undefined') {
|
|
205
|
+
console.error('[TagadaPay] Document not available');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Check if we have Tagada
|
|
210
|
+
if (!window.Tagada) {
|
|
211
|
+
console.error('[TagadaPay] Tagada not available');
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Execute the original script
|
|
216
|
+
${scriptBody}
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.error('[TagadaPay] Script execution error:', error);
|
|
219
|
+
}
|
|
220
|
+
})();
|
|
221
221
|
`;
|
|
222
222
|
// Create and inject new script element
|
|
223
223
|
const scriptElement = document.createElement('script');
|
|
@@ -127,30 +127,33 @@ export function usePaymentQuery() {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
break;
|
|
130
|
-
case 'processor_auth':
|
|
130
|
+
case 'processor_auth': {
|
|
131
|
+
// Always auto-redirect for processor auth (e.g., 3DS, external payment flows)
|
|
132
|
+
if (actionData.metadata?.redirect?.redirectUrl) {
|
|
133
|
+
window.location.href = actionData.metadata.redirect.redirectUrl;
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
131
137
|
case 'redirect': {
|
|
138
|
+
// For redirect type, let funnel orchestrator handle navigation via callbacks
|
|
132
139
|
// Only auto-redirect if explicitly enabled (disableAutoRedirect: false)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (shouldRedirect && actionData.metadata?.redirect?.redirectUrl) {
|
|
140
|
+
const shouldAutoRedirect = options.disableAutoRedirect === false;
|
|
141
|
+
if (shouldAutoRedirect && actionData.metadata?.redirect?.redirectUrl) {
|
|
136
142
|
window.location.href = actionData.metadata.redirect.redirectUrl;
|
|
137
143
|
}
|
|
138
|
-
else {
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// Funnel-aligned callback (recommended)
|
|
152
|
-
options.onPaymentSuccess?.(response);
|
|
153
|
-
}
|
|
144
|
+
else if (payment.status === 'succeeded') {
|
|
145
|
+
// Payment succeeded - call success callbacks for funnel navigation
|
|
146
|
+
setIsLoading(false);
|
|
147
|
+
const response = {
|
|
148
|
+
paymentId: payment.id,
|
|
149
|
+
payment,
|
|
150
|
+
// Extract order from payment if available (for funnel path resolution)
|
|
151
|
+
order: payment.order,
|
|
152
|
+
};
|
|
153
|
+
// Legacy callback (backwards compatibility)
|
|
154
|
+
options.onSuccess?.(response);
|
|
155
|
+
// Funnel-aligned callback (recommended)
|
|
156
|
+
options.onPaymentSuccess?.(response);
|
|
154
157
|
}
|
|
155
158
|
break;
|
|
156
159
|
}
|
|
@@ -37,11 +37,11 @@ const InitializationLoader = () => (_jsxs("div", { style: {
|
|
|
37
37
|
borderTop: '1.5px solid #9ca3af',
|
|
38
38
|
borderRadius: '50%',
|
|
39
39
|
animation: 'tagada-spin 1s linear infinite',
|
|
40
|
-
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
41
|
-
@keyframes tagada-spin {
|
|
42
|
-
0% { transform: rotate(0deg); }
|
|
43
|
-
100% { transform: rotate(360deg); }
|
|
44
|
-
}
|
|
40
|
+
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
41
|
+
@keyframes tagada-spin {
|
|
42
|
+
0% { transform: rotate(0deg); }
|
|
43
|
+
100% { transform: rotate(360deg); }
|
|
44
|
+
}
|
|
45
45
|
` })] }));
|
|
46
46
|
const TagadaContext = createContext(null);
|
|
47
47
|
export function TagadaProvider({ children, environment, customApiConfig, debugMode, localConfig, blockUntilSessionReady = false, rawPluginConfig, features, funnelId, autoInitializeFunnel = true, onNavigate, onFunnelError, debugScripts = [], }) {
|
package/package.json
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tagadapay/plugin-sdk",
|
|
3
|
-
"version": "3.1.
|
|
4
|
-
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
-
"main": "dist/index.js",
|
|
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
|
-
"./v2": {
|
|
19
|
-
"types": "./dist/v2/index.d.ts",
|
|
20
|
-
"import": "./dist/v2/index.js",
|
|
21
|
-
"require": "./dist/v2/index.js"
|
|
22
|
-
},
|
|
23
|
-
"./v2/standalone": {
|
|
24
|
-
"types": "./dist/v2/standalone/index.d.ts",
|
|
25
|
-
"import": "./dist/v2/standalone/index.js",
|
|
26
|
-
"require": "./dist/v2/standalone/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./external-tracker": {
|
|
29
|
-
"browser": "./dist/external-tracker.min.js",
|
|
30
|
-
"default": "./dist/external-tracker.min.js"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc && npm run build:cdn",
|
|
35
|
-
"build:cdn": "node build-cdn.js",
|
|
36
|
-
"build:ts": "tsc",
|
|
37
|
-
"clean": "rm -rf dist",
|
|
38
|
-
"lint": "echo \"No linting configured\"",
|
|
39
|
-
"test": "jest --no-watchman",
|
|
40
|
-
"test:watch": "jest --watch --no-watchman",
|
|
41
|
-
"test:coverage": "jest --coverage --no-watchman",
|
|
42
|
-
"dev": "tsc --watch",
|
|
43
|
-
"prepublishOnly": "npm run clean && npm run build",
|
|
44
|
-
"publish:patch": "npm version patch && npm publish",
|
|
45
|
-
"publish:minor": "npm version minor && npm publish",
|
|
46
|
-
"publish:major": "npm version major && npm publish",
|
|
47
|
-
"publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
48
|
-
"publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
|
|
49
|
-
"version:patch": "npm version patch",
|
|
50
|
-
"version:minor": "npm version minor",
|
|
51
|
-
"version:major": "npm version major",
|
|
52
|
-
"version:beta": "npm version prerelease --preid=beta",
|
|
53
|
-
"version:alpha": "npm version prerelease --preid=alpha",
|
|
54
|
-
"version:check": "node version-sync.js check",
|
|
55
|
-
"version:sync": "node version-sync.js sync",
|
|
56
|
-
"version:list": "node version-sync.js list",
|
|
57
|
-
"version:next": "node version-sync.js next",
|
|
58
|
-
"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\")"
|
|
59
|
-
},
|
|
60
|
-
"keywords": [
|
|
61
|
-
"tagadapay",
|
|
62
|
-
"cms",
|
|
63
|
-
"plugin",
|
|
64
|
-
"sdk",
|
|
65
|
-
"react",
|
|
66
|
-
"typescript"
|
|
67
|
-
],
|
|
68
|
-
"author": "Tagada Pay",
|
|
69
|
-
"license": "MIT",
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"@basis-theory/apple-pay-js": "^2.0.2",
|
|
72
|
-
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
73
|
-
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
74
|
-
"@basis-theory/web-threeds": "^1.0.1",
|
|
75
|
-
"@google-pay/button-react": "^3.0.10",
|
|
76
|
-
"@tagadapay/plugin-sdk": "link:",
|
|
77
|
-
"@tanstack/react-query": "^5.90.2",
|
|
78
|
-
"@ua-parser-js/pro-enterprise": "^2.0.6",
|
|
79
|
-
"axios": "^1.10.0",
|
|
80
|
-
"iso3166-2-db": "^2.3.11",
|
|
81
|
-
"path-to-regexp": "^8.2.0",
|
|
82
|
-
"react-intl": "^7.1.11",
|
|
83
|
-
"swr": "^2.3.6"
|
|
84
|
-
},
|
|
85
|
-
"devDependencies": {
|
|
86
|
-
"@types/jest": "^29.5.0",
|
|
87
|
-
"@types/node": "^18.0.0",
|
|
88
|
-
"@types/react": "^19",
|
|
89
|
-
"@types/react-dom": "^19",
|
|
90
|
-
"esbuild": "^0.24.2",
|
|
91
|
-
"jest": "^29.5.0",
|
|
92
|
-
"ts-jest": "^29.1.0",
|
|
93
|
-
"typescript": "^5.0.0"
|
|
94
|
-
},
|
|
95
|
-
"peerDependencies": {
|
|
96
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
97
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
98
|
-
},
|
|
99
|
-
"files": [
|
|
100
|
-
"dist/**/*",
|
|
101
|
-
"README.md",
|
|
102
|
-
"build-cdn.js"
|
|
103
|
-
],
|
|
104
|
-
"repository": {
|
|
105
|
-
"type": "git",
|
|
106
|
-
"url": "git+https://github.com/tagadapay/plugin-sdk.git"
|
|
107
|
-
},
|
|
108
|
-
"bugs": {
|
|
109
|
-
"url": "https://github.com/tagadapay/plugin-sdk/issues"
|
|
110
|
-
},
|
|
111
|
-
"homepage": "https://github.com/tagadapay/plugin-sdk#readme"
|
|
112
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tagadapay/plugin-sdk",
|
|
3
|
+
"version": "3.1.5",
|
|
4
|
+
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
+
"main": "dist/index.js",
|
|
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
|
+
"./v2": {
|
|
19
|
+
"types": "./dist/v2/index.d.ts",
|
|
20
|
+
"import": "./dist/v2/index.js",
|
|
21
|
+
"require": "./dist/v2/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./v2/standalone": {
|
|
24
|
+
"types": "./dist/v2/standalone/index.d.ts",
|
|
25
|
+
"import": "./dist/v2/standalone/index.js",
|
|
26
|
+
"require": "./dist/v2/standalone/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./external-tracker": {
|
|
29
|
+
"browser": "./dist/external-tracker.min.js",
|
|
30
|
+
"default": "./dist/external-tracker.min.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc && npm run build:cdn",
|
|
35
|
+
"build:cdn": "node build-cdn.js",
|
|
36
|
+
"build:ts": "tsc",
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"lint": "echo \"No linting configured\"",
|
|
39
|
+
"test": "jest --no-watchman",
|
|
40
|
+
"test:watch": "jest --watch --no-watchman",
|
|
41
|
+
"test:coverage": "jest --coverage --no-watchman",
|
|
42
|
+
"dev": "tsc --watch",
|
|
43
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
44
|
+
"publish:patch": "npm version patch && npm publish",
|
|
45
|
+
"publish:minor": "npm version minor && npm publish",
|
|
46
|
+
"publish:major": "npm version major && npm publish",
|
|
47
|
+
"publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
48
|
+
"publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
|
|
49
|
+
"version:patch": "npm version patch",
|
|
50
|
+
"version:minor": "npm version minor",
|
|
51
|
+
"version:major": "npm version major",
|
|
52
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
53
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
54
|
+
"version:check": "node version-sync.js check",
|
|
55
|
+
"version:sync": "node version-sync.js sync",
|
|
56
|
+
"version:list": "node version-sync.js list",
|
|
57
|
+
"version:next": "node version-sync.js next",
|
|
58
|
+
"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\")"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"tagadapay",
|
|
62
|
+
"cms",
|
|
63
|
+
"plugin",
|
|
64
|
+
"sdk",
|
|
65
|
+
"react",
|
|
66
|
+
"typescript"
|
|
67
|
+
],
|
|
68
|
+
"author": "Tagada Pay",
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@basis-theory/apple-pay-js": "^2.0.2",
|
|
72
|
+
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
73
|
+
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
74
|
+
"@basis-theory/web-threeds": "^1.0.1",
|
|
75
|
+
"@google-pay/button-react": "^3.0.10",
|
|
76
|
+
"@tagadapay/plugin-sdk": "link:",
|
|
77
|
+
"@tanstack/react-query": "^5.90.2",
|
|
78
|
+
"@ua-parser-js/pro-enterprise": "^2.0.6",
|
|
79
|
+
"axios": "^1.10.0",
|
|
80
|
+
"iso3166-2-db": "^2.3.11",
|
|
81
|
+
"path-to-regexp": "^8.2.0",
|
|
82
|
+
"react-intl": "^7.1.11",
|
|
83
|
+
"swr": "^2.3.6"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@types/jest": "^29.5.0",
|
|
87
|
+
"@types/node": "^18.0.0",
|
|
88
|
+
"@types/react": "^19",
|
|
89
|
+
"@types/react-dom": "^19",
|
|
90
|
+
"esbuild": "^0.24.2",
|
|
91
|
+
"jest": "^29.5.0",
|
|
92
|
+
"ts-jest": "^29.1.0",
|
|
93
|
+
"typescript": "^5.0.0"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
97
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
98
|
+
},
|
|
99
|
+
"files": [
|
|
100
|
+
"dist/**/*",
|
|
101
|
+
"README.md",
|
|
102
|
+
"build-cdn.js"
|
|
103
|
+
],
|
|
104
|
+
"repository": {
|
|
105
|
+
"type": "git",
|
|
106
|
+
"url": "git+https://github.com/tagadapay/plugin-sdk.git"
|
|
107
|
+
},
|
|
108
|
+
"bugs": {
|
|
109
|
+
"url": "https://github.com/tagadapay/plugin-sdk/issues"
|
|
110
|
+
},
|
|
111
|
+
"homepage": "https://github.com/tagadapay/plugin-sdk#readme"
|
|
112
|
+
}
|