@imtbl/checkout-widgets 2.24.7 → 2.24.9-0

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 (126) hide show
  1. package/dist/browser/{AddTokensWidget-aAZMavtt.js → AddTokensWidget-CIR8BF_I.js} +24 -297
  2. package/dist/browser/{BridgeWidget-CWWCr015.js → BridgeWidget-C5Uljhhx.js} +13 -294
  3. package/dist/browser/{CommerceWidget-B36D9SAt.js → CommerceWidget-CeBBYCbK.js} +17 -47
  4. package/dist/browser/{FeesBreakdown-WeqZxAT6.js → FeesBreakdown-BU4haotD.js} +1 -1
  5. package/dist/browser/{OnRampWidget-DpxysET8.js → OnRampWidget-Ccvb3QkT.js} +5 -80
  6. package/dist/browser/{SaleWidget-CMkn5eAJ.js → SaleWidget-CPARFlzv.js} +61 -219
  7. package/dist/browser/{SpendingCapHero-BuWrv_Rb.js → SpendingCapHero-B-0YYZho.js} +1 -1
  8. package/dist/browser/{SwapWidget-CEnCMtGs.js → SwapWidget-ujE6uX-N.js} +12 -206
  9. package/dist/browser/{TokenImage-EqfdG328.js → TokenImage-BeUf_Ulv.js} +1 -1
  10. package/dist/browser/{TopUpView-D3BxE8R3.js → TopUpView-GMv3360Q.js} +3 -54
  11. package/dist/browser/{WalletApproveHero-C_8es7r9.js → WalletApproveHero-BJi7ufqM.js} +4 -12
  12. package/dist/browser/{WalletWidget-Czye7zS5.js → WalletWidget-BABrqsfd.js} +4 -96
  13. package/dist/browser/{index-WfurfROg.js → index-CcxHW36j.js} +1275 -9717
  14. package/dist/browser/{index-CcLq9am4.js → index-Cp1w6map.js} +1 -1
  15. package/dist/browser/index.js +1 -1
  16. package/dist/browser/{useInterval-CrmneADn.js → useInterval-DbCsm_gG.js} +1 -1
  17. package/dist/types/components/FormComponents/SelectForm/SelectForm.d.ts +1 -5
  18. package/dist/types/components/FormComponents/SelectInput/SelectInput.d.ts +1 -5
  19. package/dist/types/components/Transak/TransakIframe.d.ts +0 -1
  20. package/dist/types/components/Transak/useTransakEvents.d.ts +0 -4
  21. package/dist/types/components/WalletDrawer/ConnectWalletDrawer.d.ts +1 -2
  22. package/dist/types/lib/squid/hooks/useExecute.d.ts +1 -2
  23. package/dist/types/views/top-up/TopUpView.d.ts +1 -5
  24. package/dist/types/widgets/add-tokens/hooks/useError.d.ts +1 -1
  25. package/dist/types/widgets/purchase/components/PurchaseConnectWalletDrawer.d.ts +1 -3
  26. package/dist/types/widgets/sale/hooks/useSaleEvents.d.ts +5 -31
  27. package/dist/types/widgets/swap/components/Fees.d.ts +1 -1
  28. package/package.json +7 -9
  29. package/src/components/ConnectLoader/ConnectLoader.tsx +0 -16
  30. package/src/components/FormComponents/SelectForm/SelectForm.tsx +2 -18
  31. package/src/components/FormComponents/SelectInput/SelectInput.tsx +1 -12
  32. package/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +2 -26
  33. package/src/components/Transactions/ChangeWallet.tsx +1 -12
  34. package/src/components/Transactions/ClaimWithdrawalInProgress.tsx +0 -11
  35. package/src/components/Transactions/NoTransactions.tsx +0 -10
  36. package/src/components/Transactions/TransactionItemWithdrawPending.tsx +1 -13
  37. package/src/components/Transactions/Transactions.tsx +2 -28
  38. package/src/components/Transak/TransakIframe.tsx +0 -6
  39. package/src/components/Transak/useTransakEvents.ts +1 -70
  40. package/src/components/WalletDrawer/ConnectWalletDrawer.tsx +2 -35
  41. package/src/components/WalletDrawer/PayWithWalletDrawer.tsx +0 -1
  42. package/src/context/view-context/test-components/ViewContextTestComponent.tsx +14 -15
  43. package/src/lib/squid/hooks/useExecute.ts +5 -18
  44. package/src/views/top-up/TopUpView.tsx +5 -56
  45. package/src/widgets/add-tokens/AddTokensRoot.tsx +28 -29
  46. package/src/widgets/add-tokens/AddTokensWidget.tsx +2 -17
  47. package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +2 -18
  48. package/src/widgets/add-tokens/hooks/useError.tsx +1 -18
  49. package/src/widgets/add-tokens/hooks/useErrorHandler.ts +2 -12
  50. package/src/widgets/add-tokens/views/AddTokens.tsx +8 -154
  51. package/src/widgets/add-tokens/views/Review.tsx +6 -94
  52. package/src/widgets/bridge/BridgeWidget.tsx +0 -35
  53. package/src/widgets/bridge/BridgeWidgetRoot.tsx +17 -18
  54. package/src/widgets/bridge/components/BridgeForm.tsx +0 -20
  55. package/src/widgets/bridge/components/BridgeReviewSummary.tsx +1 -49
  56. package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +3 -122
  57. package/src/widgets/bridge/views/ApproveTransaction.tsx +1 -15
  58. package/src/widgets/bridge/views/Bridge.tsx +1 -16
  59. package/src/widgets/bridge/views/BridgeReview.tsx +1 -12
  60. package/src/widgets/bridge/views/ClaimWithdrawal.tsx +0 -11
  61. package/src/widgets/bridge/views/MoveInProgress.tsx +0 -24
  62. package/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +1 -12
  63. package/src/widgets/connect/ConnectWidget.tsx +2 -18
  64. package/src/widgets/connect/ConnectWidgetRoot.tsx +15 -16
  65. package/src/widgets/connect/components/WalletList.tsx +6 -55
  66. package/src/widgets/connect/views/ConnectWallet.tsx +1 -12
  67. package/src/widgets/connect/views/ReadyToConnect.tsx +2 -29
  68. package/src/widgets/connect/views/SwitchNetworkEth.tsx +3 -22
  69. package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +0 -18
  70. package/src/widgets/immutable-commerce/CommerceWidgetRoot.tsx +17 -19
  71. package/src/widgets/on-ramp/OnRampWidget.tsx +0 -2
  72. package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +23 -24
  73. package/src/widgets/on-ramp/views/OnRampMain.tsx +1 -91
  74. package/src/widgets/purchase/PurchaseWidgetRoot.tsx +22 -23
  75. package/src/widgets/purchase/components/PurchaseConnectWalletDrawer.tsx +2 -34
  76. package/src/widgets/purchase/components/PurchaseDeliverToWalletDrawer.tsx +0 -1
  77. package/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +0 -2
  78. package/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +1 -30
  79. package/src/widgets/purchase/components/WithCard.tsx +0 -4
  80. package/src/widgets/purchase/views/Purchase.tsx +1 -2
  81. package/src/widgets/sale/SaleWidget.tsx +0 -2
  82. package/src/widgets/sale/SaleWidgetRoot.tsx +32 -33
  83. package/src/widgets/sale/components/OrderReview.tsx +2 -29
  84. package/src/widgets/sale/components/WithCard.tsx +0 -2
  85. package/src/widgets/sale/hooks/useSaleEvents.ts +3 -185
  86. package/src/widgets/sale/views/OrderSummary.tsx +2 -15
  87. package/src/widgets/sale/views/PayWithCard.tsx +4 -46
  88. package/src/widgets/sale/views/PayWithCoins.tsx +4 -9
  89. package/src/widgets/sale/views/PaymentMethods.tsx +3 -6
  90. package/src/widgets/sale/views/SaleErrorView.tsx +1 -1
  91. package/src/widgets/swap/SwapWidget.tsx +0 -24
  92. package/src/widgets/swap/SwapWidgetRoot.tsx +29 -30
  93. package/src/widgets/swap/components/Fees.tsx +1 -1
  94. package/src/widgets/swap/components/SwapForm.tsx +2 -140
  95. package/src/widgets/swap/views/ApproveERC20Onboarding.tsx +1 -36
  96. package/src/widgets/swap/views/SwapCoins.tsx +0 -17
  97. package/src/widgets/swap/views/SwapInProgress.tsx +0 -14
  98. package/src/widgets/transfer/TransferForm.tsx +3 -25
  99. package/src/widgets/transfer/TransferWidget.tsx +1 -23
  100. package/src/widgets/wallet/WalletWidgetRoot.tsx +24 -25
  101. package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +1 -50
  102. package/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +0 -13
  103. package/src/widgets/wallet/components/WalletAddress/WalletAddress.tsx +0 -13
  104. package/src/widgets/wallet/views/CoinInfo.tsx +1 -12
  105. package/src/widgets/wallet/views/Settings.tsx +1 -15
  106. package/src/widgets/wallet/views/WalletBalances.tsx +0 -24
  107. package/tsconfig.json +0 -1
  108. package/dist/browser/auto-track-BcwQjFJ1.js +0 -105
  109. package/dist/browser/index-BSnE_6oQ.js +0 -27
  110. package/dist/browser/index-CKGatDzP.js +0 -60
  111. package/dist/browser/index-Cnt0i-EY.js +0 -65
  112. package/dist/browser/index-DLXeqRzN.js +0 -65
  113. package/dist/browser/index-MANbU_qG.js +0 -5634
  114. package/dist/browser/index-lHICKwNF.js +0 -446
  115. package/dist/browser/index.umd-Cn1Q502t.js +0 -32
  116. package/dist/browser/is-plan-event-enabled-mXX0dwl-.js +0 -17
  117. package/dist/types/context/analytics-provider/CustomAnalyticsProvider.d.ts +0 -7
  118. package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +0 -42
  119. package/dist/types/context/analytics-provider/SetupAnalytics.d.ts +0 -7
  120. package/dist/types/lib/analytics/identifyUser.d.ts +0 -8
  121. package/dist/types/lib/analytics/identifyUser.test.d.ts +0 -1
  122. package/src/context/analytics-provider/CustomAnalyticsProvider.tsx +0 -22
  123. package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +0 -41
  124. package/src/context/analytics-provider/SetupAnalytics.tsx +0 -35
  125. package/src/lib/analytics/identifyUser.test.ts +0 -44
  126. package/src/lib/analytics/identifyUser.ts +0 -26
@@ -1,105 +0,0 @@
1
- import { eq as pTimeout } from './index-WfurfROg.js';
2
-
3
- // Check if a user is opening the link in a new tab
4
- function userNewTab(event) {
5
- var typedEvent = event;
6
- if (typedEvent.ctrlKey ||
7
- typedEvent.shiftKey ||
8
- typedEvent.metaKey ||
9
- (typedEvent.button && typedEvent.button == 1)) {
10
- return true;
11
- }
12
- return false;
13
- }
14
- // Check if the link opens in new tab
15
- function linkNewTab(element, href) {
16
- if (element.target === '_blank' && href) {
17
- return true;
18
- }
19
- return false;
20
- }
21
- function link(links, event, properties, options) {
22
- var _this = this;
23
- var elements = [];
24
- // always arrays, handles jquery
25
- if (!links) {
26
- return this;
27
- }
28
- if (links instanceof Element) {
29
- elements = [links];
30
- }
31
- else if ('toArray' in links) {
32
- elements = links.toArray();
33
- }
34
- else {
35
- elements = links;
36
- }
37
- elements.forEach(function (el) {
38
- el.addEventListener('click', function (elementEvent) {
39
- var _a, _b;
40
- var ev = event instanceof Function ? event(el) : event;
41
- var props = properties instanceof Function ? properties(el) : properties;
42
- var href = el.getAttribute('href') ||
43
- el.getAttributeNS('http://www.w3.org/1999/xlink', 'href') ||
44
- el.getAttribute('xlink:href') ||
45
- ((_a = el.getElementsByTagName('a')[0]) === null || _a === void 0 ? void 0 : _a.getAttribute('href'));
46
- var trackEvent = pTimeout(_this.track(ev, props, options !== null && options !== void 0 ? options : {}), (_b = _this.settings.timeout) !== null && _b !== void 0 ? _b : 500);
47
- if (!linkNewTab(el, href) &&
48
- !userNewTab(elementEvent)) {
49
- if (href) {
50
- elementEvent.preventDefault
51
- ? elementEvent.preventDefault()
52
- : (elementEvent.returnValue = false);
53
- trackEvent
54
- .catch(console.error)
55
- .then(function () {
56
- window.location.href = href;
57
- })
58
- .catch(console.error);
59
- }
60
- }
61
- }, false);
62
- });
63
- return this;
64
- }
65
- function form(forms, event, properties, options) {
66
- var _this = this;
67
- // always arrays, handles jquery
68
- if (!forms)
69
- return this;
70
- if (forms instanceof HTMLFormElement)
71
- forms = [forms];
72
- var elements = forms;
73
- elements.forEach(function (el) {
74
- if (!(el instanceof Element))
75
- throw new TypeError('Must pass HTMLElement to trackForm/trackSubmit.');
76
- var handler = function (elementEvent) {
77
- var _a;
78
- elementEvent.preventDefault
79
- ? elementEvent.preventDefault()
80
- : (elementEvent.returnValue = false);
81
- var ev = event instanceof Function ? event(el) : event;
82
- var props = properties instanceof Function ? properties(el) : properties;
83
- var trackEvent = pTimeout(_this.track(ev, props, options !== null && options !== void 0 ? options : {}), (_a = _this.settings.timeout) !== null && _a !== void 0 ? _a : 500);
84
- trackEvent
85
- .catch(console.error)
86
- .then(function () {
87
- el.submit();
88
- })
89
- .catch(console.error);
90
- };
91
- // Support the events happening through jQuery or Zepto instead of through
92
- // the normal DOM API, because `el.submit` doesn't bubble up events...
93
- var $ = window.jQuery || window.Zepto;
94
- if ($) {
95
- $(el).submit(handler);
96
- }
97
- else {
98
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
99
- el.addEventListener('submit', handler, false);
100
- }
101
- });
102
- return this;
103
- }
104
-
105
- export { form, link };
@@ -1,27 +0,0 @@
1
- import { e6 as __awaiter, e7 as __generator } from './index-WfurfROg.js';
2
-
3
- function loadLegacyVideoPlugins(analytics) {
4
- return __awaiter(this, void 0, void 0, function () {
5
- var plugins;
6
- return __generator(this, function (_a) {
7
- switch (_a.label) {
8
- case 0: return [4 /*yield*/, import(
9
- // @ts-expect-error
10
- './index.umd-Cn1Q502t.js').then(function (n) { return n.i; })
11
- // This is super gross, but we need to support the `window.analytics.plugins` namespace
12
- // that is linked in the segment docs in order to be backwards compatible with ajs-classic
13
- // @ts-expect-error
14
- ];
15
- case 1:
16
- plugins = _a.sent();
17
- // This is super gross, but we need to support the `window.analytics.plugins` namespace
18
- // that is linked in the segment docs in order to be backwards compatible with ajs-classic
19
- // @ts-expect-error
20
- analytics._plugins = plugins;
21
- return [2 /*return*/];
22
- }
23
- });
24
- });
25
- }
26
-
27
- export { loadLegacyVideoPlugins };
@@ -1,60 +0,0 @@
1
- import { er as gracefulDecodeURIComponent, ej as isPlainObject } from './index-WfurfROg.js';
2
-
3
- /**
4
- * Returns an object containing only the properties prefixed by the input
5
- * string.
6
- * Ex: prefix('ajs_traits_', { ajs_traits_address: '123 St' })
7
- * will return { address: '123 St' }
8
- **/
9
- function pickPrefix(prefix, object) {
10
- return Object.keys(object).reduce(function (acc, key) {
11
- if (key.startsWith(prefix)) {
12
- var field = key.substr(prefix.length);
13
- acc[field] = object[key];
14
- }
15
- return acc;
16
- }, {});
17
- }
18
-
19
- function queryString(analytics, query) {
20
- var a = document.createElement('a');
21
- a.href = query;
22
- var parsed = a.search.slice(1);
23
- var params = parsed.split('&').reduce(function (acc, str) {
24
- var _a = str.split('='), k = _a[0], v = _a[1];
25
- acc[k] = gracefulDecodeURIComponent(v);
26
- return acc;
27
- }, {});
28
- var calls = [];
29
- var ajs_uid = params.ajs_uid, ajs_event = params.ajs_event, ajs_aid = params.ajs_aid;
30
- var _a = isPlainObject(analytics.options.useQueryString)
31
- ? analytics.options.useQueryString
32
- : {}, _b = _a.aid, aidPattern = _b === void 0 ? /.+/ : _b, _c = _a.uid, uidPattern = _c === void 0 ? /.+/ : _c;
33
- if (ajs_aid) {
34
- var anonId = Array.isArray(params.ajs_aid)
35
- ? params.ajs_aid[0]
36
- : params.ajs_aid;
37
- if (aidPattern.test(anonId)) {
38
- analytics.setAnonymousId(anonId);
39
- }
40
- }
41
- if (ajs_uid) {
42
- var uid = Array.isArray(params.ajs_uid)
43
- ? params.ajs_uid[0]
44
- : params.ajs_uid;
45
- if (uidPattern.test(uid)) {
46
- var traits = pickPrefix('ajs_trait_', params);
47
- calls.push(analytics.identify(uid, traits));
48
- }
49
- }
50
- if (ajs_event) {
51
- var event_1 = Array.isArray(params.ajs_event)
52
- ? params.ajs_event[0]
53
- : params.ajs_event;
54
- var props = pickPrefix('ajs_prop_', params);
55
- calls.push(analytics.track(event_1, props));
56
- }
57
- return Promise.all(calls);
58
- }
59
-
60
- export { queryString };
@@ -1,65 +0,0 @@
1
- import { ed as __assign } from './index-WfurfROg.js';
2
- import { i as isPlanEventEnabled } from './is-plan-event-enabled-mXX0dwl-.js';
3
-
4
- function disabledActionDestinations(plan, settings) {
5
- var _a, _b;
6
- if (!plan || !Object.keys(plan)) {
7
- return {};
8
- }
9
- var disabledIntegrations = plan.integrations
10
- ? Object.keys(plan.integrations).filter(function (i) { return plan.integrations[i] === false; })
11
- : [];
12
- // This accounts for cases like Fullstory, where the settings.integrations
13
- // contains a "Fullstory" object but settings.remotePlugins contains "Fullstory (Actions)"
14
- var disabledRemotePlugins = [];
15
- ((_a = settings.remotePlugins) !== null && _a !== void 0 ? _a : []).forEach(function (p) {
16
- disabledIntegrations.forEach(function (int) {
17
- if (p.name.includes(int) || int.includes(p.name)) {
18
- disabledRemotePlugins.push(p.name);
19
- }
20
- });
21
- });
22
- return ((_b = settings.remotePlugins) !== null && _b !== void 0 ? _b : []).reduce(function (acc, p) {
23
- if (p.settings['subscriptions']) {
24
- if (disabledRemotePlugins.includes(p.name)) {
25
- // @ts-expect-error element implicitly has an 'any' type because p.settings is a JSONObject
26
- p.settings['subscriptions'].forEach(
27
- // @ts-expect-error parameter 'sub' implicitly has an 'any' type
28
- function (sub) { return (acc["".concat(p.name, " ").concat(sub.partnerAction)] = false); });
29
- }
30
- }
31
- return acc;
32
- }, {});
33
- }
34
- function schemaFilter(track, settings) {
35
- function filter(ctx) {
36
- var plan = track;
37
- var ev = ctx.event.event;
38
- if (plan && ev) {
39
- var planEvent = plan[ev];
40
- if (!isPlanEventEnabled(plan, planEvent)) {
41
- ctx.updateEvent('integrations', __assign(__assign({}, ctx.event.integrations), { All: false, 'Segment.io': true }));
42
- return ctx;
43
- }
44
- else {
45
- var disabledActions = disabledActionDestinations(planEvent, settings);
46
- ctx.updateEvent('integrations', __assign(__assign(__assign({}, ctx.event.integrations), planEvent === null || planEvent === void 0 ? void 0 : planEvent.integrations), disabledActions));
47
- }
48
- }
49
- return ctx;
50
- }
51
- return {
52
- name: 'Schema Filter',
53
- version: '0.1.0',
54
- isLoaded: function () { return true; },
55
- load: function () { return Promise.resolve(); },
56
- type: 'before',
57
- page: filter,
58
- alias: filter,
59
- track: filter,
60
- identify: filter,
61
- group: filter,
62
- };
63
- }
64
-
65
- export { schemaFilter };
@@ -1,65 +0,0 @@
1
- import { e6 as __awaiter, e7 as __generator, eh as isServer, e9 as getNextIntegrationsURL, e8 as loadScript } from './index-WfurfROg.js';
2
-
3
- function remoteMiddlewares(ctx, settings, obfuscate) {
4
- var _a;
5
- return __awaiter(this, void 0, void 0, function () {
6
- var path, remoteMiddleware, names, scripts, middleware;
7
- var _this = this;
8
- return __generator(this, function (_b) {
9
- switch (_b.label) {
10
- case 0:
11
- if (isServer()) {
12
- return [2 /*return*/, []];
13
- }
14
- path = getNextIntegrationsURL();
15
- remoteMiddleware = (_a = settings.enabledMiddleware) !== null && _a !== void 0 ? _a : {};
16
- names = Object.entries(remoteMiddleware)
17
- .filter(function (_a) {
18
- var enabled = _a[1];
19
- return enabled;
20
- })
21
- .map(function (_a) {
22
- var name = _a[0];
23
- return name;
24
- });
25
- scripts = names.map(function (name) { return __awaiter(_this, void 0, void 0, function () {
26
- var nonNamespaced, bundleName, fullPath, error_1;
27
- return __generator(this, function (_a) {
28
- switch (_a.label) {
29
- case 0:
30
- nonNamespaced = name.replace('@segment/', '');
31
- bundleName = nonNamespaced;
32
- if (obfuscate) {
33
- bundleName = btoa(nonNamespaced).replace(/=/g, '');
34
- }
35
- fullPath = "".concat(path, "/middleware/").concat(bundleName, "/latest/").concat(bundleName, ".js.gz");
36
- _a.label = 1;
37
- case 1:
38
- _a.trys.push([1, 3, , 4]);
39
- return [4 /*yield*/, loadScript(fullPath)
40
- // @ts-ignore
41
- ];
42
- case 2:
43
- _a.sent();
44
- // @ts-ignore
45
- return [2 /*return*/, window["".concat(nonNamespaced, "Middleware")]];
46
- case 3:
47
- error_1 = _a.sent();
48
- ctx.log('error', error_1);
49
- ctx.stats.increment('failed_remote_middleware');
50
- return [3 /*break*/, 4];
51
- case 4: return [2 /*return*/];
52
- }
53
- });
54
- }); });
55
- return [4 /*yield*/, Promise.all(scripts)];
56
- case 1:
57
- middleware = _b.sent();
58
- middleware = middleware.filter(Boolean);
59
- return [2 /*return*/, middleware];
60
- }
61
- });
62
- });
63
- }
64
-
65
- export { remoteMiddlewares };