@tagadapay/plugin-sdk 3.1.22 ā 3.1.24
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 +274 -6
- package/dist/external-tracker.js +236 -3906
- package/dist/external-tracker.min.js +2 -25
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/config/payment.d.ts +14 -4
- package/dist/react/config/payment.js +47 -9
- package/dist/react/hooks/useCheckout.d.ts +3 -0
- package/dist/react/hooks/useCheckout.js +4 -1
- package/dist/react/hooks/usePluginConfig.js +9 -10
- package/dist/react/providers/TagadaProvider.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js +36 -0
- package/dist/tagada-react-sdk-minimal.min.js.map +7 -0
- package/dist/tagada-react-sdk.js +37821 -0
- package/dist/tagada-react-sdk.min.js +78 -0
- package/dist/tagada-react-sdk.min.js.map +7 -0
- package/dist/tagada-sdk.js +10309 -6331
- package/dist/tagada-sdk.min.js +4 -22
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/cdn-react-minimal.d.ts +23 -0
- package/dist/v2/cdn-react-minimal.js +26 -0
- package/dist/v2/core/client.js +1 -1
- package/dist/v2/core/config/environment.js +2 -1
- package/dist/v2/core/funnelClient.d.ts +98 -10
- package/dist/v2/core/funnelClient.js +121 -27
- package/dist/v2/core/index.d.ts +0 -1
- package/dist/v2/core/index.js +0 -2
- package/dist/v2/core/isoData.d.ts +4 -4
- package/dist/v2/core/isoData.js +7 -7
- package/dist/v2/core/pixelMapping.js +64 -26
- package/dist/v2/core/resources/checkout.d.ts +10 -0
- package/dist/v2/core/resources/checkout.js +6 -0
- package/dist/v2/core/resources/expressPaymentMethods.d.ts +1 -0
- package/dist/v2/core/resources/payments.d.ts +7 -2
- package/dist/v2/core/resources/payments.js +1 -0
- package/dist/v2/core/resources/postPurchases.d.ts +17 -0
- package/dist/v2/core/resources/postPurchases.js +20 -0
- package/dist/v2/core/utils/deviceInfo.d.ts +0 -10
- package/dist/v2/core/utils/deviceInfo.js +152 -76
- package/dist/v2/core/utils/order.d.ts +2 -0
- package/dist/v2/core/utils/pluginConfig.js +18 -22
- package/dist/v2/index.d.ts +4 -3
- package/dist/v2/index.js +4 -2
- package/dist/v2/react/components/FunnelScriptInjector.js +145 -77
- package/dist/v2/react/components/StripeExpressButton.d.ts +13 -0
- package/dist/v2/react/components/StripeExpressButton.js +171 -0
- package/dist/v2/react/components/WhopCheckout.js +7 -1
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +21 -3
- package/dist/v2/react/hooks/useApplePayCheckout.js +8 -8
- package/dist/v2/react/hooks/useCheckoutQuery.d.ts +10 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +21 -13
- package/dist/v2/react/hooks/useFunnel.d.ts +15 -4
- package/dist/v2/react/hooks/useFunnel.js +8 -4
- package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +2 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +29 -15
- package/dist/v2/react/hooks/useISOData.d.ts +2 -5
- package/dist/v2/react/hooks/useISOData.js +25 -26
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +2 -2
- package/dist/v2/react/hooks/usePixelTracking.js +151 -70
- package/dist/v2/react/hooks/usePostPurchasesQuery.js +34 -2
- package/dist/v2/react/hooks/useRemappableParams.d.ts +2 -6
- package/dist/v2/react/hooks/useRemappableParams.js +23 -23
- package/dist/v2/react/hooks/useSetPaymentMethod.d.ts +16 -0
- package/dist/v2/react/hooks/useSetPaymentMethod.js +33 -0
- package/dist/v2/react/hooks/useStepConfig.d.ts +23 -6
- package/dist/v2/react/hooks/useStepConfig.js +14 -7
- package/dist/v2/react/hooks/useTranslation.js +23 -8
- package/dist/v2/react/index.d.ts +8 -1
- package/dist/v2/react/index.js +3 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +1 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +9 -1
- package/dist/v2/react/providers/TagadaProvider.js +4 -4
- package/dist/v2/standalone/index.d.ts +21 -3
- package/dist/v2/standalone/index.js +25 -3
- package/dist/v2/standalone/payment-service.d.ts +134 -0
- package/dist/v2/standalone/payment-service.js +928 -0
- package/package.json +4 -2
package/build-cdn.js
CHANGED
|
@@ -20,6 +20,8 @@ const fs = require('fs');
|
|
|
20
20
|
|
|
21
21
|
const TRACKER_ENTRY = path.join(__dirname, 'src/v2/standalone/external-tracker.ts');
|
|
22
22
|
const SDK_ENTRY = path.join(__dirname, 'src/v2/standalone/index.ts');
|
|
23
|
+
const REACT_SDK_ENTRY = path.join(__dirname, 'src/v2/react/index.ts');
|
|
24
|
+
const REACT_SDK_MINIMAL_ENTRY = path.join(__dirname, 'src/v2/cdn-react-minimal.ts');
|
|
23
25
|
const OUT_DIR = path.join(__dirname, 'dist');
|
|
24
26
|
|
|
25
27
|
async function build() {
|
|
@@ -196,17 +198,277 @@ if (typeof window !== 'undefined' && TagadaSDKBundle) {
|
|
|
196
198
|
|
|
197
199
|
console.log(' ā
dist/tagada-sdk.js (non-minified for debugging)');
|
|
198
200
|
|
|
201
|
+
// ==========================================================================
|
|
202
|
+
// REACT SDK (TagadaProvider, hooks - for use with React apps via CDN)
|
|
203
|
+
// ==========================================================================
|
|
204
|
+
console.log('\nš¦ Building tagada-react-sdk (React hooks & provider)...');
|
|
205
|
+
|
|
206
|
+
// Build minified React SDK bundle
|
|
207
|
+
await esbuild.build({
|
|
208
|
+
entryPoints: [REACT_SDK_ENTRY],
|
|
209
|
+
bundle: true,
|
|
210
|
+
minify: true,
|
|
211
|
+
sourcemap: true,
|
|
212
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
213
|
+
format: 'iife',
|
|
214
|
+
globalName: 'TagadaReactSDKBundle',
|
|
215
|
+
outfile: path.join(OUT_DIR, 'tagada-react-sdk.min.js'),
|
|
216
|
+
// React is external - expects window.React
|
|
217
|
+
external: ['react', 'react-dom'],
|
|
218
|
+
define: {
|
|
219
|
+
'process.env.NODE_ENV': '"production"',
|
|
220
|
+
},
|
|
221
|
+
footer: {
|
|
222
|
+
js: `
|
|
223
|
+
// Expose React SDK under window.tgd namespace
|
|
224
|
+
if (typeof window !== 'undefined' && TagadaReactSDKBundle) {
|
|
225
|
+
window.tgd = window.tgd || {};
|
|
226
|
+
// Provider
|
|
227
|
+
window.tgd.TagadaProvider = TagadaReactSDKBundle.TagadaProvider;
|
|
228
|
+
window.tgd.useTagadaContext = TagadaReactSDKBundle.useTagadaContext;
|
|
229
|
+
// Core hooks
|
|
230
|
+
window.tgd.useCheckout = TagadaReactSDKBundle.useCheckout;
|
|
231
|
+
window.tgd.useCheckoutSession = TagadaReactSDKBundle.useCheckoutSession;
|
|
232
|
+
window.tgd.useSession = TagadaReactSDKBundle.useSession;
|
|
233
|
+
window.tgd.useCustomer = TagadaReactSDKBundle.useCustomer;
|
|
234
|
+
window.tgd.useCustomerInfos = TagadaReactSDKBundle.useCustomerInfos;
|
|
235
|
+
window.tgd.useEnvironment = TagadaReactSDKBundle.useEnvironment;
|
|
236
|
+
window.tgd.useCurrency = TagadaReactSDKBundle.useCurrency;
|
|
237
|
+
window.tgd.useLocale = TagadaReactSDKBundle.useLocale;
|
|
238
|
+
// Commerce hooks
|
|
239
|
+
window.tgd.useShippingRates = TagadaReactSDKBundle.useShippingRates;
|
|
240
|
+
window.tgd.useDiscounts = TagadaReactSDKBundle.useDiscounts;
|
|
241
|
+
window.tgd.useOrderBump = TagadaReactSDKBundle.useOrderBump;
|
|
242
|
+
window.tgd.useOrderBumpV2 = TagadaReactSDKBundle.useOrderBumpV2;
|
|
243
|
+
window.tgd.useOrderBumpV3 = TagadaReactSDKBundle.useOrderBumpV3;
|
|
244
|
+
window.tgd.useProducts = TagadaReactSDKBundle.useProducts;
|
|
245
|
+
window.tgd.useOffers = TagadaReactSDKBundle.useOffers;
|
|
246
|
+
window.tgd.usePostPurchases = TagadaReactSDKBundle.usePostPurchases;
|
|
247
|
+
// Payment hooks
|
|
248
|
+
window.tgd.usePayment = TagadaReactSDKBundle.usePayment;
|
|
249
|
+
window.tgd.useThreeds = TagadaReactSDKBundle.useThreeds;
|
|
250
|
+
window.tgd.useApplePay = TagadaReactSDKBundle.useApplePay;
|
|
251
|
+
window.tgd.useGooglePay = TagadaReactSDKBundle.useGooglePay;
|
|
252
|
+
window.tgd.useExpressPaymentMethods = TagadaReactSDKBundle.useExpressPaymentMethods;
|
|
253
|
+
window.tgd.ExpressPaymentMethodsProvider = TagadaReactSDKBundle.ExpressPaymentMethodsProvider;
|
|
254
|
+
// Utility hooks
|
|
255
|
+
window.tgd.useGeoLocation = TagadaReactSDKBundle.useGeoLocation;
|
|
256
|
+
window.tgd.useGoogleAutocomplete = TagadaReactSDKBundle.useGoogleAutocomplete;
|
|
257
|
+
window.tgd.useISOData = TagadaReactSDKBundle.useISOData;
|
|
258
|
+
window.tgd.usePluginConfig = TagadaReactSDKBundle.usePluginConfig;
|
|
259
|
+
window.tgd.useTranslations = TagadaReactSDKBundle.useTranslations;
|
|
260
|
+
// Funnel
|
|
261
|
+
window.tgd.useFunnel = TagadaReactSDKBundle.useFunnel;
|
|
262
|
+
// Components
|
|
263
|
+
window.tgd.Button = TagadaReactSDKBundle.Button;
|
|
264
|
+
window.tgd.ApplePayButton = TagadaReactSDKBundle.ApplePayButton;
|
|
265
|
+
window.tgd.GooglePayButton = TagadaReactSDKBundle.GooglePayButton;
|
|
266
|
+
// Utilities
|
|
267
|
+
window.tgd.formatMoney = TagadaReactSDKBundle.formatMoney;
|
|
268
|
+
// Full bundle reference
|
|
269
|
+
window.tgd.react = TagadaReactSDKBundle;
|
|
270
|
+
}
|
|
271
|
+
`.trim(),
|
|
272
|
+
},
|
|
273
|
+
banner: {
|
|
274
|
+
js: `/**
|
|
275
|
+
* TagadaPay React SDK v${require('./package.json').version}
|
|
276
|
+
* CDN Bundle - React hooks and TagadaProvider for checkout integration
|
|
277
|
+
* Requires: React 18+ loaded before this script
|
|
278
|
+
* Usage: window.tgd.TagadaProvider, window.tgd.useCheckout, etc.
|
|
279
|
+
* @license MIT
|
|
280
|
+
*/`,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
console.log(' ā
dist/tagada-react-sdk.min.js (minified + sourcemap)');
|
|
285
|
+
|
|
286
|
+
// Build non-minified React SDK version for debugging
|
|
287
|
+
await esbuild.build({
|
|
288
|
+
entryPoints: [REACT_SDK_ENTRY],
|
|
289
|
+
bundle: true,
|
|
290
|
+
minify: false,
|
|
291
|
+
sourcemap: false,
|
|
292
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
293
|
+
format: 'iife',
|
|
294
|
+
globalName: 'TagadaReactSDKBundle',
|
|
295
|
+
outfile: path.join(OUT_DIR, 'tagada-react-sdk.js'),
|
|
296
|
+
external: ['react', 'react-dom'],
|
|
297
|
+
define: {
|
|
298
|
+
'process.env.NODE_ENV': '"development"',
|
|
299
|
+
},
|
|
300
|
+
footer: {
|
|
301
|
+
js: `
|
|
302
|
+
// Expose React SDK under window.tgd namespace
|
|
303
|
+
if (typeof window !== 'undefined' && TagadaReactSDKBundle) {
|
|
304
|
+
window.tgd = window.tgd || {};
|
|
305
|
+
window.tgd.TagadaProvider = TagadaReactSDKBundle.TagadaProvider;
|
|
306
|
+
window.tgd.useTagadaContext = TagadaReactSDKBundle.useTagadaContext;
|
|
307
|
+
window.tgd.useCheckout = TagadaReactSDKBundle.useCheckout;
|
|
308
|
+
window.tgd.useCheckoutSession = TagadaReactSDKBundle.useCheckoutSession;
|
|
309
|
+
window.tgd.useSession = TagadaReactSDKBundle.useSession;
|
|
310
|
+
window.tgd.useCustomer = TagadaReactSDKBundle.useCustomer;
|
|
311
|
+
window.tgd.useCustomerInfos = TagadaReactSDKBundle.useCustomerInfos;
|
|
312
|
+
window.tgd.useEnvironment = TagadaReactSDKBundle.useEnvironment;
|
|
313
|
+
window.tgd.useCurrency = TagadaReactSDKBundle.useCurrency;
|
|
314
|
+
window.tgd.useLocale = TagadaReactSDKBundle.useLocale;
|
|
315
|
+
window.tgd.useShippingRates = TagadaReactSDKBundle.useShippingRates;
|
|
316
|
+
window.tgd.useDiscounts = TagadaReactSDKBundle.useDiscounts;
|
|
317
|
+
window.tgd.useOrderBump = TagadaReactSDKBundle.useOrderBump;
|
|
318
|
+
window.tgd.useOrderBumpV2 = TagadaReactSDKBundle.useOrderBumpV2;
|
|
319
|
+
window.tgd.useOrderBumpV3 = TagadaReactSDKBundle.useOrderBumpV3;
|
|
320
|
+
window.tgd.useProducts = TagadaReactSDKBundle.useProducts;
|
|
321
|
+
window.tgd.useOffers = TagadaReactSDKBundle.useOffers;
|
|
322
|
+
window.tgd.usePostPurchases = TagadaReactSDKBundle.usePostPurchases;
|
|
323
|
+
window.tgd.usePayment = TagadaReactSDKBundle.usePayment;
|
|
324
|
+
window.tgd.useThreeds = TagadaReactSDKBundle.useThreeds;
|
|
325
|
+
window.tgd.useApplePay = TagadaReactSDKBundle.useApplePay;
|
|
326
|
+
window.tgd.useGooglePay = TagadaReactSDKBundle.useGooglePay;
|
|
327
|
+
window.tgd.useExpressPaymentMethods = TagadaReactSDKBundle.useExpressPaymentMethods;
|
|
328
|
+
window.tgd.ExpressPaymentMethodsProvider = TagadaReactSDKBundle.ExpressPaymentMethodsProvider;
|
|
329
|
+
window.tgd.useGeoLocation = TagadaReactSDKBundle.useGeoLocation;
|
|
330
|
+
window.tgd.useGoogleAutocomplete = TagadaReactSDKBundle.useGoogleAutocomplete;
|
|
331
|
+
window.tgd.useISOData = TagadaReactSDKBundle.useISOData;
|
|
332
|
+
window.tgd.usePluginConfig = TagadaReactSDKBundle.usePluginConfig;
|
|
333
|
+
window.tgd.useTranslations = TagadaReactSDKBundle.useTranslations;
|
|
334
|
+
window.tgd.useFunnel = TagadaReactSDKBundle.useFunnel;
|
|
335
|
+
window.tgd.Button = TagadaReactSDKBundle.Button;
|
|
336
|
+
window.tgd.ApplePayButton = TagadaReactSDKBundle.ApplePayButton;
|
|
337
|
+
window.tgd.GooglePayButton = TagadaReactSDKBundle.GooglePayButton;
|
|
338
|
+
window.tgd.formatMoney = TagadaReactSDKBundle.formatMoney;
|
|
339
|
+
window.tgd.react = TagadaReactSDKBundle;
|
|
340
|
+
}
|
|
341
|
+
`.trim(),
|
|
342
|
+
},
|
|
343
|
+
banner: {
|
|
344
|
+
js: `/**
|
|
345
|
+
* TagadaPay React SDK v${require('./package.json').version}
|
|
346
|
+
* CDN Bundle - React hooks and TagadaProvider (Debug Build)
|
|
347
|
+
* @license MIT
|
|
348
|
+
*/`,
|
|
349
|
+
},
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
console.log(' ā
dist/tagada-react-sdk.js (non-minified for debugging)');
|
|
353
|
+
|
|
354
|
+
// ==========================================================================
|
|
355
|
+
// MINIMAL REACT SDK (TagadaProvider + essential checkout hooks only)
|
|
356
|
+
// ==========================================================================
|
|
357
|
+
console.log('\nš¦ Building tagada-react-sdk-minimal (slim checkout SDK)...');
|
|
358
|
+
|
|
359
|
+
// Plugin to replace React imports with window globals
|
|
360
|
+
const reactGlobalsPlugin = {
|
|
361
|
+
name: 'react-globals',
|
|
362
|
+
setup(build) {
|
|
363
|
+
// Intercept react imports and return window globals
|
|
364
|
+
build.onResolve({ filter: /^react(-dom)?(\/.*)?$/ }, args => ({
|
|
365
|
+
path: args.path,
|
|
366
|
+
namespace: 'react-global',
|
|
367
|
+
}));
|
|
368
|
+
|
|
369
|
+
build.onLoad({ filter: /.*/, namespace: 'react-global' }, args => {
|
|
370
|
+
if (args.path === 'react') {
|
|
371
|
+
return {
|
|
372
|
+
contents: 'module.exports = window.React;',
|
|
373
|
+
loader: 'js',
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
// Handle JSX runtime - map to React.createElement
|
|
377
|
+
if (args.path === 'react/jsx-runtime' || args.path === 'react/jsx-dev-runtime') {
|
|
378
|
+
return {
|
|
379
|
+
contents: `
|
|
380
|
+
var React = window.React;
|
|
381
|
+
module.exports = {
|
|
382
|
+
jsx: React.createElement,
|
|
383
|
+
jsxs: React.createElement,
|
|
384
|
+
jsxDEV: React.createElement,
|
|
385
|
+
Fragment: React.Fragment,
|
|
386
|
+
};
|
|
387
|
+
`,
|
|
388
|
+
loader: 'js',
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
if (args.path === 'react-dom' || args.path === 'react-dom/client') {
|
|
392
|
+
return {
|
|
393
|
+
contents: 'module.exports = window.ReactDOM;',
|
|
394
|
+
loader: 'js',
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
return { contents: 'module.exports = {};', loader: 'js' };
|
|
398
|
+
});
|
|
399
|
+
},
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// Build minified minimal React SDK bundle
|
|
403
|
+
await esbuild.build({
|
|
404
|
+
entryPoints: [REACT_SDK_MINIMAL_ENTRY],
|
|
405
|
+
bundle: true,
|
|
406
|
+
minify: true,
|
|
407
|
+
sourcemap: true,
|
|
408
|
+
target: ['es2018', 'chrome58', 'firefox57', 'safari11', 'edge79'],
|
|
409
|
+
format: 'iife',
|
|
410
|
+
globalName: 'TagadaReactMinimalBundle',
|
|
411
|
+
outfile: path.join(OUT_DIR, 'tagada-react-sdk-minimal.min.js'),
|
|
412
|
+
plugins: [reactGlobalsPlugin],
|
|
413
|
+
define: {
|
|
414
|
+
'process.env.NODE_ENV': '"production"',
|
|
415
|
+
},
|
|
416
|
+
footer: {
|
|
417
|
+
js: `
|
|
418
|
+
// Expose minimal React SDK under window.tgd namespace
|
|
419
|
+
if (typeof window !== 'undefined' && TagadaReactMinimalBundle) {
|
|
420
|
+
window.tgd = window.tgd || {};
|
|
421
|
+
// Provider
|
|
422
|
+
window.tgd.TagadaProvider = TagadaReactMinimalBundle.TagadaProvider;
|
|
423
|
+
window.tgd.useTagadaContext = TagadaReactMinimalBundle.useTagadaContext;
|
|
424
|
+
// Core checkout hooks
|
|
425
|
+
window.tgd.useCheckout = TagadaReactMinimalBundle.useCheckout;
|
|
426
|
+
window.tgd.useShippingRates = TagadaReactMinimalBundle.useShippingRates;
|
|
427
|
+
window.tgd.useDiscounts = TagadaReactMinimalBundle.useDiscounts;
|
|
428
|
+
window.tgd.useOrderBump = TagadaReactMinimalBundle.useOrderBump;
|
|
429
|
+
window.tgd.usePostPurchases = TagadaReactMinimalBundle.usePostPurchases;
|
|
430
|
+
window.tgd.usePayment = TagadaReactMinimalBundle.usePayment;
|
|
431
|
+
window.tgd.useThreeds = TagadaReactMinimalBundle.useThreeds;
|
|
432
|
+
// Utilities
|
|
433
|
+
window.tgd.useCurrency = TagadaReactMinimalBundle.useCurrency;
|
|
434
|
+
window.tgd.usePluginConfig = TagadaReactMinimalBundle.usePluginConfig;
|
|
435
|
+
window.tgd.useFunnel = TagadaReactMinimalBundle.useFunnel;
|
|
436
|
+
window.tgd.formatMoney = TagadaReactMinimalBundle.formatMoney;
|
|
437
|
+
// Mark as minimal
|
|
438
|
+
window.tgd._minimal = true;
|
|
439
|
+
}
|
|
440
|
+
`.trim(),
|
|
441
|
+
},
|
|
442
|
+
banner: {
|
|
443
|
+
js: `/**
|
|
444
|
+
* TagadaPay React SDK MINIMAL v${require('./package.json').version}
|
|
445
|
+
* CDN Bundle - Slim checkout SDK (TagadaProvider + essential hooks only)
|
|
446
|
+
* Requires: React 18+ loaded before this script
|
|
447
|
+
* For full SDK with all hooks, use tagada-react-sdk.min.js instead
|
|
448
|
+
* @license MIT
|
|
449
|
+
*/`,
|
|
450
|
+
},
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
console.log(' ā
dist/tagada-react-sdk-minimal.min.js (minified + sourcemap)');
|
|
454
|
+
|
|
199
455
|
// Get file sizes
|
|
200
456
|
const trackerMinSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.min.js')).size;
|
|
201
457
|
const trackerFullSize = fs.statSync(path.join(OUT_DIR, 'external-tracker.js')).size;
|
|
202
458
|
const sdkMinSize = fs.statSync(path.join(OUT_DIR, 'tagada-sdk.min.js')).size;
|
|
203
459
|
const sdkFullSize = fs.statSync(path.join(OUT_DIR, 'tagada-sdk.js')).size;
|
|
460
|
+
const reactSdkMinSize = fs.statSync(path.join(OUT_DIR, 'tagada-react-sdk.min.js')).size;
|
|
461
|
+
const reactSdkFullSize = fs.statSync(path.join(OUT_DIR, 'tagada-react-sdk.js')).size;
|
|
462
|
+
const reactSdkMinimalSize = fs.statSync(path.join(OUT_DIR, 'tagada-react-sdk-minimal.min.js')).size;
|
|
204
463
|
|
|
205
464
|
console.log('\nš¦ Bundle sizes:');
|
|
206
|
-
console.log(` external-tracker.min.js:
|
|
207
|
-
console.log(` external-tracker.js:
|
|
208
|
-
console.log(` tagada-sdk.min.js:
|
|
209
|
-
console.log(` tagada-sdk.js:
|
|
465
|
+
console.log(` external-tracker.min.js: ${(trackerMinSize / 1024).toFixed(2)} KB`);
|
|
466
|
+
console.log(` external-tracker.js: ${(trackerFullSize / 1024).toFixed(2)} KB`);
|
|
467
|
+
console.log(` tagada-sdk.min.js: ${(sdkMinSize / 1024).toFixed(2)} KB`);
|
|
468
|
+
console.log(` tagada-sdk.js: ${(sdkFullSize / 1024).toFixed(2)} KB`);
|
|
469
|
+
console.log(` tagada-react-sdk.min.js: ${(reactSdkMinSize / 1024).toFixed(2)} KB (full)`);
|
|
470
|
+
console.log(` tagada-react-sdk.js: ${(reactSdkFullSize / 1024).toFixed(2)} KB`);
|
|
471
|
+
console.log(` tagada-react-sdk-minimal.min.js: ${(reactSdkMinimalSize / 1024).toFixed(2)} KB (slim) ā`);
|
|
210
472
|
|
|
211
473
|
console.log('\n⨠CDN build complete!\n');
|
|
212
474
|
console.log('Usage via CDN:');
|
|
@@ -218,9 +480,15 @@ if (typeof window !== 'undefined' && TagadaSDKBundle) {
|
|
|
218
480
|
console.log(' // Full SDK (createTagadaClient, config, hot reload):');
|
|
219
481
|
console.log(' <script src="https://cdn.jsdelivr.net/npm/@tagadapay/plugin-sdk/dist/tagada-sdk.min.js"></script>');
|
|
220
482
|
console.log(' <script>');
|
|
221
|
-
console.log(' const client = createTagadaClient({ features: { funnel: true } });');
|
|
483
|
+
console.log(' const client = window.tgd.createTagadaClient({ features: { funnel: true } });');
|
|
222
484
|
console.log(' client.subscribe((state) => console.log(state));');
|
|
223
|
-
console.log(' </script
|
|
485
|
+
console.log(' </script>');
|
|
486
|
+
console.log('');
|
|
487
|
+
console.log(' // React SDK (hooks & TagadaProvider - requires React 18+):');
|
|
488
|
+
console.log(' <script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>');
|
|
489
|
+
console.log(' <script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>');
|
|
490
|
+
console.log(' <script src="https://cdn.jsdelivr.net/npm/@tagadapay/plugin-sdk/dist/tagada-react-sdk.min.js"></script>');
|
|
491
|
+
console.log(' // Then use: window.tgd.TagadaProvider, window.tgd.useCheckout, etc.\n');
|
|
224
492
|
}
|
|
225
493
|
|
|
226
494
|
build().catch((err) => {
|