@tagadapay/plugin-sdk 3.0.3 ā 3.0.9
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/build-cdn.js +113 -0
- package/dist/config/basisTheory.d.ts +26 -0
- package/dist/config/basisTheory.js +29 -0
- package/dist/external-tracker.js +4947 -0
- package/dist/external-tracker.min.js +11 -0
- package/dist/external-tracker.min.js.map +7 -0
- package/dist/react/config/payment.d.ts +8 -8
- package/dist/react/config/payment.js +17 -21
- package/dist/react/hooks/useApplePay.js +1 -1
- package/dist/react/hooks/usePayment.js +1 -3
- package/dist/react/hooks/useThreeds.js +2 -2
- package/dist/v2/core/client.d.ts +30 -3
- package/dist/v2/core/client.js +219 -8
- package/dist/v2/core/config/environment.d.ts +16 -3
- package/dist/v2/core/config/environment.js +72 -3
- package/dist/v2/core/funnelClient.d.ts +4 -0
- package/dist/v2/core/funnelClient.js +106 -4
- package/dist/v2/core/resources/funnel.d.ts +22 -0
- package/dist/v2/core/resources/offers.d.ts +64 -3
- package/dist/v2/core/resources/offers.js +112 -10
- package/dist/v2/core/resources/postPurchases.js +4 -1
- package/dist/v2/core/utils/configHotReload.d.ts +39 -0
- package/dist/v2/core/utils/configHotReload.js +75 -0
- package/dist/v2/core/utils/eventBus.d.ts +11 -0
- package/dist/v2/core/utils/eventBus.js +34 -0
- package/dist/v2/core/utils/pluginConfig.d.ts +14 -5
- package/dist/v2/core/utils/pluginConfig.js +74 -59
- package/dist/v2/core/utils/previewMode.d.ts +114 -0
- package/dist/v2/core/utils/previewMode.js +379 -0
- package/dist/v2/core/utils/sessionStorage.d.ts +5 -0
- package/dist/v2/core/utils/sessionStorage.js +22 -0
- package/dist/v2/index.d.ts +4 -1
- package/dist/v2/index.js +3 -1
- package/dist/v2/react/hooks/useOfferQuery.js +50 -17
- package/dist/v2/react/hooks/usePaymentQuery.js +1 -3
- package/dist/v2/react/hooks/usePreviewOffer.d.ts +84 -0
- package/dist/v2/react/hooks/usePreviewOffer.js +290 -0
- package/dist/v2/react/hooks/useThreeds.js +2 -2
- package/dist/v2/react/index.d.ts +2 -0
- package/dist/v2/react/index.js +1 -0
- package/dist/v2/react/providers/TagadaProvider.js +49 -32
- package/dist/v2/standalone/external-tracker.d.ts +119 -0
- package/dist/v2/standalone/external-tracker.js +260 -0
- package/dist/v2/standalone/index.d.ts +2 -0
- package/dist/v2/standalone/index.js +6 -0
- package/package.json +11 -3
- package/dist/v2/react/hooks/useOffersQuery.d.ts +0 -12
- package/dist/v2/react/hooks/useOffersQuery.js +0 -404
package/build-cdn.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build script for creating standalone CDN bundles
|
|
5
|
+
*
|
|
6
|
+
* This creates:
|
|
7
|
+
* - dist/external-tracker.min.js - Minified UMD bundle for CDN
|
|
8
|
+
* - dist/external-tracker.js - Non-minified for debugging
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* node build-cdn.js
|
|
12
|
+
* npm run build:cdn
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const esbuild = require('esbuild');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const ENTRY_POINT = path.join(__dirname, 'src/v2/standalone/external-tracker.ts');
|
|
19
|
+
const OUT_DIR = path.join(__dirname, 'dist');
|
|
20
|
+
|
|
21
|
+
async function build() {
|
|
22
|
+
console.log('šØ Building external-tracker CDN bundles...\n');
|
|
23
|
+
|
|
24
|
+
// Build minified UMD bundle
|
|
25
|
+
await esbuild.build({
|
|
26
|
+
entryPoints: [ENTRY_POINT],
|
|
27
|
+
bundle: true,
|
|
28
|
+
minify: true,
|
|
29
|
+
sourcemap: true,
|
|
30
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
31
|
+
format: 'iife',
|
|
32
|
+
globalName: 'TagadaTrackerBundle',
|
|
33
|
+
outfile: path.join(OUT_DIR, 'external-tracker.min.js'),
|
|
34
|
+
// Don't include React - this is a standalone script
|
|
35
|
+
external: [],
|
|
36
|
+
// Define globals for browser environment
|
|
37
|
+
define: {
|
|
38
|
+
'process.env.NODE_ENV': '"production"',
|
|
39
|
+
},
|
|
40
|
+
// Footer to expose TagadaTracker on window
|
|
41
|
+
footer: {
|
|
42
|
+
js: `
|
|
43
|
+
// Expose TagadaTracker globally (if not already done in bundle)
|
|
44
|
+
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
45
|
+
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
46
|
+
}
|
|
47
|
+
`.trim(),
|
|
48
|
+
},
|
|
49
|
+
banner: {
|
|
50
|
+
js: `/**
|
|
51
|
+
* TagadaPay External Tracker v${require('./package.json').version}
|
|
52
|
+
* CDN Bundle - Standalone tracking for external pages
|
|
53
|
+
* @license MIT
|
|
54
|
+
*/`,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log(' ā
dist/external-tracker.min.js (minified + sourcemap)');
|
|
59
|
+
|
|
60
|
+
// Build non-minified version for debugging
|
|
61
|
+
await esbuild.build({
|
|
62
|
+
entryPoints: [ENTRY_POINT],
|
|
63
|
+
bundle: true,
|
|
64
|
+
minify: false,
|
|
65
|
+
sourcemap: false,
|
|
66
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
67
|
+
format: 'iife',
|
|
68
|
+
globalName: 'TagadaTrackerBundle',
|
|
69
|
+
outfile: path.join(OUT_DIR, 'external-tracker.js'),
|
|
70
|
+
external: [],
|
|
71
|
+
define: {
|
|
72
|
+
'process.env.NODE_ENV': '"development"',
|
|
73
|
+
},
|
|
74
|
+
footer: {
|
|
75
|
+
js: `
|
|
76
|
+
// Expose TagadaTracker globally
|
|
77
|
+
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
78
|
+
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
79
|
+
}
|
|
80
|
+
`.trim(),
|
|
81
|
+
},
|
|
82
|
+
banner: {
|
|
83
|
+
js: `/**
|
|
84
|
+
* TagadaPay External Tracker v${require('./package.json').version}
|
|
85
|
+
* CDN Bundle - Standalone tracking for external pages (Debug Build)
|
|
86
|
+
* @license MIT
|
|
87
|
+
*/`,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
console.log(' ā
dist/external-tracker.js (non-minified for debugging)');
|
|
92
|
+
|
|
93
|
+
// Get file sizes
|
|
94
|
+
const fs = require('fs');
|
|
95
|
+
const minSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.min.js')).size;
|
|
96
|
+
const fullSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.js')).size;
|
|
97
|
+
|
|
98
|
+
console.log('\nš¦ Bundle sizes:');
|
|
99
|
+
console.log(` external-tracker.min.js: ${(minSize / 1024).toFixed(2)} KB`);
|
|
100
|
+
console.log(` external-tracker.js: ${(fullSize / 1024).toFixed(2)} KB`);
|
|
101
|
+
|
|
102
|
+
console.log('\n⨠CDN build complete!\n');
|
|
103
|
+
console.log('Usage via CDN:');
|
|
104
|
+
console.log(' <script src="https://cdn.jsdelivr.net/npm/@tagadapay/plugin-sdk/dist/external-tracker.min.js"></script>');
|
|
105
|
+
console.log(' <script>TagadaTracker.init({ storeId: "store_xxx", ... });</script>\n');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
build().catch((err) => {
|
|
109
|
+
console.error('Build failed:', err);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basis Theory Configuration
|
|
3
|
+
*
|
|
4
|
+
* API keys and tenant IDs for Basis Theory integration
|
|
5
|
+
* Key selection based on environment (production vs staging/dev)
|
|
6
|
+
*/
|
|
7
|
+
export declare const BASIS_THEORY_CONFIG: {
|
|
8
|
+
readonly production: {
|
|
9
|
+
readonly tenantId: "b1636929-db11-4b01-b2c2-6a97b3444061";
|
|
10
|
+
readonly publicKey: "key_prod_us_pub_PNMB2AiaECJ463K6QAPNU6";
|
|
11
|
+
};
|
|
12
|
+
readonly test: {
|
|
13
|
+
readonly tenantId: "99821999-faf5-4427-a92c-9267cb930540";
|
|
14
|
+
readonly publicKey: "key_test_us_pub_VExdfbFQARn821iqP8zNaq";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Get Basis Theory keys based on environment
|
|
19
|
+
*
|
|
20
|
+
* @param isProduction - Whether the environment is production
|
|
21
|
+
* @returns Object with tenantId and apiKey
|
|
22
|
+
*/
|
|
23
|
+
export declare function getBasisTheoryKeys(isProduction: boolean): {
|
|
24
|
+
tenantId: "b1636929-db11-4b01-b2c2-6a97b3444061" | "99821999-faf5-4427-a92c-9267cb930540";
|
|
25
|
+
apiKey: "key_prod_us_pub_PNMB2AiaECJ463K6QAPNU6" | "key_test_us_pub_VExdfbFQARn821iqP8zNaq";
|
|
26
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basis Theory Configuration
|
|
3
|
+
*
|
|
4
|
+
* API keys and tenant IDs for Basis Theory integration
|
|
5
|
+
* Key selection based on environment (production vs staging/dev)
|
|
6
|
+
*/
|
|
7
|
+
export const BASIS_THEORY_CONFIG = {
|
|
8
|
+
production: {
|
|
9
|
+
tenantId: 'b1636929-db11-4b01-b2c2-6a97b3444061',
|
|
10
|
+
publicKey: 'key_prod_us_pub_PNMB2AiaECJ463K6QAPNU6',
|
|
11
|
+
},
|
|
12
|
+
test: {
|
|
13
|
+
tenantId: '99821999-faf5-4427-a92c-9267cb930540',
|
|
14
|
+
publicKey: 'key_test_us_pub_VExdfbFQARn821iqP8zNaq',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Get Basis Theory keys based on environment
|
|
19
|
+
*
|
|
20
|
+
* @param isProduction - Whether the environment is production
|
|
21
|
+
* @returns Object with tenantId and apiKey
|
|
22
|
+
*/
|
|
23
|
+
export function getBasisTheoryKeys(isProduction) {
|
|
24
|
+
const config = isProduction ? BASIS_THEORY_CONFIG.production : BASIS_THEORY_CONFIG.test;
|
|
25
|
+
return {
|
|
26
|
+
tenantId: config.tenantId,
|
|
27
|
+
apiKey: config.publicKey,
|
|
28
|
+
};
|
|
29
|
+
}
|