@tagadapay/plugin-sdk 3.1.11 ā 3.1.22
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 +231 -228
- package/dist/data/iso3166.d.ts +23 -33
- package/dist/data/iso3166.js +134 -198
- package/dist/data/languages.d.ts +5 -64
- package/dist/data/languages.js +23 -143
- package/dist/external-tracker.js +968 -102
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/hooks/useISOData.js +1 -1
- package/dist/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/react/hooks/useShippingRates.d.ts +6 -0
- package/dist/react/hooks/useShippingRates.js +38 -0
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/react/services/apiService.d.ts +21 -0
- package/dist/react/services/apiService.js +10 -0
- package/dist/tagada-sdk.js +2079 -179
- package/dist/tagada-sdk.min.js +4 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/client.d.ts +4 -2
- package/dist/v2/core/client.js +4 -3
- package/dist/v2/core/errors.d.ts +75 -0
- package/dist/v2/core/errors.js +104 -0
- package/dist/v2/core/funnelClient.d.ts +16 -15
- package/dist/v2/core/funnelClient.js +1 -1
- package/dist/v2/core/index.d.ts +1 -0
- package/dist/v2/core/index.js +2 -0
- package/dist/v2/core/pixelMapping.d.ts +49 -0
- package/dist/v2/core/pixelMapping.js +325 -0
- package/dist/v2/core/resources/apiClient.d.ts +2 -0
- package/dist/v2/core/resources/apiClient.js +52 -9
- package/dist/v2/core/resources/checkout.d.ts +89 -30
- package/dist/v2/core/resources/checkout.js +8 -0
- package/dist/v2/core/resources/customer.d.ts +20 -19
- package/dist/v2/core/resources/funnel.d.ts +17 -17
- package/dist/v2/core/resources/payments.d.ts +84 -13
- package/dist/v2/core/resources/payments.js +26 -9
- package/dist/v2/core/resources/shippingRates.d.ts +15 -0
- package/dist/v2/core/resources/shippingRates.js +11 -0
- package/dist/v2/core/types.d.ts +50 -12
- package/dist/v2/core/types.js +0 -3
- package/dist/v2/core/utils/checkout.d.ts +2 -2
- package/dist/v2/core/utils/checkout.js +7 -2
- package/dist/v2/core/utils/order.d.ts +11 -9
- package/dist/v2/core/utils/previewModeIndicator.js +101 -101
- package/dist/v2/index.d.ts +4 -2
- package/dist/v2/index.js +1 -1
- package/dist/v2/react/components/ApplePayButton.js +13 -4
- package/dist/v2/react/components/FunnelScriptInjector.js +51 -30
- package/dist/v2/react/components/WhopCheckout.d.ts +24 -0
- package/dist/v2/react/components/WhopCheckout.js +231 -0
- package/dist/v2/react/hooks/__examples__/FunnelContextExample.js +1 -1
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +181 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.d.ts +9 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.js +21 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.js +187 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.js +91 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.d.ts +24 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.js +221 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.d.ts +15 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +142 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.d.ts +3 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +13 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.d.ts +10 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.js +35 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.js +192 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.js +81 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.js +84 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.d.ts +14 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.js +36 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.d.ts +31 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +212 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.d.ts +14 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.js +207 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.d.ts +12 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.js +101 -0
- package/dist/v2/react/hooks/useCheckoutQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +45 -0
- package/dist/v2/react/hooks/useFunnel.d.ts +1 -2
- package/dist/v2/react/hooks/useGeoLocation.d.ts +2 -1
- package/dist/v2/react/hooks/useGeoLocation.js +4 -2
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +82 -33
- package/dist/v2/react/hooks/useISOData.js +1 -1
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/v2/react/hooks/usePaymentQuery.d.ts +18 -5
- package/dist/v2/react/hooks/usePaymentQuery.js +63 -1015
- package/dist/v2/react/hooks/usePaymentRetrieve.d.ts +3 -2
- package/dist/v2/react/hooks/usePaymentRetrieve.js +3 -1
- package/dist/v2/react/hooks/usePixelTracking.d.ts +5 -43
- package/dist/v2/react/hooks/usePixelTracking.js +213 -407
- package/dist/v2/react/hooks/useShippingRatesQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useShippingRatesQuery.js +47 -4
- package/dist/v2/react/hooks/useStepConfig.d.ts +2 -8
- package/dist/v2/react/hooks/useStepConfig.js +1 -1
- package/dist/v2/react/hooks/useWhopPaymentPolling.d.ts +30 -0
- package/dist/v2/react/hooks/useWhopPaymentPolling.js +61 -0
- package/dist/v2/react/index.d.ts +7 -0
- package/dist/v2/react/index.js +4 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +2 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +3 -1
- package/dist/v2/react/providers/TagadaProvider.js +76 -7
- package/dist/v2/standalone/external-tracker.d.ts +52 -46
- package/dist/v2/standalone/external-tracker.js +205 -98
- package/dist/v2/standalone/index.d.ts +22 -0
- package/dist/v2/standalone/index.js +125 -0
- package/package.json +112 -112
- package/dist/react/utils/__tests__/urlUtils.test.d.ts +0 -1
- package/dist/react/utils/__tests__/urlUtils.test.js +0 -189
- package/dist/v2/core/__tests__/pathRemapping.test.d.ts +0 -11
- package/dist/v2/core/__tests__/pathRemapping.test.js +0 -776
package/build-cdn.js
CHANGED
|
@@ -1,228 +1,231 @@
|
|
|
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 (tracking only)
|
|
8
|
-
* - dist/external-tracker.js - Non-minified for debugging
|
|
9
|
-
* - dist/tagada-sdk.min.js - Full standalone SDK bundle for CDN
|
|
10
|
-
* - dist/tagada-sdk.js - Non-minified for debugging
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* node build-cdn.js
|
|
14
|
-
* npm run build:cdn
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const esbuild = require('esbuild');
|
|
18
|
-
const path = require('path');
|
|
19
|
-
const fs = require('fs');
|
|
20
|
-
|
|
21
|
-
const TRACKER_ENTRY = path.join(__dirname, 'src/v2/standalone/external-tracker.ts');
|
|
22
|
-
const SDK_ENTRY = path.join(__dirname, 'src/v2/standalone/index.ts');
|
|
23
|
-
const OUT_DIR = path.join(__dirname, 'dist');
|
|
24
|
-
|
|
25
|
-
async function build() {
|
|
26
|
-
console.log('šØ Building CDN bundles...\n');
|
|
27
|
-
|
|
28
|
-
// ==========================================================================
|
|
29
|
-
// EXTERNAL TRACKER (lightweight, tracking only)
|
|
30
|
-
// ==========================================================================
|
|
31
|
-
console.log('š¦ Building external-tracker...');
|
|
32
|
-
|
|
33
|
-
// Build minified UMD bundle
|
|
34
|
-
await esbuild.build({
|
|
35
|
-
entryPoints: [TRACKER_ENTRY],
|
|
36
|
-
bundle: true,
|
|
37
|
-
minify: true,
|
|
38
|
-
sourcemap: true,
|
|
39
|
-
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
40
|
-
format: 'iife',
|
|
41
|
-
globalName: 'TagadaTrackerBundle',
|
|
42
|
-
outfile: path.join(OUT_DIR, 'external-tracker.min.js'),
|
|
43
|
-
// Don't include React - this is a standalone script
|
|
44
|
-
external: [],
|
|
45
|
-
// Define globals for browser environment
|
|
46
|
-
define: {
|
|
47
|
-
'process.env.NODE_ENV': '"production"',
|
|
48
|
-
},
|
|
49
|
-
// Footer to expose TagadaTracker on window
|
|
50
|
-
footer: {
|
|
51
|
-
js: `
|
|
52
|
-
// Expose TagadaTracker globally (if not already done in bundle)
|
|
53
|
-
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
54
|
-
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
55
|
-
}
|
|
56
|
-
`.trim(),
|
|
57
|
-
},
|
|
58
|
-
banner: {
|
|
59
|
-
js: `/**
|
|
60
|
-
* TagadaPay External Tracker v${require('./package.json').version}
|
|
61
|
-
* CDN Bundle - Standalone tracking for external pages
|
|
62
|
-
* @license MIT
|
|
63
|
-
*/`,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
console.log(' ā
dist/external-tracker.min.js (minified + sourcemap)');
|
|
68
|
-
|
|
69
|
-
// Build non-minified version for debugging
|
|
70
|
-
await esbuild.build({
|
|
71
|
-
entryPoints: [TRACKER_ENTRY],
|
|
72
|
-
bundle: true,
|
|
73
|
-
minify: false,
|
|
74
|
-
sourcemap: false,
|
|
75
|
-
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
76
|
-
format: 'iife',
|
|
77
|
-
globalName: 'TagadaTrackerBundle',
|
|
78
|
-
outfile: path.join(OUT_DIR, 'external-tracker.js'),
|
|
79
|
-
external: [],
|
|
80
|
-
define: {
|
|
81
|
-
'process.env.NODE_ENV': '"development"',
|
|
82
|
-
},
|
|
83
|
-
footer: {
|
|
84
|
-
js: `
|
|
85
|
-
// Expose TagadaTracker globally
|
|
86
|
-
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
87
|
-
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
88
|
-
}
|
|
89
|
-
`.trim(),
|
|
90
|
-
},
|
|
91
|
-
banner: {
|
|
92
|
-
js: `/**
|
|
93
|
-
* TagadaPay External Tracker v${require('./package.json').version}
|
|
94
|
-
* CDN Bundle - Standalone tracking for external pages (Debug Build)
|
|
95
|
-
* @license MIT
|
|
96
|
-
*/`,
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
console.log(' ā
dist/external-tracker.js (non-minified for debugging)');
|
|
101
|
-
|
|
102
|
-
// ==========================================================================
|
|
103
|
-
// FULL STANDALONE SDK (createTagadaClient, config loading, hot reload, etc.)
|
|
104
|
-
// ==========================================================================
|
|
105
|
-
console.log('\nš¦ Building tagada-sdk (full standalone SDK)...');
|
|
106
|
-
|
|
107
|
-
// Build minified SDK bundle
|
|
108
|
-
await esbuild.build({
|
|
109
|
-
entryPoints: [SDK_ENTRY],
|
|
110
|
-
bundle: true,
|
|
111
|
-
minify: true,
|
|
112
|
-
sourcemap: true,
|
|
113
|
-
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
114
|
-
format: 'iife',
|
|
115
|
-
globalName: 'TagadaSDKBundle',
|
|
116
|
-
outfile: path.join(OUT_DIR, 'tagada-sdk.min.js'),
|
|
117
|
-
external: [],
|
|
118
|
-
define: {
|
|
119
|
-
'process.env.NODE_ENV': '"production"',
|
|
120
|
-
},
|
|
121
|
-
footer: {
|
|
122
|
-
js: `
|
|
123
|
-
// Expose SDK under window.tgd namespace (clean, single global)
|
|
124
|
-
if (typeof window !== 'undefined' && TagadaSDKBundle) {
|
|
125
|
-
window.tgd = window.tgd || {};
|
|
126
|
-
// Core
|
|
127
|
-
window.tgd.createTagadaClient = TagadaSDKBundle.createTagadaClient;
|
|
128
|
-
// Config utilities
|
|
129
|
-
window.tgd.getPluginConfig = TagadaSDKBundle.getPluginConfig;
|
|
130
|
-
window.tgd.loadPluginConfig = TagadaSDKBundle.loadPluginConfig;
|
|
131
|
-
// Hot reload
|
|
132
|
-
window.tgd.onConfigUpdate = TagadaSDKBundle.onConfigUpdate;
|
|
133
|
-
window.tgd.sendConfigUpdate = TagadaSDKBundle.sendConfigUpdate;
|
|
134
|
-
window.tgd.broadcastConfigUpdate = TagadaSDKBundle.broadcastConfigUpdate;
|
|
135
|
-
// Currency
|
|
136
|
-
window.tgd.formatMoney = TagadaSDKBundle.formatMoney;
|
|
137
|
-
//
|
|
138
|
-
window.tgd.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
window.tgd
|
|
175
|
-
window.tgd.
|
|
176
|
-
window.tgd.
|
|
177
|
-
window.tgd.
|
|
178
|
-
window.tgd.
|
|
179
|
-
window.tgd.
|
|
180
|
-
window.tgd.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
console.log(
|
|
206
|
-
console.log(`
|
|
207
|
-
|
|
208
|
-
console.log(
|
|
209
|
-
console.log(
|
|
210
|
-
|
|
211
|
-
console.log('
|
|
212
|
-
console.log('
|
|
213
|
-
console.log('
|
|
214
|
-
console.log('');
|
|
215
|
-
console.log('
|
|
216
|
-
console.log(' <script
|
|
217
|
-
console.log('
|
|
218
|
-
console.log('
|
|
219
|
-
console.log('
|
|
220
|
-
console.log('
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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 (tracking only)
|
|
8
|
+
* - dist/external-tracker.js - Non-minified for debugging
|
|
9
|
+
* - dist/tagada-sdk.min.js - Full standalone SDK bundle for CDN
|
|
10
|
+
* - dist/tagada-sdk.js - Non-minified for debugging
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* node build-cdn.js
|
|
14
|
+
* npm run build:cdn
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const esbuild = require('esbuild');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
|
|
21
|
+
const TRACKER_ENTRY = path.join(__dirname, 'src/v2/standalone/external-tracker.ts');
|
|
22
|
+
const SDK_ENTRY = path.join(__dirname, 'src/v2/standalone/index.ts');
|
|
23
|
+
const OUT_DIR = path.join(__dirname, 'dist');
|
|
24
|
+
|
|
25
|
+
async function build() {
|
|
26
|
+
console.log('šØ Building CDN bundles...\n');
|
|
27
|
+
|
|
28
|
+
// ==========================================================================
|
|
29
|
+
// EXTERNAL TRACKER (lightweight, tracking only)
|
|
30
|
+
// ==========================================================================
|
|
31
|
+
console.log('š¦ Building external-tracker...');
|
|
32
|
+
|
|
33
|
+
// Build minified UMD bundle
|
|
34
|
+
await esbuild.build({
|
|
35
|
+
entryPoints: [TRACKER_ENTRY],
|
|
36
|
+
bundle: true,
|
|
37
|
+
minify: true,
|
|
38
|
+
sourcemap: true,
|
|
39
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
40
|
+
format: 'iife',
|
|
41
|
+
globalName: 'TagadaTrackerBundle',
|
|
42
|
+
outfile: path.join(OUT_DIR, 'external-tracker.min.js'),
|
|
43
|
+
// Don't include React - this is a standalone script
|
|
44
|
+
external: [],
|
|
45
|
+
// Define globals for browser environment
|
|
46
|
+
define: {
|
|
47
|
+
'process.env.NODE_ENV': '"production"',
|
|
48
|
+
},
|
|
49
|
+
// Footer to expose TagadaTracker on window
|
|
50
|
+
footer: {
|
|
51
|
+
js: `
|
|
52
|
+
// Expose TagadaTracker globally (if not already done in bundle)
|
|
53
|
+
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
54
|
+
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
55
|
+
}
|
|
56
|
+
`.trim(),
|
|
57
|
+
},
|
|
58
|
+
banner: {
|
|
59
|
+
js: `/**
|
|
60
|
+
* TagadaPay External Tracker v${require('./package.json').version}
|
|
61
|
+
* CDN Bundle - Standalone tracking for external pages
|
|
62
|
+
* @license MIT
|
|
63
|
+
*/`,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log(' ā
dist/external-tracker.min.js (minified + sourcemap)');
|
|
68
|
+
|
|
69
|
+
// Build non-minified version for debugging
|
|
70
|
+
await esbuild.build({
|
|
71
|
+
entryPoints: [TRACKER_ENTRY],
|
|
72
|
+
bundle: true,
|
|
73
|
+
minify: false,
|
|
74
|
+
sourcemap: false,
|
|
75
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
76
|
+
format: 'iife',
|
|
77
|
+
globalName: 'TagadaTrackerBundle',
|
|
78
|
+
outfile: path.join(OUT_DIR, 'external-tracker.js'),
|
|
79
|
+
external: [],
|
|
80
|
+
define: {
|
|
81
|
+
'process.env.NODE_ENV': '"development"',
|
|
82
|
+
},
|
|
83
|
+
footer: {
|
|
84
|
+
js: `
|
|
85
|
+
// Expose TagadaTracker globally
|
|
86
|
+
if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
|
|
87
|
+
window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;
|
|
88
|
+
}
|
|
89
|
+
`.trim(),
|
|
90
|
+
},
|
|
91
|
+
banner: {
|
|
92
|
+
js: `/**
|
|
93
|
+
* TagadaPay External Tracker v${require('./package.json').version}
|
|
94
|
+
* CDN Bundle - Standalone tracking for external pages (Debug Build)
|
|
95
|
+
* @license MIT
|
|
96
|
+
*/`,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
console.log(' ā
dist/external-tracker.js (non-minified for debugging)');
|
|
101
|
+
|
|
102
|
+
// ==========================================================================
|
|
103
|
+
// FULL STANDALONE SDK (createTagadaClient, config loading, hot reload, etc.)
|
|
104
|
+
// ==========================================================================
|
|
105
|
+
console.log('\nš¦ Building tagada-sdk (full standalone SDK)...');
|
|
106
|
+
|
|
107
|
+
// Build minified SDK bundle
|
|
108
|
+
await esbuild.build({
|
|
109
|
+
entryPoints: [SDK_ENTRY],
|
|
110
|
+
bundle: true,
|
|
111
|
+
minify: true,
|
|
112
|
+
sourcemap: true,
|
|
113
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
114
|
+
format: 'iife',
|
|
115
|
+
globalName: 'TagadaSDKBundle',
|
|
116
|
+
outfile: path.join(OUT_DIR, 'tagada-sdk.min.js'),
|
|
117
|
+
external: [],
|
|
118
|
+
define: {
|
|
119
|
+
'process.env.NODE_ENV': '"production"',
|
|
120
|
+
},
|
|
121
|
+
footer: {
|
|
122
|
+
js: `
|
|
123
|
+
// Expose SDK under window.tgd namespace (clean, single global)
|
|
124
|
+
if (typeof window !== 'undefined' && TagadaSDKBundle) {
|
|
125
|
+
window.tgd = window.tgd || {};
|
|
126
|
+
// Core
|
|
127
|
+
window.tgd.createTagadaClient = TagadaSDKBundle.createTagadaClient;
|
|
128
|
+
// Config utilities
|
|
129
|
+
window.tgd.getPluginConfig = TagadaSDKBundle.getPluginConfig;
|
|
130
|
+
window.tgd.loadPluginConfig = TagadaSDKBundle.loadPluginConfig;
|
|
131
|
+
// Hot reload
|
|
132
|
+
window.tgd.onConfigUpdate = TagadaSDKBundle.onConfigUpdate;
|
|
133
|
+
window.tgd.sendConfigUpdate = TagadaSDKBundle.sendConfigUpdate;
|
|
134
|
+
window.tgd.broadcastConfigUpdate = TagadaSDKBundle.broadcastConfigUpdate;
|
|
135
|
+
// Currency
|
|
136
|
+
window.tgd.formatMoney = TagadaSDKBundle.formatMoney;
|
|
137
|
+
// Script injection (auto-runs on load, but can be manually called)
|
|
138
|
+
window.tgd.injectStepConfigScripts = TagadaSDKBundle.injectStepConfigScripts;
|
|
139
|
+
// Full bundle reference
|
|
140
|
+
window.tgd.sdk = TagadaSDKBundle;
|
|
141
|
+
}
|
|
142
|
+
`.trim(),
|
|
143
|
+
},
|
|
144
|
+
banner: {
|
|
145
|
+
js: `/**
|
|
146
|
+
* TagadaPay SDK v${require('./package.json').version}
|
|
147
|
+
* CDN Bundle - Full standalone SDK for external/vanilla pages
|
|
148
|
+
* Usage: window.tgd.createTagadaClient(), window.tgd.formatMoney(), etc.
|
|
149
|
+
* @license MIT
|
|
150
|
+
*/`,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
console.log(' ā
dist/tagada-sdk.min.js (minified + sourcemap)');
|
|
155
|
+
|
|
156
|
+
// Build non-minified SDK version for debugging
|
|
157
|
+
await esbuild.build({
|
|
158
|
+
entryPoints: [SDK_ENTRY],
|
|
159
|
+
bundle: true,
|
|
160
|
+
minify: false,
|
|
161
|
+
sourcemap: false,
|
|
162
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
163
|
+
format: 'iife',
|
|
164
|
+
globalName: 'TagadaSDKBundle',
|
|
165
|
+
outfile: path.join(OUT_DIR, 'tagada-sdk.js'),
|
|
166
|
+
external: [],
|
|
167
|
+
define: {
|
|
168
|
+
'process.env.NODE_ENV': '"development"',
|
|
169
|
+
},
|
|
170
|
+
footer: {
|
|
171
|
+
js: `
|
|
172
|
+
// Expose SDK under window.tgd namespace (clean, single global)
|
|
173
|
+
if (typeof window !== 'undefined' && TagadaSDKBundle) {
|
|
174
|
+
window.tgd = window.tgd || {};
|
|
175
|
+
window.tgd.createTagadaClient = TagadaSDKBundle.createTagadaClient;
|
|
176
|
+
window.tgd.getPluginConfig = TagadaSDKBundle.getPluginConfig;
|
|
177
|
+
window.tgd.loadPluginConfig = TagadaSDKBundle.loadPluginConfig;
|
|
178
|
+
window.tgd.onConfigUpdate = TagadaSDKBundle.onConfigUpdate;
|
|
179
|
+
window.tgd.sendConfigUpdate = TagadaSDKBundle.sendConfigUpdate;
|
|
180
|
+
window.tgd.broadcastConfigUpdate = TagadaSDKBundle.broadcastConfigUpdate;
|
|
181
|
+
window.tgd.formatMoney = TagadaSDKBundle.formatMoney;
|
|
182
|
+
window.tgd.injectStepConfigScripts = TagadaSDKBundle.injectStepConfigScripts;
|
|
183
|
+
window.tgd.sdk = TagadaSDKBundle;
|
|
184
|
+
}
|
|
185
|
+
`.trim(),
|
|
186
|
+
},
|
|
187
|
+
banner: {
|
|
188
|
+
js: `/**
|
|
189
|
+
* TagadaPay SDK v${require('./package.json').version}
|
|
190
|
+
* CDN Bundle - Full standalone SDK (Debug Build)
|
|
191
|
+
* Usage: window.tgd.createTagadaClient(), window.tgd.formatMoney(), etc.
|
|
192
|
+
* @license MIT
|
|
193
|
+
*/`,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
console.log(' ā
dist/tagada-sdk.js (non-minified for debugging)');
|
|
198
|
+
|
|
199
|
+
// Get file sizes
|
|
200
|
+
const trackerMinSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.min.js')).size;
|
|
201
|
+
const trackerFullSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.js')).size;
|
|
202
|
+
const sdkMinSize = fs.statSync(path.join(OUT_DIR, 'tagada-sdk.min.js')).size;
|
|
203
|
+
const sdkFullSize = fs.statSync(path.join(OUT_DIR, 'tagada-sdk.js')).size;
|
|
204
|
+
|
|
205
|
+
console.log('\nš¦ Bundle sizes:');
|
|
206
|
+
console.log(` external-tracker.min.js: ${(trackerMinSize / 1024).toFixed(2)} KB`);
|
|
207
|
+
console.log(` external-tracker.js: ${(trackerFullSize / 1024).toFixed(2)} KB`);
|
|
208
|
+
console.log(` tagada-sdk.min.js: ${(sdkMinSize / 1024).toFixed(2)} KB`);
|
|
209
|
+
console.log(` tagada-sdk.js: ${(sdkFullSize / 1024).toFixed(2)} KB`);
|
|
210
|
+
|
|
211
|
+
console.log('\n⨠CDN build complete!\n');
|
|
212
|
+
console.log('Usage via CDN:');
|
|
213
|
+
console.log('');
|
|
214
|
+
console.log(' // External Tracker (lightweight, tracking only):');
|
|
215
|
+
console.log(' <script src="https://cdn.jsdelivr.net/npm/@tagadapay/plugin-sdk/dist/external-tracker.min.js"></script>');
|
|
216
|
+
console.log(' <script>TagadaTracker.init({ storeId: "store_xxx", ... });</script>');
|
|
217
|
+
console.log('');
|
|
218
|
+
console.log(' // Full SDK (createTagadaClient, config, hot reload):');
|
|
219
|
+
console.log(' <script src="https://cdn.jsdelivr.net/npm/@tagadapay/plugin-sdk/dist/tagada-sdk.min.js"></script>');
|
|
220
|
+
console.log(' <script>');
|
|
221
|
+
console.log(' const client = createTagadaClient({ features: { funnel: true } });');
|
|
222
|
+
console.log(' client.subscribe((state) => console.log(state));');
|
|
223
|
+
console.log(' </script>\n');
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
build().catch((err) => {
|
|
227
|
+
console.error('Build failed:', err);
|
|
228
|
+
process.exit(1);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
|
package/dist/data/iso3166.d.ts
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
export declare const AVAILABLE_LANGUAGES: readonly ["en", "ru", "de", "fr", "es", "zh", "hi", "pt", "ja", "ar", "it", "he"];
|
|
2
|
-
export type SupportedLanguage = typeof AVAILABLE_LANGUAGES[number];
|
|
3
|
-
/**
|
|
4
|
-
* Register a language database for use
|
|
5
|
-
* @param language - Language code
|
|
6
|
-
* @param database - The language database from iso3166-2-db
|
|
7
|
-
* @example
|
|
8
|
-
* import ruDatabase from 'iso3166-2-db/i18n/dispute/UN/ru';
|
|
9
|
-
* registerLanguage('ru', ruDatabase);
|
|
10
|
-
*/
|
|
11
|
-
export declare function registerLanguage(language: SupportedLanguage, database: any): void;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a language is registered
|
|
14
|
-
* @param language - Language code to check
|
|
15
|
-
* @returns true if the language is registered
|
|
16
|
-
*/
|
|
17
|
-
export declare function isLanguageRegistered(language: SupportedLanguage): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Get list of registered languages
|
|
20
|
-
* @returns Array of registered language codes
|
|
21
|
-
*/
|
|
22
|
-
export declare function getRegisteredLanguages(): SupportedLanguage[];
|
|
23
1
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
2
|
+
* Geodata ā CDN-backed country/region data.
|
|
3
|
+
*
|
|
4
|
+
* Instead of bundling the 775KB iso3166-2-db package, we fetch slim JSON
|
|
5
|
+
* from Vercel Blob CDN on demand:
|
|
6
|
+
* - countries.json (~10KB) ā fetched once on first getCountries() call
|
|
7
|
+
* - regions.json (~95KB) ā fetched lazily on first getStatesForCountry() call
|
|
8
|
+
*
|
|
9
|
+
* Both are cached in memory after first fetch. The API surface is identical
|
|
10
|
+
* to the previous static-import version so all consumers work unchanged.
|
|
29
11
|
*/
|
|
30
|
-
export declare
|
|
12
|
+
export declare const AVAILABLE_LANGUAGES: readonly ["en", "ru", "de", "da", "fr", "es", "zh", "hi", "pt", "ja", "ar", "it", "he"];
|
|
13
|
+
export type SupportedLanguage = typeof AVAILABLE_LANGUAGES[number];
|
|
31
14
|
export interface Country {
|
|
32
15
|
code: string;
|
|
33
16
|
name: string;
|
|
@@ -41,20 +24,27 @@ export interface State {
|
|
|
41
24
|
countryCode: string;
|
|
42
25
|
uniqueKey?: string;
|
|
43
26
|
}
|
|
27
|
+
export declare function ensureCountriesLoaded(language?: SupportedLanguage): Promise<void>;
|
|
28
|
+
export declare function ensureRegionsLoaded(language?: SupportedLanguage): Promise<void>;
|
|
29
|
+
export declare function ensureGeoDataLoaded(language?: SupportedLanguage): Promise<void>;
|
|
44
30
|
export declare const getCountries: (language?: SupportedLanguage) => Country[];
|
|
45
|
-
export declare const getAllStates: (language?: SupportedLanguage) => State[];
|
|
46
31
|
export declare const getStatesForCountry: (countryCode: string, language?: SupportedLanguage) => State[];
|
|
32
|
+
export declare const getAllStates: (language?: SupportedLanguage) => State[];
|
|
47
33
|
export declare const findCountryByName: (countryName: string, language?: SupportedLanguage) => Country | null;
|
|
48
34
|
export declare const findRegionByCode: (regionCode: string, language?: SupportedLanguage) => State | null;
|
|
49
35
|
export declare const isValidCountryCode: (countryCode: string, language?: SupportedLanguage) => boolean;
|
|
50
36
|
export declare const isValidStateCode: (countryCode: string, stateCode: string, language?: SupportedLanguage) => boolean;
|
|
51
37
|
export declare const getCountryWithRegions: (countryCode: string, language?: SupportedLanguage) => {
|
|
52
38
|
country: {
|
|
53
|
-
code:
|
|
54
|
-
name:
|
|
55
|
-
iso3:
|
|
56
|
-
numeric:
|
|
39
|
+
code: string;
|
|
40
|
+
name: string;
|
|
41
|
+
iso3: string | undefined;
|
|
42
|
+
numeric: number | undefined;
|
|
57
43
|
uniqueKey: string;
|
|
58
44
|
};
|
|
59
45
|
regions: State[];
|
|
60
46
|
} | null;
|
|
47
|
+
export declare function registerLanguage(_language: SupportedLanguage, _database: any): void;
|
|
48
|
+
export declare function isLanguageRegistered(language: SupportedLanguage): boolean;
|
|
49
|
+
export declare function getRegisteredLanguages(): SupportedLanguage[];
|
|
50
|
+
export declare function importLanguage(language: SupportedLanguage): Promise<void>;
|