@tagadapay/plugin-sdk 4.0.0 → 4.0.4

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.
Files changed (65) hide show
  1. package/README.md +1129 -1129
  2. package/build-cdn.js +499 -499
  3. package/dist/external-tracker.js +156 -2
  4. package/dist/external-tracker.min.js +2 -2
  5. package/dist/external-tracker.min.js.map +4 -4
  6. package/dist/react/providers/TagadaProvider.js +5 -5
  7. package/dist/tagada-react-sdk-minimal.min.js +2 -2
  8. package/dist/tagada-react-sdk-minimal.min.js.map +4 -4
  9. package/dist/tagada-react-sdk.js +707 -253
  10. package/dist/tagada-react-sdk.min.js +2 -2
  11. package/dist/tagada-react-sdk.min.js.map +4 -4
  12. package/dist/tagada-sdk.js +2922 -102
  13. package/dist/tagada-sdk.min.js +2 -2
  14. package/dist/tagada-sdk.min.js.map +4 -4
  15. package/dist/v2/core/funnelClient.d.ts +40 -0
  16. package/dist/v2/core/funnelClient.js +30 -0
  17. package/dist/v2/core/pixelTracker.d.ts +51 -0
  18. package/dist/v2/core/pixelTracker.js +425 -0
  19. package/dist/v2/core/resources/checkout.d.ts +45 -1
  20. package/dist/v2/core/resources/checkout.js +13 -3
  21. package/dist/v2/core/resources/offers.d.ts +3 -3
  22. package/dist/v2/core/resources/offers.js +11 -3
  23. package/dist/v2/core/resources/promotionEvents.d.ts +5 -0
  24. package/dist/v2/core/resources/promotionEvents.js +2 -0
  25. package/dist/v2/core/resources/promotions.d.ts +6 -1
  26. package/dist/v2/core/resources/promotions.js +6 -1
  27. package/dist/v2/core/resources/shippingRates.d.ts +18 -0
  28. package/dist/v2/core/resources/shippingRates.js +18 -0
  29. package/dist/v2/core/utils/clickIdResolver.d.ts +79 -0
  30. package/dist/v2/core/utils/clickIdResolver.js +169 -0
  31. package/dist/v2/core/utils/index.d.ts +2 -0
  32. package/dist/v2/core/utils/index.js +4 -0
  33. package/dist/v2/core/utils/metaEventId.d.ts +14 -0
  34. package/dist/v2/core/utils/metaEventId.js +16 -0
  35. package/dist/v2/core/utils/previewModeIndicator.js +101 -101
  36. package/dist/v2/index.d.ts +7 -0
  37. package/dist/v2/index.js +10 -0
  38. package/dist/v2/react/components/ApplePayButton.js +50 -0
  39. package/dist/v2/react/components/FunnelScriptInjector.js +9 -9
  40. package/dist/v2/react/components/GooglePayButton.js +39 -1
  41. package/dist/v2/react/components/StripeExpressButton.js +54 -2
  42. package/dist/v2/react/hooks/payment-actions/useNgeniusThreedsAction.js +11 -11
  43. package/dist/v2/react/hooks/useCheckoutQuery.js +41 -29
  44. package/dist/v2/react/hooks/useDiscountsQuery.js +4 -0
  45. package/dist/v2/react/hooks/useFunnel.d.ts +7 -0
  46. package/dist/v2/react/hooks/useFunnel.js +2 -1
  47. package/dist/v2/react/hooks/useOfferQuery.d.ts +11 -0
  48. package/dist/v2/react/hooks/useOfferQuery.js +11 -0
  49. package/dist/v2/react/hooks/usePixelTracking.d.ts +10 -5
  50. package/dist/v2/react/hooks/usePixelTracking.js +32 -374
  51. package/dist/v2/react/hooks/usePreviewOffer.d.ts +3 -1
  52. package/dist/v2/react/hooks/usePreviewOffer.js +4 -2
  53. package/dist/v2/react/hooks/usePromotionsQuery.js +9 -3
  54. package/dist/v2/react/hooks/useShippingRatesQuery.js +36 -21
  55. package/dist/v2/react/hooks/useStepConfig.d.ts +9 -0
  56. package/dist/v2/react/hooks/useStepConfig.js +5 -1
  57. package/dist/v2/react/index.d.ts +5 -0
  58. package/dist/v2/react/index.js +9 -0
  59. package/dist/v2/react/providers/TagadaProvider.js +18 -5
  60. package/dist/v2/standalone/apple-pay-service.d.ts +1 -1
  61. package/dist/v2/standalone/index.d.ts +3 -0
  62. package/dist/v2/standalone/index.js +23 -0
  63. package/dist/v2/standalone/payment-service.d.ts +54 -1
  64. package/dist/v2/standalone/payment-service.js +228 -61
  65. package/package.json +115 -115
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TagadaPay External Tracker v4.0.0
2
+ * TagadaPay External Tracker v4.0.4
3
3
  * CDN Bundle - Standalone tracking for external pages (Debug Build)
4
4
  * @license MIT
5
5
  */
@@ -925,8 +925,11 @@ var TagadaTrackerBundle = (() => {
925
925
  FunnelClient: () => FunnelClient,
926
926
  TrackingProvider: () => TrackingProvider,
927
927
  findMethod: () => findMethod,
928
+ getAssignedCheckoutOfferDefault: () => getAssignedCheckoutOfferDefault,
929
+ getAssignedCheckoutOfferIds: () => getAssignedCheckoutOfferIds,
928
930
  getAssignedOrderBumpOfferIds: () => getAssignedOrderBumpOfferIds,
929
931
  getAssignedPaymentFlowId: () => getAssignedPaymentFlowId,
932
+ getAssignedPaymentInitiator: () => getAssignedPaymentInitiator,
930
933
  getAssignedPixels: () => getAssignedPixels,
931
934
  getAssignedResources: () => getAssignedResources,
932
935
  getAssignedScripts: () => getAssignedScripts,
@@ -1071,7 +1074,8 @@ var TagadaTrackerBundle = (() => {
1071
1074
  scripts: local.scripts,
1072
1075
  pixels: local.pixels,
1073
1076
  orderBumps: local.orderBumps,
1074
- upsellOffers: local.upsellOffers
1077
+ upsellOffers: local.upsellOffers,
1078
+ checkoutOffers: local.checkoutOffers
1075
1079
  };
1076
1080
  }
1077
1081
  function getAssignedStepConfig() {
@@ -1117,6 +1121,10 @@ var TagadaTrackerBundle = (() => {
1117
1121
  }
1118
1122
  return void 0;
1119
1123
  }
1124
+ function getAssignedPaymentInitiator() {
1125
+ const stepConfig = getAssignedStepConfig();
1126
+ return stepConfig == null ? void 0 : stepConfig.paymentInitiator;
1127
+ }
1120
1128
  function getAssignedResources() {
1121
1129
  const stepConfig = getAssignedStepConfig();
1122
1130
  const legacy = stepConfig == null ? void 0 : stepConfig.staticResources;
@@ -1171,6 +1179,17 @@ var TagadaTrackerBundle = (() => {
1171
1179
  if (stepConfig.upsellOffers.mode !== "custom") return void 0;
1172
1180
  return stepConfig.upsellOffers.enabledUpsellIds;
1173
1181
  }
1182
+ function getAssignedCheckoutOfferIds() {
1183
+ const stepConfig = getAssignedStepConfig();
1184
+ if (!(stepConfig == null ? void 0 : stepConfig.checkoutOffers)) return void 0;
1185
+ if (stepConfig.checkoutOffers.mode !== "custom") return void 0;
1186
+ return stepConfig.checkoutOffers.enabledOfferIds;
1187
+ }
1188
+ function getAssignedCheckoutOfferDefault() {
1189
+ var _a;
1190
+ const stepConfig = getAssignedStepConfig();
1191
+ return (_a = stepConfig == null ? void 0 : stepConfig.checkoutOffers) == null ? void 0 : _a.defaultOfferId;
1192
+ }
1174
1193
  var lazyInjectPreviewIndicator, TrackingProvider, localFunnelConfigCache, localFunnelConfigLoading, FunnelClient;
1175
1194
  var init_funnelClient = __esm({
1176
1195
  "src/v2/core/funnelClient.ts"() {
@@ -3413,6 +3432,136 @@ var TagadaTrackerBundle = (() => {
3413
3432
 
3414
3433
  // src/v2/standalone/index.ts
3415
3434
  init_funnelClient();
3435
+
3436
+ // src/v2/core/utils/clickIdResolver.ts
3437
+ var CLICK_ID_URL_PARAMS = Object.freeze([
3438
+ // Postback ad-trackers (most specific first)
3439
+ "cf_click_id",
3440
+ // ClickFlare canonical
3441
+ "cid",
3442
+ // Voluum canonical (also: ClickFlare receiving-side)
3443
+ "rtkclickid",
3444
+ // RedTrack canonical
3445
+ "cmc_tid",
3446
+ // ClickMagick canonical (replaces legacy #S2#)
3447
+ "cmc_id",
3448
+ // ClickMagick legacy
3449
+ "cmcid",
3450
+ // ClickMagick alt
3451
+ "clickid",
3452
+ // Generic affiliate-network token (Binom, RedTrack, Voluum, …)
3453
+ "click_id",
3454
+ // Generic snake_case (ClickFlare, ClickMagick, …)
3455
+ // Ad-platform native click ids
3456
+ "gclid",
3457
+ // Google Ads
3458
+ "gbraid",
3459
+ // Google Ads (iOS app)
3460
+ "wbraid",
3461
+ // Google Ads (web→app)
3462
+ "fbclid",
3463
+ // Meta
3464
+ "msclkid",
3465
+ // Microsoft Ads
3466
+ "ttclid",
3467
+ // TikTok
3468
+ "twclid",
3469
+ // X / Twitter
3470
+ "li_fat_id",
3471
+ // LinkedIn
3472
+ "epik",
3473
+ // Pinterest
3474
+ "dclid",
3475
+ // Display & Video 360
3476
+ "yclid",
3477
+ // Yandex
3478
+ "irclickid"
3479
+ // Impact
3480
+ ]);
3481
+ var CLICK_ID_COOKIES = Object.freeze([
3482
+ // ClickFlare
3483
+ "cf_click_id",
3484
+ "cfclid",
3485
+ // RedTrack — `rtkclickid-store` is the canonical first-party cookie
3486
+ // set by RedTrack's Universal Tracking Script.
3487
+ "rtkclickid-store",
3488
+ "_rtkclickid",
3489
+ "rtkclickid",
3490
+ // Voluum
3491
+ "_voluum",
3492
+ "_voluumclickid",
3493
+ // Binom
3494
+ "_binom",
3495
+ "_binomclickid",
3496
+ // ClickMagick
3497
+ "_mck",
3498
+ "cmcid",
3499
+ // Other
3500
+ "skro-click-id",
3501
+ // Skro
3502
+ "click_id"
3503
+ // generic catch-all (last)
3504
+ ]);
3505
+ function readCookie(name) {
3506
+ if (typeof document === "undefined" || !document.cookie) return null;
3507
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3508
+ const m = document.cookie.match(new RegExp("(?:^|; )" + escaped + "=([^;]*)"));
3509
+ if (!m) return null;
3510
+ try {
3511
+ return decodeURIComponent(m[1]);
3512
+ } catch (e) {
3513
+ return m[1];
3514
+ }
3515
+ }
3516
+ function readUrlParam(search, name) {
3517
+ if (!search) return null;
3518
+ try {
3519
+ return new URLSearchParams(search).get(name);
3520
+ } catch (e) {
3521
+ return null;
3522
+ }
3523
+ }
3524
+ function resolveClickId() {
3525
+ var _a, _b;
3526
+ const all = {};
3527
+ let clickId = null;
3528
+ let source = null;
3529
+ let key = null;
3530
+ const search = typeof window !== "undefined" ? (_b = (_a = window.location) == null ? void 0 : _a.search) != null ? _b : "" : "";
3531
+ for (const name of CLICK_ID_URL_PARAMS) {
3532
+ const v = readUrlParam(search, name);
3533
+ if (v) {
3534
+ all["url:".concat(name)] = v;
3535
+ if (clickId === null) {
3536
+ clickId = v;
3537
+ source = "url";
3538
+ key = name;
3539
+ }
3540
+ }
3541
+ }
3542
+ for (const name of CLICK_ID_COOKIES) {
3543
+ const v = readCookie(name);
3544
+ if (v) {
3545
+ all["cookie:".concat(name)] = v;
3546
+ if (clickId === null) {
3547
+ clickId = v;
3548
+ source = "cookie";
3549
+ key = name;
3550
+ }
3551
+ }
3552
+ }
3553
+ return { clickId, source, key, all };
3554
+ }
3555
+ function publishTrackingGlobal() {
3556
+ var _a;
3557
+ if (typeof window === "undefined") return null;
3558
+ const resolved = resolveClickId();
3559
+ const tracking = __spreadProps(__spreadValues({}, resolved), { resolvedAt: Date.now() });
3560
+ window.TagadaPay = __spreadProps(__spreadValues({}, (_a = window.TagadaPay) != null ? _a : {}), { tracking });
3561
+ return tracking;
3562
+ }
3563
+
3564
+ // src/v2/standalone/index.ts
3416
3565
  function parseStepConfigScripts() {
3417
3566
  if (typeof window === "undefined" || typeof document === "undefined") {
3418
3567
  return [];
@@ -3473,6 +3622,11 @@ var TagadaTrackerBundle = (() => {
3473
3622
  });
3474
3623
  }
3475
3624
  if (typeof window !== "undefined" && typeof document !== "undefined") {
3625
+ try {
3626
+ publishTrackingGlobal();
3627
+ } catch (error) {
3628
+ console.error("[TagadaPay] Failed to publish tracking global:", error);
3629
+ }
3476
3630
  const runInjection = () => {
3477
3631
  if (document.body) {
3478
3632
  injectStepConfigScripts();