@imtbl/checkout-widgets 2.2.0 → 2.2.1-alpha.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 (52) hide show
  1. package/dist/browser/{AddTokensWidget-Ma98Dqwh.js → AddTokensWidget-DaksUeLJ.js} +26 -26
  2. package/dist/browser/{BridgeWidget-tDPVxvTK.js → BridgeWidget-D_3RTCX2.js} +52 -52
  3. package/dist/browser/{CommerceWidget-DnB5h5DA.js → CommerceWidget-C99-GGFC.js} +180 -186
  4. package/dist/browser/{FeesBreakdown-SMMmNxU-.js → FeesBreakdown-BJbAIdyp.js} +1 -1
  5. package/dist/browser/{OnRampWidget-B3cnjDkJ.js → OnRampWidget-BHGaS-OH.js} +8 -8
  6. package/dist/browser/{SaleWidget-C7tDRhvp.js → SaleWidget-C4GWc59i.js} +61 -61
  7. package/dist/browser/{SpendingCapHero-Do-mkYwB.js → SpendingCapHero-D7e3_oAu.js} +1 -1
  8. package/dist/browser/{SwapWidget-QxW4xOa_.js → SwapWidget-IkGuHL6E.js} +21 -21
  9. package/dist/browser/{TokenImage-lDWfoU2b.js → TokenImage-AbfB1fSa.js} +1 -1
  10. package/dist/browser/{TopUpView-DPkqr-YC.js → TopUpView-D5fh2au_.js} +5 -5
  11. package/dist/browser/{WalletApproveHero-Di02Phe4.js → WalletApproveHero-CK_TX02R.js} +4 -4
  12. package/dist/browser/{WalletWidget-BozZjliU.js → WalletWidget-DSTv_B3p.js} +18 -18
  13. package/dist/browser/{auto-track-CG4Bs1kg.js → auto-track-r9fcwuc1.js} +1 -1
  14. package/dist/browser/{index-BrDACMtQ.js → index-CN-bmJK5.js} +1 -1
  15. package/dist/browser/{index-B92IZgyS.js → index-CgesMpxT.js} +1 -1
  16. package/dist/browser/{index-qkgda0uC.js → index-Cwb6bavW.js} +1 -1
  17. package/dist/browser/{index-ByPgvc_F.js → index-D9k7-57F.js} +1 -1
  18. package/dist/browser/{index-BO9ARDoY.js → index-DW34ctVj.js} +1 -1
  19. package/dist/browser/{index-CqT6H9W-.js → index-S9AO9JR0.js} +334 -357
  20. package/dist/browser/{index-DygDkU2e.js → index-a_bddLOs.js} +1 -1
  21. package/dist/browser/{index-R2dpGmlF.js → index-w-O9voe-.js} +2 -2
  22. package/dist/browser/index.js +1 -1
  23. package/dist/browser/{index.umd-B82ymo2S.js → index.umd-DRS1mtMS.js} +1 -1
  24. package/dist/browser/{useInterval-Dp4GWqSc.js → useInterval-B_9ZtAsp.js} +1 -1
  25. package/dist/types/lib/index.d.ts +0 -1
  26. package/package.json +7 -7
  27. package/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx +1 -2
  28. package/src/components/Transactions/Transactions.tsx +6 -8
  29. package/src/lib/index.ts +0 -1
  30. package/src/lib/utils.ts +4 -5
  31. package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +1 -2
  32. package/src/widgets/add-tokens/views/AddTokens.tsx +1 -2
  33. package/src/widgets/bridge/BridgeWidget.tsx +2 -3
  34. package/src/widgets/bridge/components/BridgeReviewSummary.tsx +2 -4
  35. package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +2 -3
  36. package/src/widgets/bridge/views/ClaimWithdrawal.tsx +3 -3
  37. package/src/widgets/connect/components/WalletList.tsx +2 -2
  38. package/src/widgets/connect/views/SwitchNetworkEth.tsx +2 -3
  39. package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +5 -5
  40. package/src/widgets/immutable-commerce/functions/getConnectLoaderParams.ts +9 -17
  41. package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +1 -2
  42. package/src/widgets/sale/SaleWidgetRoot.tsx +1 -2
  43. package/src/widgets/sale/components/FundingRouteExecute/FundingRouteExecute.tsx +2 -3
  44. package/src/widgets/swap/SwapWidget.tsx +2 -2
  45. package/src/widgets/swap/SwapWidgetRoot.tsx +1 -2
  46. package/src/widgets/swap/components/SwapForm.tsx +2 -3
  47. package/src/widgets/transfer/TransferWidget.tsx +1 -2
  48. package/src/widgets/wallet/WalletWidgetRoot.tsx +1 -2
  49. package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +6 -7
  50. package/src/widgets/wallet/views/WalletBalances.tsx +1 -2
  51. package/dist/types/lib/networkUtils.d.ts +0 -3
  52. package/src/lib/networkUtils.ts +0 -22
@@ -1,19 +1,19 @@
1
- import { n as no, w as wo, a as ao, f as fo, i as io, R as Ro, E as Eo, s as so, C as Co, c as co, T as To, u as uo, g as go, l as lo, I as Io, m as mo, r as reactExports, V as ViewActions, b as getL2ChainId, d as getL1ChainId, Y, p as parseUnits, e as Contract, h as ae, j as formatZeroAmount, k as calculateCryptoToFiat, o as useTranslation, q as dist, t as getRemoteRive, v as et, x as jsx, y as jsxs, B as Box, H as Heading, L as Link, z as Button, S as Stack, A as SimpleLayout, D as Body, F as useAnalytics, G as EventTargetContext, J as CryptoFiatContext, K as tokenValueFormat, M as getDefaultTokenImage, U as UserJourney, N as HeaderNavigation, O as sendCloseWidgetEvent, P as orchestrationEvents$1, Q as amountInputValidation, W as ho, X as useTheme, Z as CloudImage, _ as getRemoteImage, $ as CryptoFiatProvider, a0 as ConnectLoaderContext, a1 as isAddress, a2 as isError, a3 as LoadingView, a4 as CryptoFiatActions, a5 as useViewState, a6 as useEventTargetState, a7 as commerceFlows, a8 as SharedViews, a9 as ErrorView, aa as ConnectWidget, ab as ProvidersContextProvider, ac as PurchaseWidget, ad as ConnectLoader, ae as ViewContextProvider } from './index-CqT6H9W-.js';
2
- import { S as SelectInput, a as SwapWidget } from './SwapWidget-QxW4xOa_.js';
3
- import { B as BridgeWidget } from './BridgeWidget-tDPVxvTK.js';
4
- import OnRampWidget from './OnRampWidget-B3cnjDkJ.js';
5
- import WalletWidget from './WalletWidget-BozZjliU.js';
6
- import SaleWidget from './SaleWidget-C7tDRhvp.js';
7
- import AddTokensWidget from './AddTokensWidget-Ma98Dqwh.js';
8
- import { g as getAllowedBalances, T as TextInputForm } from './WalletApproveHero-Di02Phe4.js';
9
- import './useInterval-Dp4GWqSc.js';
10
- import './TopUpView-DPkqr-YC.js';
11
- import './FeesBreakdown-SMMmNxU-.js';
12
- import './SpendingCapHero-Do-mkYwB.js';
13
- import './TokenImage-lDWfoU2b.js';
1
+ import { r as ro, A as Ao, o as oo, m as mo, n as no, f as fo, g as go, a as ao, E as Eo, i as io, R as Ro, l as lo, u as uo, s as so, C as Co, p as po, b as reactExports, V as ViewActions, c as parseUnits, d as Contract, e as ae, h as formatZeroAmount, j as calculateCryptoToFiat, k as useTranslation, q as dist, t as getRemoteRive, v as tt, w as jsx, x as jsxs, B as Box, H as Heading, L as Link, y as Button, S as Stack, z as SimpleLayout, D as Body, F as useAnalytics, G as EventTargetContext, I as CryptoFiatContext, J as tokenValueFormat, K as getDefaultTokenImage, U as UserJourney, M as HeaderNavigation, N as sendCloseWidgetEvent, O as orchestrationEvents$1, P as amountInputValidation, T as To, Q as useTheme, W as CloudImage, X as getRemoteImage, Y as CryptoFiatProvider, Z as ConnectLoaderContext, _ as isAddress, $ as isError, a0 as LoadingView, a1 as CryptoFiatActions, a2 as useViewState, a3 as useEventTargetState, a4 as commerceFlows, a5 as SharedViews, a6 as ErrorView, a7 as ConnectWidget, a8 as ProvidersContextProvider, a9 as PurchaseWidget, aa as ConnectLoader, ab as ViewContextProvider } from './index-S9AO9JR0.js';
2
+ import { S as SelectInput, a as SwapWidget } from './SwapWidget-IkGuHL6E.js';
3
+ import { B as BridgeWidget } from './BridgeWidget-D_3RTCX2.js';
4
+ import OnRampWidget from './OnRampWidget-BHGaS-OH.js';
5
+ import WalletWidget from './WalletWidget-DSTv_B3p.js';
6
+ import SaleWidget from './SaleWidget-C4GWc59i.js';
7
+ import AddTokensWidget from './AddTokensWidget-DaksUeLJ.js';
8
+ import { g as getAllowedBalances, T as TextInputForm } from './WalletApproveHero-CK_TX02R.js';
9
+ import './useInterval-B_9ZtAsp.js';
10
+ import './TopUpView-D5fh2au_.js';
11
+ import './FeesBreakdown-BJbAIdyp.js';
12
+ import './SpendingCapHero-D7e3_oAu.js';
13
+ import './TokenImage-AbfB1fSa.js';
14
14
 
15
15
  const sendCheckoutEvent = (eventTarget, detail) => {
16
- const event = new CustomEvent(no.IMTBL_COMMERCE_WIDGET_EVENT, { detail });
16
+ const event = new CustomEvent(ro.IMTBL_COMMERCE_WIDGET_EVENT, { detail });
17
17
  // eslint-disable-next-line no-console
18
18
  console.log('checkout app event ', eventTarget, event);
19
19
  if (eventTarget !== undefined)
@@ -24,18 +24,18 @@ const sendCheckoutEvent = (eventTarget, detail) => {
24
24
  * List of views that require a connect loader wrapper
25
25
  */
26
26
  const connectLoaderFlows = [
27
- wo.SALE,
28
- wo.SWAP,
29
- wo.WALLET,
30
- wo.ONRAMP,
31
- wo.TRANSFER,
27
+ Ao.SALE,
28
+ Ao.SWAP,
29
+ Ao.WALLET,
30
+ Ao.ONRAMP,
31
+ Ao.TRANSFER,
32
32
  ];
33
33
  /**
34
34
  * List of views that require a providers context wrapper
35
35
  */
36
36
  const providersContextFlows = [
37
- wo.ADD_TOKENS,
38
- wo.PURCHASE,
37
+ Ao.ADD_TOKENS,
38
+ Ao.PURCHASE,
39
39
  ];
40
40
  /**
41
41
  * Check if the given view requires a connected wallet
@@ -56,25 +56,25 @@ function isProvidersContextFlow(view) {
56
56
  function mapConnectWidgetEvent(event) {
57
57
  const { type, data } = event.detail;
58
58
  switch (type) {
59
- case io.SUCCESS:
59
+ case no.SUCCESS:
60
60
  return {
61
- type: fo.SUCCESS,
61
+ type: mo.SUCCESS,
62
62
  data: {
63
- type: Eo.CONNECT_SUCCESS,
63
+ type: go.CONNECT_SUCCESS,
64
64
  data,
65
65
  },
66
66
  };
67
- case io.FAILURE:
67
+ case no.FAILURE:
68
68
  return {
69
- type: fo.FAILURE,
69
+ type: mo.FAILURE,
70
70
  data: {
71
- type: Ro.CONNECT_FAILED,
71
+ type: fo.CONNECT_FAILED,
72
72
  data,
73
73
  },
74
74
  };
75
- case io.CLOSE_WIDGET:
75
+ case no.CLOSE_WIDGET:
76
76
  return {
77
- type: fo.CLOSE,
77
+ type: mo.CLOSE,
78
78
  data: {},
79
79
  };
80
80
  default:
@@ -87,22 +87,22 @@ function mapConnectWidgetEvent(event) {
87
87
  function mapWalletWidgetEvent(event) {
88
88
  const { type, data } = event.detail;
89
89
  switch (type) {
90
- case so.NETWORK_SWITCH:
90
+ case ao.NETWORK_SWITCH:
91
91
  return {
92
- type: fo.USER_ACTION,
92
+ type: mo.USER_ACTION,
93
93
  data: {
94
- type: Co.NETWORK_SWITCH,
94
+ type: Eo.NETWORK_SWITCH,
95
95
  data,
96
96
  },
97
97
  };
98
- case so.DISCONNECT_WALLET:
98
+ case ao.DISCONNECT_WALLET:
99
99
  return {
100
- type: fo.DISCONNECTED,
100
+ type: mo.DISCONNECTED,
101
101
  data: {},
102
102
  };
103
- case so.CLOSE_WIDGET:
103
+ case ao.CLOSE_WIDGET:
104
104
  return {
105
- type: fo.CLOSE,
105
+ type: mo.CLOSE,
106
106
  data: {},
107
107
  };
108
108
  default:
@@ -115,33 +115,33 @@ function mapWalletWidgetEvent(event) {
115
115
  function mapSwapWidgetEvent(event) {
116
116
  const { type, data } = event.detail;
117
117
  switch (type) {
118
- case co.SUCCESS:
118
+ case io.SUCCESS:
119
119
  return {
120
- type: fo.SUCCESS,
120
+ type: mo.SUCCESS,
121
121
  data: {
122
- type: Eo.SWAP_SUCCESS,
122
+ type: go.SWAP_SUCCESS,
123
123
  data,
124
124
  },
125
125
  };
126
- case co.FAILURE:
126
+ case io.FAILURE:
127
127
  return {
128
- type: fo.FAILURE,
128
+ type: mo.FAILURE,
129
129
  data: {
130
- type: Ro.SWAP_FAILED,
130
+ type: fo.SWAP_FAILED,
131
131
  data,
132
132
  },
133
133
  };
134
- case co.REJECTED:
134
+ case io.REJECTED:
135
135
  return {
136
- type: fo.FAILURE,
136
+ type: mo.FAILURE,
137
137
  data: {
138
- type: Ro.SWAP_REJECTED,
138
+ type: fo.SWAP_REJECTED,
139
139
  data,
140
140
  },
141
141
  };
142
- case co.CLOSE_WIDGET:
142
+ case io.CLOSE_WIDGET:
143
143
  return {
144
- type: fo.CLOSE,
144
+ type: mo.CLOSE,
145
145
  data: {},
146
146
  };
147
147
  default:
@@ -154,33 +154,33 @@ function mapSwapWidgetEvent(event) {
154
154
  function mapAddTokensWidgetEvent(event) {
155
155
  const { type } = event.detail;
156
156
  switch (type) {
157
- case To.SUCCESS:
157
+ case Ro.SUCCESS:
158
158
  return {
159
- type: fo.SUCCESS,
159
+ type: mo.SUCCESS,
160
160
  data: {
161
- type: Eo.ADD_TOKENS_SUCCESS,
161
+ type: go.ADD_TOKENS_SUCCESS,
162
162
  data: event.detail.data,
163
163
  },
164
164
  };
165
- case To.CONNECT_SUCCESS:
165
+ case Ro.CONNECT_SUCCESS:
166
166
  return {
167
- type: fo.SUCCESS,
167
+ type: mo.SUCCESS,
168
168
  data: {
169
- type: Eo.ADD_TOKENS_CONNECT_SUCCESS,
169
+ type: go.ADD_TOKENS_CONNECT_SUCCESS,
170
170
  data: event.detail.data,
171
171
  },
172
172
  };
173
- case To.FAILURE:
173
+ case Ro.FAILURE:
174
174
  return {
175
- type: fo.FAILURE,
175
+ type: mo.FAILURE,
176
176
  data: {
177
- type: Ro.ADD_TOKENS_FAILED,
177
+ type: fo.ADD_TOKENS_FAILED,
178
178
  data: event.detail.data,
179
179
  },
180
180
  };
181
- case To.CLOSE_WIDGET:
181
+ case Ro.CLOSE_WIDGET:
182
182
  return {
183
- type: fo.CLOSE,
183
+ type: mo.CLOSE,
184
184
  data: {},
185
185
  };
186
186
  default:
@@ -193,41 +193,41 @@ function mapAddTokensWidgetEvent(event) {
193
193
  function mapBridgeWidgetEvent(event) {
194
194
  const { type, data } = event.detail;
195
195
  switch (type) {
196
- case uo.TRANSACTION_SENT:
196
+ case lo.TRANSACTION_SENT:
197
197
  return {
198
- type: fo.SUCCESS,
198
+ type: mo.SUCCESS,
199
199
  data: {
200
- type: Eo.BRIDGE_SUCCESS,
200
+ type: go.BRIDGE_SUCCESS,
201
201
  data,
202
202
  },
203
203
  };
204
- case uo.CLAIM_WITHDRAWAL_SUCCESS:
204
+ case lo.CLAIM_WITHDRAWAL_SUCCESS:
205
205
  return {
206
- type: fo.SUCCESS,
206
+ type: mo.SUCCESS,
207
207
  data: {
208
- type: Eo.BRIDGE_CLAIM_WITHDRAWAL_SUCCESS,
208
+ type: go.BRIDGE_CLAIM_WITHDRAWAL_SUCCESS,
209
209
  data,
210
210
  },
211
211
  };
212
- case uo.CLAIM_WITHDRAWAL_FAILURE:
212
+ case lo.CLAIM_WITHDRAWAL_FAILURE:
213
213
  return {
214
- type: fo.FAILURE,
214
+ type: mo.FAILURE,
215
215
  data: {
216
- type: Ro.BRIDGE_CLAIM_WITHDRAWAL_FAILED,
216
+ type: fo.BRIDGE_CLAIM_WITHDRAWAL_FAILED,
217
217
  data,
218
218
  },
219
219
  };
220
- case uo.FAILURE:
220
+ case lo.FAILURE:
221
221
  return {
222
- type: fo.FAILURE,
222
+ type: mo.FAILURE,
223
223
  data: {
224
- type: Ro.BRIDGE_FAILED,
224
+ type: fo.BRIDGE_FAILED,
225
225
  data,
226
226
  },
227
227
  };
228
- case uo.CLOSE_WIDGET:
228
+ case lo.CLOSE_WIDGET:
229
229
  return {
230
- type: fo.CLOSE,
230
+ type: mo.CLOSE,
231
231
  data: {},
232
232
  };
233
233
  default:
@@ -240,25 +240,25 @@ function mapBridgeWidgetEvent(event) {
240
240
  function mapOnrampWidgetEvent(event) {
241
241
  const { type, data } = event.detail;
242
242
  switch (type) {
243
- case go.SUCCESS:
243
+ case uo.SUCCESS:
244
244
  return {
245
- type: fo.SUCCESS,
245
+ type: mo.SUCCESS,
246
246
  data: {
247
- type: Eo.ONRAMP_SUCCESS,
247
+ type: go.ONRAMP_SUCCESS,
248
248
  data,
249
249
  },
250
250
  };
251
- case go.FAILURE:
251
+ case uo.FAILURE:
252
252
  return {
253
- type: fo.FAILURE,
253
+ type: mo.FAILURE,
254
254
  data: {
255
- type: Ro.ONRAMP_FAILED,
255
+ type: fo.ONRAMP_FAILED,
256
256
  data,
257
257
  },
258
258
  };
259
- case go.CLOSE_WIDGET:
259
+ case uo.CLOSE_WIDGET:
260
260
  return {
261
- type: fo.CLOSE,
261
+ type: mo.CLOSE,
262
262
  data: {},
263
263
  };
264
264
  default:
@@ -268,48 +268,48 @@ function mapOnrampWidgetEvent(event) {
268
268
  function mapSaleWidgetEvent(event) {
269
269
  const { type, data } = event.detail;
270
270
  switch (type) {
271
- case lo.SUCCESS:
271
+ case so.SUCCESS:
272
272
  return {
273
- type: fo.SUCCESS,
273
+ type: mo.SUCCESS,
274
274
  data: {
275
- type: Eo.SALE_SUCCESS,
275
+ type: go.SALE_SUCCESS,
276
276
  data,
277
277
  },
278
278
  };
279
- case lo.FAILURE:
279
+ case so.FAILURE:
280
280
  return {
281
- type: fo.FAILURE,
281
+ type: mo.FAILURE,
282
282
  data: {
283
- type: Ro.SALE_FAILED,
283
+ type: fo.SALE_FAILED,
284
284
  data,
285
285
  },
286
286
  };
287
- case lo.CLOSE_WIDGET:
287
+ case so.CLOSE_WIDGET:
288
288
  return {
289
- type: fo.CLOSE,
289
+ type: mo.CLOSE,
290
290
  data: {},
291
291
  };
292
- case lo.TRANSACTION_SUCCESS:
292
+ case so.TRANSACTION_SUCCESS:
293
293
  return {
294
- type: fo.SUCCESS,
294
+ type: mo.SUCCESS,
295
295
  data: {
296
- type: Eo.SALE_TRANSACTION_SUCCESS,
296
+ type: go.SALE_TRANSACTION_SUCCESS,
297
297
  data,
298
298
  },
299
299
  };
300
- case lo.PAYMENT_METHOD:
300
+ case so.PAYMENT_METHOD:
301
301
  return {
302
- type: fo.USER_ACTION,
302
+ type: mo.USER_ACTION,
303
303
  data: {
304
- type: Co.PAYMENT_METHOD_SELECTED,
304
+ type: Eo.PAYMENT_METHOD_SELECTED,
305
305
  data,
306
306
  },
307
307
  };
308
- case lo.PAYMENT_TOKEN:
308
+ case so.PAYMENT_TOKEN:
309
309
  return {
310
- type: fo.USER_ACTION,
310
+ type: mo.USER_ACTION,
311
311
  data: {
312
- type: Co.PAYMENT_TOKEN_SELECTED,
312
+ type: Eo.PAYMENT_TOKEN_SELECTED,
313
313
  data,
314
314
  },
315
315
  };
@@ -320,25 +320,25 @@ function mapSaleWidgetEvent(event) {
320
320
  function mapPurchaseWidgetEvent(event) {
321
321
  const { type, data } = event.detail;
322
322
  switch (type) {
323
- case Io.SUCCESS:
323
+ case Co.SUCCESS:
324
324
  return {
325
- type: fo.SUCCESS,
325
+ type: mo.SUCCESS,
326
326
  data: {
327
- type: Eo.SALE_SUCCESS,
327
+ type: go.SALE_SUCCESS,
328
328
  data,
329
329
  },
330
330
  };
331
- case Io.FAILURE:
331
+ case Co.FAILURE:
332
332
  return {
333
- type: fo.FAILURE,
333
+ type: mo.FAILURE,
334
334
  data: {
335
- type: Ro.SALE_FAILED,
335
+ type: fo.SALE_FAILED,
336
336
  data,
337
337
  },
338
338
  };
339
- case Io.CLOSE_WIDGET:
339
+ case Co.CLOSE_WIDGET:
340
340
  return {
341
- type: fo.CLOSE,
341
+ type: mo.CLOSE,
342
342
  data: {},
343
343
  };
344
344
  default:
@@ -349,28 +349,28 @@ function mapPurchaseWidgetEvent(event) {
349
349
  * Map widget events to commerce widget event detail
350
350
  */
351
351
  function getCommerceWidgetEvent(event) {
352
- if (event.detail.type === ao.PROVIDER_UPDATED) {
352
+ if (event.detail.type === oo.PROVIDER_UPDATED) {
353
353
  return {
354
- type: fo.PROVIDER_UPDATED,
354
+ type: mo.PROVIDER_UPDATED,
355
355
  data: event.detail.data,
356
356
  };
357
357
  }
358
358
  switch (event.type) {
359
- case no.IMTBL_CONNECT_WIDGET_EVENT:
359
+ case ro.IMTBL_CONNECT_WIDGET_EVENT:
360
360
  return mapConnectWidgetEvent(event);
361
- case no.IMTBL_WALLET_WIDGET_EVENT:
361
+ case ro.IMTBL_WALLET_WIDGET_EVENT:
362
362
  return mapWalletWidgetEvent(event);
363
- case no.IMTBL_SWAP_WIDGET_EVENT:
363
+ case ro.IMTBL_SWAP_WIDGET_EVENT:
364
364
  return mapSwapWidgetEvent(event);
365
- case no.IMTBL_ADD_TOKENS_WIDGET_EVENT:
365
+ case ro.IMTBL_ADD_TOKENS_WIDGET_EVENT:
366
366
  return mapAddTokensWidgetEvent(event);
367
- case no.IMTBL_BRIDGE_WIDGET_EVENT:
367
+ case ro.IMTBL_BRIDGE_WIDGET_EVENT:
368
368
  return mapBridgeWidgetEvent(event);
369
- case no.IMTBL_ONRAMP_WIDGET_EVENT:
369
+ case ro.IMTBL_ONRAMP_WIDGET_EVENT:
370
370
  return mapOnrampWidgetEvent(event);
371
- case no.IMTBL_SALE_WIDGET_EVENT:
371
+ case ro.IMTBL_SALE_WIDGET_EVENT:
372
372
  return mapSaleWidgetEvent(event);
373
- case no.IMTBL_PURCHASE_WIDGET_EVENT:
373
+ case ro.IMTBL_PURCHASE_WIDGET_EVENT:
374
374
  return mapPurchaseWidgetEvent(event);
375
375
  default:
376
376
  throw new Error(`Unknown widget event type "${event.type}"`);
@@ -382,20 +382,20 @@ function getCommerceWidgetEvent(event) {
382
382
  */
383
383
  function getViewFromOrchestrationEventType(type) {
384
384
  switch (type) {
385
- case mo.REQUEST_SWAP:
386
- return wo.SWAP;
387
- case mo.REQUEST_CONNECT:
388
- return wo.CONNECT;
389
- case mo.REQUEST_WALLET:
390
- return wo.WALLET;
391
- case mo.REQUEST_BRIDGE:
392
- return wo.BRIDGE;
393
- case mo.REQUEST_ONRAMP:
394
- return wo.ONRAMP;
395
- case mo.REQUEST_ADD_TOKENS:
396
- return wo.ADD_TOKENS;
397
- case mo.REQUEST_PURCHASE:
398
- return wo.PURCHASE;
385
+ case po.REQUEST_SWAP:
386
+ return Ao.SWAP;
387
+ case po.REQUEST_CONNECT:
388
+ return Ao.CONNECT;
389
+ case po.REQUEST_WALLET:
390
+ return Ao.WALLET;
391
+ case po.REQUEST_BRIDGE:
392
+ return Ao.BRIDGE;
393
+ case po.REQUEST_ONRAMP:
394
+ return Ao.ONRAMP;
395
+ case po.REQUEST_ADD_TOKENS:
396
+ return Ao.ADD_TOKENS;
397
+ case po.REQUEST_PURCHASE:
398
+ return Ao.PURCHASE;
399
399
  default:
400
400
  return null;
401
401
  }
@@ -403,14 +403,14 @@ function getViewFromOrchestrationEventType(type) {
403
403
 
404
404
  /** Orchestration Events List */
405
405
  const orchestrationEvents = [
406
- mo.REQUEST_CONNECT,
407
- mo.REQUEST_WALLET,
408
- mo.REQUEST_SWAP,
409
- mo.REQUEST_BRIDGE,
410
- mo.REQUEST_ONRAMP,
411
- mo.REQUEST_ADD_TOKENS,
412
- mo.REQUEST_PURCHASE,
413
- mo.REQUEST_GO_BACK,
406
+ po.REQUEST_CONNECT,
407
+ po.REQUEST_WALLET,
408
+ po.REQUEST_SWAP,
409
+ po.REQUEST_BRIDGE,
410
+ po.REQUEST_ONRAMP,
411
+ po.REQUEST_ADD_TOKENS,
412
+ po.REQUEST_PURCHASE,
413
+ po.REQUEST_GO_BACK,
414
414
  ];
415
415
  /**
416
416
  * Check if event is orchestration event
@@ -421,14 +421,14 @@ function isOrchestrationEvent(event) {
421
421
 
422
422
  /** Widget Events List */
423
423
  const widgetEvents = [
424
- no.IMTBL_CONNECT_WIDGET_EVENT,
425
- no.IMTBL_WALLET_WIDGET_EVENT,
426
- no.IMTBL_SWAP_WIDGET_EVENT,
427
- no.IMTBL_BRIDGE_WIDGET_EVENT,
428
- no.IMTBL_ONRAMP_WIDGET_EVENT,
429
- no.IMTBL_SALE_WIDGET_EVENT,
430
- no.IMTBL_ADD_TOKENS_WIDGET_EVENT,
431
- no.IMTBL_PURCHASE_WIDGET_EVENT,
424
+ ro.IMTBL_CONNECT_WIDGET_EVENT,
425
+ ro.IMTBL_WALLET_WIDGET_EVENT,
426
+ ro.IMTBL_SWAP_WIDGET_EVENT,
427
+ ro.IMTBL_BRIDGE_WIDGET_EVENT,
428
+ ro.IMTBL_ONRAMP_WIDGET_EVENT,
429
+ ro.IMTBL_SALE_WIDGET_EVENT,
430
+ ro.IMTBL_ADD_TOKENS_WIDGET_EVENT,
431
+ ro.IMTBL_PURCHASE_WIDGET_EVENT,
432
432
  ];
433
433
  /**
434
434
  * Subscribe and Handle widget events
@@ -440,7 +440,7 @@ function useWidgetEvents(eventTarget, viewState, handleProviderUpdated) {
440
440
  */
441
441
  const handleOrchestrationEvent = (event) => {
442
442
  const { type, data } = event.detail;
443
- if (type === mo.REQUEST_GO_BACK) {
443
+ if (type === po.REQUEST_GO_BACK) {
444
444
  viewDispatch({
445
445
  payload: {
446
446
  type: ViewActions.UPDATE_VIEW,
@@ -449,7 +449,7 @@ function useWidgetEvents(eventTarget, viewState, handleProviderUpdated) {
449
449
  });
450
450
  return;
451
451
  }
452
- if (type === mo.REQUEST_ONRAMP) {
452
+ if (type === po.REQUEST_ONRAMP) {
453
453
  const onRampEvent = data;
454
454
  if (onRampEvent.provider) {
455
455
  handleProviderUpdated(onRampEvent.provider);
@@ -494,47 +494,41 @@ function useWidgetEvents(eventTarget, viewState, handleProviderUpdated) {
494
494
  }, [handleWidgetEvent]);
495
495
  }
496
496
 
497
- /**
498
- * Get the chain id for the checkout
499
- */
500
- const getChainId = (checkout) => (checkout.config.isProduction
501
- ? Y.IMTBL_ZKEVM_MAINNET
502
- : Y.IMTBL_ZKEVM_TESTNET);
503
497
  /**
504
498
  * Get the connect loader params for the widget
505
499
  */
506
500
  function getConnectLoaderParams(view, checkout, browserProvider) {
507
501
  const { type } = view;
508
502
  switch (type) {
509
- case wo.WALLET:
503
+ case Ao.WALLET:
510
504
  return {
511
505
  checkout,
512
506
  browserProvider,
513
- targetChainId: getChainId(checkout),
507
+ targetChainId: checkout.config.l2ChainId,
514
508
  allowedChains: [
515
- getL1ChainId(checkout.config),
516
- getL2ChainId(checkout.config),
509
+ checkout.config.l1ChainId,
510
+ checkout.config.l2ChainId,
517
511
  ],
518
512
  };
519
- case wo.ONRAMP:
520
- case wo.ADD_TOKENS:
513
+ case Ao.ONRAMP:
514
+ case Ao.ADD_TOKENS:
521
515
  return {
522
516
  checkout,
523
517
  browserProvider,
524
- targetChainId: getChainId(checkout),
518
+ targetChainId: checkout.config.l2ChainId,
525
519
  allowedChains: [
526
- getL1ChainId(checkout.config),
527
- getL2ChainId(checkout.config),
520
+ checkout.config.l1ChainId,
521
+ checkout.config.l2ChainId,
528
522
  ],
529
523
  };
530
- case wo.SALE:
531
- case wo.SWAP:
532
- case wo.TRANSFER:
524
+ case Ao.SALE:
525
+ case Ao.SWAP:
526
+ case Ao.TRANSFER:
533
527
  return {
534
528
  checkout,
535
529
  browserProvider,
536
- targetChainId: getChainId(checkout),
537
- allowedChains: [getL2ChainId(checkout.config)],
530
+ targetChainId: checkout.config.l2ChainId,
531
+ allowedChains: [checkout.config.l2ChainId],
538
532
  };
539
533
  default:
540
534
  return {};
@@ -629,7 +623,7 @@ function TransferComplete({ config, viewState, onContinue, }) {
629
623
  return;
630
624
  input.value = 3;
631
625
  }, [input]);
632
- const explorerLink = reactExports.useMemo(() => et.getTransactionLink(viewState.chainId, viewState.receipt.hash), [viewState.chainId, viewState.receipt.hash]);
626
+ const explorerLink = reactExports.useMemo(() => tt.getTransactionLink(viewState.chainId, viewState.receipt.hash), [viewState.chainId, viewState.receipt.hash]);
633
627
  return (jsx(SimpleLayout, { containerSx: { bg: 'transparent' }, children: jsxs(Stack, { justifyContent: "space-between", sx: {
634
628
  height: '100%',
635
629
  mb: 'base.spacing.x10',
@@ -739,7 +733,7 @@ function TransferForm({ config, viewState, setViewState, onSend, showBackButton,
739
733
  }, [token]);
740
734
  const isButtonDisabled = reactExports.useMemo(() => !viewState.amount || !viewState.toAddress || !token, [viewState.amount, viewState.toAddress, token]);
741
735
  return (jsx(SimpleLayout, { header: (jsx(HeaderNavigation, { title: t('views.TRANSFER.header.title'), onCloseButtonClick: () => sendCloseWidgetEvent(eventTarget), showBack: showBackButton, onBackButtonClick: () => {
742
- orchestrationEvents$1.sendRequestGoBackEvent(eventTarget, no.IMTBL_TRANSFER_WIDGET_EVENT, {});
736
+ orchestrationEvents$1.sendRequestGoBackEvent(eventTarget, ro.IMTBL_TRANSFER_WIDGET_EVENT, {});
743
737
  } })), children: jsxs(Stack, { justifyContent: "space-between", sx: {
744
738
  height: '100%',
745
739
  mt: 'base.spacing.x6',
@@ -749,9 +743,9 @@ function TransferForm({ config, viewState, setViewState, onSend, showBackButton,
749
743
  }
750
744
 
751
745
  const sendSuccessEvent = (eventTarget, transactionHash) => {
752
- const successEvent = new CustomEvent(no.IMTBL_TRANSFER_WIDGET_EVENT, {
746
+ const successEvent = new CustomEvent(ro.IMTBL_TRANSFER_WIDGET_EVENT, {
753
747
  detail: {
754
- type: ho.SUCCESS,
748
+ type: To.SUCCESS,
755
749
  data: {
756
750
  transactionHash,
757
751
  },
@@ -763,9 +757,9 @@ const sendSuccessEvent = (eventTarget, transactionHash) => {
763
757
  eventTarget.dispatchEvent(successEvent);
764
758
  };
765
759
  const sendFailedEvent = (eventTarget, reason) => {
766
- const failedEvent = new CustomEvent(no.IMTBL_TRANSFER_WIDGET_EVENT, {
760
+ const failedEvent = new CustomEvent(ro.IMTBL_TRANSFER_WIDGET_EVENT, {
767
761
  detail: {
768
- type: ho.FAILURE,
762
+ type: To.FAILURE,
769
763
  data: {
770
764
  reason,
771
765
  timestamp: new Date().getTime(),
@@ -778,9 +772,9 @@ const sendFailedEvent = (eventTarget, reason) => {
778
772
  eventTarget.dispatchEvent(failedEvent);
779
773
  };
780
774
  const sendRejectedEvent = (eventTarget, reason) => {
781
- const rejectedEvent = new CustomEvent(no.IMTBL_TRANSFER_WIDGET_EVENT, {
775
+ const rejectedEvent = new CustomEvent(ro.IMTBL_TRANSFER_WIDGET_EVENT, {
782
776
  detail: {
783
- type: ho.REJECTED,
777
+ type: To.REJECTED,
784
778
  data: {
785
779
  reason,
786
780
  timestamp: new Date().getTime(),
@@ -882,7 +876,7 @@ function TransferWidgetInner(props) {
882
876
  setViewState({
883
877
  type: 'COMPLETE',
884
878
  receipt,
885
- chainId: getL2ChainId(viewState.checkout.config),
879
+ chainId: viewState.checkout.config.l2ChainId,
886
880
  checkout: viewState.checkout,
887
881
  provider: viewState.provider,
888
882
  allowedBalances: viewState.allowedBalances,
@@ -957,8 +951,8 @@ function CommerceWidget(props) {
957
951
  const commerceReducerValues = reactExports.useMemo(() => ({ commerceState, commerceDispatch }), [commerceState, commerceDispatch]);
958
952
  const { provider } = commerceState;
959
953
  const connectLoaderParams = reactExports.useMemo(() => getConnectLoaderParams(view, checkout, provider || browserProvider), [view, checkout, provider, browserProvider]);
960
- const connectLoaderSuccessEvent = (flowParams.flow === wo.ADD_TOKENS
961
- || flowParams.flow === wo.PURCHASE) ? () => { } : undefined;
954
+ const connectLoaderSuccessEvent = (flowParams.flow === Ao.ADD_TOKENS
955
+ || flowParams.flow === Ao.PURCHASE) ? () => { } : undefined;
962
956
  const goToPreviousView = reactExports.useCallback(() => {
963
957
  const sharedViews = [
964
958
  SharedViews.LOADING_VIEW,
@@ -1056,28 +1050,28 @@ function CommerceWidget(props) {
1056
1050
  const showBackButton = !!view.data?.showBackButton;
1057
1051
  return (jsx(ViewContextProvider, { children: jsxs(CommerceContext.Provider, { value: commerceReducerValues, children: [view.type === SharedViews.LOADING_VIEW && (jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') })), view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { onCloseClick: () => {
1058
1052
  sendCheckoutEvent(eventTarget, {
1059
- type: fo.CLOSE,
1053
+ type: mo.CLOSE,
1060
1054
  data: {},
1061
1055
  });
1062
1056
  }, onActionClick: () => {
1063
1057
  // TODO: trigger a retry
1064
- }, actionText: t('views.ERROR_VIEW.actionText') })), view.type === wo.CONNECT && (jsx(ConnectWidget, { config: widgetsConfig, checkout: checkout, sendCloseEventOverride: () => {
1058
+ }, actionText: t('views.ERROR_VIEW.actionText') })), view.type === Ao.CONNECT && (jsx(ConnectWidget, { config: widgetsConfig, checkout: checkout, sendCloseEventOverride: () => {
1065
1059
  sendCheckoutEvent(eventTarget, {
1066
- type: fo.CLOSE,
1060
+ type: mo.CLOSE,
1067
1061
  data: {},
1068
1062
  });
1069
- }, ...(view.data.params || {}) })), view.type === wo.BRIDGE && (jsx(BridgeWidget, { config: widgetsConfig, checkout: checkout, browserProvider: browserProvider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && view.type === wo.ADD_TOKENS && (jsx(ProvidersContextProvider, { initialState: { checkout, toProvider: view.data.params.toProvider }, children: jsx(AddTokensWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }) })), shouldWrapWithProvidersContext && view.type === wo.PURCHASE && (jsx(ProvidersContextProvider, { initialState: { checkout }, children: jsx(PurchaseWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }) })), shouldWrapWithConnectLoader && (jsx(ConnectLoader, { widgetConfig: widgetsConfig, params: connectLoaderParams, successEvent: connectLoaderSuccessEvent, closeEvent: () => {
1063
+ }, ...(view.data.params || {}) })), view.type === Ao.BRIDGE && (jsx(BridgeWidget, { config: widgetsConfig, checkout: checkout, browserProvider: browserProvider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && view.type === Ao.ADD_TOKENS && (jsx(ProvidersContextProvider, { initialState: { checkout, toProvider: view.data.params.toProvider }, children: jsx(AddTokensWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }) })), shouldWrapWithProvidersContext && view.type === Ao.PURCHASE && (jsx(ProvidersContextProvider, { initialState: { checkout }, children: jsx(PurchaseWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }) })), shouldWrapWithConnectLoader && (jsx(ConnectLoader, { widgetConfig: widgetsConfig, params: connectLoaderParams, successEvent: connectLoaderSuccessEvent, closeEvent: () => {
1070
1064
  sendCheckoutEvent(eventTarget, {
1071
- type: fo.CLOSE,
1065
+ type: mo.CLOSE,
1072
1066
  data: {},
1073
1067
  });
1074
- }, showBackButton: showBackButton, goBackEvent: goToPreviousView, children: jsxs(reactExports.Suspense, { fallback: jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') }), children: [view.type === wo.WALLET && (jsx(WalletWidget, { config: widgetsConfig, walletConfig: {
1068
+ }, showBackButton: showBackButton, goBackEvent: goToPreviousView, children: jsxs(reactExports.Suspense, { fallback: jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') }), children: [view.type === Ao.WALLET && (jsx(WalletWidget, { config: widgetsConfig, walletConfig: {
1075
1069
  showNetworkMenu: true,
1076
1070
  showDisconnectButton: true,
1077
1071
  ...view.data.config,
1078
- }, ...(view.data.params || {}) })), view.type === wo.SALE && (jsx(SaleWidget, { config: widgetsConfig, ...(view.data.params || {}), hideExcludedPaymentTypes: false,
1072
+ }, ...(view.data.params || {}) })), view.type === Ao.SALE && (jsx(SaleWidget, { config: widgetsConfig, ...(view.data.params || {}), hideExcludedPaymentTypes: false,
1079
1073
  waitFulfillmentSettlements: true,
1080
- ...view.data.config })), view.type === wo.SWAP && (jsx(SwapWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })), view.type === wo.ONRAMP && (jsx(OnRampWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })), view.type === wo.TRANSFER && (jsx(TransferWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }))] }) }))] }) }));
1074
+ ...view.data.config })), view.type === Ao.SWAP && (jsx(SwapWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })), view.type === Ao.ONRAMP && (jsx(OnRampWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })), view.type === Ao.TRANSFER && (jsx(TransferWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton }))] }) }))] }) }));
1081
1075
  }
1082
1076
 
1083
1077
  export { CommerceWidget as default };