@cowprotocol/widget-react 0.14.6 → 1.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.
package/index.mjs DELETED
@@ -1,533 +0,0 @@
1
- import { jsxs as G, jsx as L } from "react/jsx-runtime";
2
- import { useState as q, useRef as O, useCallback as $, useEffect as y } from "react";
3
- class U {
4
- constructor(t) {
5
- this.key = t;
6
- }
7
- postMessageToWindow(t, n, r) {
8
- const p = typeof r == "object" ? r : {}, h = {
9
- key: this.key,
10
- method: n,
11
- ...p
12
- };
13
- t.postMessage(
14
- h,
15
- "*"
16
- // TODO: Change to CoW specific origin in production. https://github.com/cowprotocol/cowswap/issues/3828
17
- );
18
- }
19
- listenToMessageFromWindow(t, n, r) {
20
- const p = (h) => {
21
- !B(h.data) || h.data.key !== this.key || h.data.method !== n || r(h.data);
22
- };
23
- return t.addEventListener("message", p), p;
24
- }
25
- stopListeningToMessageFromWindow(t, n, r) {
26
- t.removeEventListener("message", r);
27
- }
28
- stopListeningWindowListener(t, n) {
29
- t.removeEventListener("message", n);
30
- }
31
- }
32
- function B(e) {
33
- return typeof e == "object" && e !== null && "key" in e && "method" in e && typeof e.key == "string" && typeof e.method == "string";
34
- }
35
- var m = /* @__PURE__ */ ((e) => (e.PROVIDER_RPC_REQUEST = "PROVIDER_RPC_REQUEST", e.PROVIDER_RPC_RESPONSE = "PROVIDER_RPC_RESPONSE", e.PROVIDER_ON_EVENT = "PROVIDER_ON_EVENT", e.SEND_PROVIDER_META_INFO = "SEND_PROVIDER_META_INFO", e.REQUEST_PROVIDER_META_INFO = "REQUEST_PROVIDER_META_INFO", e))(m || {});
36
- const P = new U(
37
- "cowSwapIframeRpcProviderTransport"
38
- );
39
- function J(e) {
40
- if (e.isWalletConnect)
41
- return e?.session?.peer?.metadata;
42
- }
43
- function z(e, t) {
44
- return t.find((n) => n.provider === e)?.info;
45
- }
46
- const Y = ["connect", "disconnect", "close", "chainChanged", "accountsChanged"], x = [];
47
- typeof window < "u" && window.addEventListener("eip6963:announceProvider", (e) => {
48
- const t = e;
49
- x.push(t.detail);
50
- });
51
- class K {
52
- /**
53
- * Creates an instance of IframeRpcProviderBridge.
54
- * @param iframeWidow - The iFrame window that will post up general RPC messages and to which the IframeRpcProviderBridge will forward the RPC result.
55
- * Also it will receive some special RPC events coming from the wallet, like connect/chainChanged,accountChanged
56
- */
57
- constructor(t) {
58
- this.iframeWidow = t;
59
- }
60
- /**
61
- * The Ethereum provider instance.
62
- * When is null the JSON-RPC bridge is disconnected from the Ethereum provider.
63
- * */
64
- ethereumProvider = null;
65
- /** Stored JSON-RPC requests, to queue them when disconnected. */
66
- requestWaitingForConnection = {};
67
- /**
68
- * Disconnects the JSON-RPC bridge from the Ethereum provider.
69
- */
70
- disconnect() {
71
- typeof window > "u" || (this.ethereumProvider = null, P.stopListeningToMessageFromWindow(
72
- window,
73
- m.PROVIDER_RPC_REQUEST,
74
- this.processRpcCallFromWindow
75
- ), P.stopListeningToMessageFromWindow(
76
- window,
77
- m.REQUEST_PROVIDER_META_INFO,
78
- this.processProviderMetaInfoRequest
79
- ));
80
- }
81
- /**
82
- * Handles the 'connect' event and sets up event listeners for Ethereum provider events.
83
- * @param newProvider - The Ethereum provider to connect.
84
- */
85
- onConnect(t) {
86
- typeof window > "u" || (this.ethereumProvider ? this.disconnect() : P.listenToMessageFromWindow(
87
- window,
88
- m.PROVIDER_RPC_REQUEST,
89
- this.processRpcCallFromWindow
90
- ), this.ethereumProvider = t, this.processPendingRequests(), Y.forEach((n) => {
91
- t.on(n, (r) => this.onProviderEvent(n, r));
92
- }), P.listenToMessageFromWindow(
93
- window,
94
- m.REQUEST_PROVIDER_META_INFO,
95
- this.processProviderMetaInfoRequest
96
- ));
97
- }
98
- // TODO: Add proper return type annotation
99
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
100
- processPendingRequests() {
101
- Object.keys(this.requestWaitingForConnection).forEach((t) => {
102
- this.processRpcRequest(this.requestWaitingForConnection[t]);
103
- }), this.requestWaitingForConnection = {};
104
- }
105
- /**
106
- * Processes a JSON-RPC request and sends appropriate response or error via the content window.
107
- * @param request - The JSON-RPC request to be processed.
108
- */
109
- // TODO: Add proper return type annotation
110
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
111
- processRpcRequest(t) {
112
- const { id: n, jsonrpc: r, method: p } = t;
113
- if (!this.ethereumProvider || !n)
114
- return;
115
- // Keep the legacy "enable" method for backward compatibility
116
- (p === "enable" ? this.ethereumProvider.request({ method: "eth_requestAccounts", id: n }) : this.ethereumProvider.request({ ...t, id: n })).then(
117
- (w) => this.forwardRpcResponseToIframe({
118
- rpcResponse: { jsonrpc: r, id: n, result: w }
119
- })
120
- ).catch(
121
- (w) => this.forwardRpcResponseToIframe({
122
- rpcResponse: { jsonrpc: r, id: n, error: w }
123
- })
124
- );
125
- }
126
- processRpcCallFromWindow = ({ rpcRequest: t }) => {
127
- if (!this.ethereumProvider) {
128
- t.id && (this.requestWaitingForConnection[t.id] = t);
129
- return;
130
- }
131
- this.processRpcRequest(t);
132
- };
133
- processProviderMetaInfoRequest = () => {
134
- if (!this.ethereumProvider) return;
135
- const t = z(this.ethereumProvider, x), n = J(this.ethereumProvider);
136
- P.postMessageToWindow(this.iframeWidow, m.SEND_PROVIDER_META_INFO, {
137
- providerEip6963Info: t,
138
- providerWcMetadata: n
139
- });
140
- };
141
- onProviderEvent(t, n) {
142
- P.postMessageToWindow(this.iframeWidow, m.PROVIDER_ON_EVENT, {
143
- event: t,
144
- params: n
145
- });
146
- }
147
- /**
148
- * Forward a JSON-RPC message to the content window.
149
- */
150
- // TODO: Add proper return type annotation
151
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
152
- forwardRpcResponseToIframe(t) {
153
- P.postMessageToWindow(
154
- this.iframeWidow,
155
- m.PROVIDER_RPC_RESPONSE,
156
- t
157
- );
158
- }
159
- }
160
- var W = { exports: {} }, b;
161
- function X() {
162
- return b || (b = 1, function(e) {
163
- var t = Object.prototype.hasOwnProperty, n = "~";
164
- function r() {
165
- }
166
- Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (n = !1));
167
- function p(c, i, s) {
168
- this.fn = c, this.context = i, this.once = s || !1;
169
- }
170
- function h(c, i, s, o, f) {
171
- if (typeof s != "function")
172
- throw new TypeError("The listener must be a function");
173
- var d = new p(s, o || c, f), l = n ? n + i : i;
174
- return c._events[l] ? c._events[l].fn ? c._events[l] = [c._events[l], d] : c._events[l].push(d) : (c._events[l] = d, c._eventsCount++), c;
175
- }
176
- function w(c, i) {
177
- --c._eventsCount === 0 ? c._events = new r() : delete c._events[i];
178
- }
179
- function u() {
180
- this._events = new r(), this._eventsCount = 0;
181
- }
182
- u.prototype.eventNames = function() {
183
- var i = [], s, o;
184
- if (this._eventsCount === 0) return i;
185
- for (o in s = this._events)
186
- t.call(s, o) && i.push(n ? o.slice(1) : o);
187
- return Object.getOwnPropertySymbols ? i.concat(Object.getOwnPropertySymbols(s)) : i;
188
- }, u.prototype.listeners = function(i) {
189
- var s = n ? n + i : i, o = this._events[s];
190
- if (!o) return [];
191
- if (o.fn) return [o.fn];
192
- for (var f = 0, d = o.length, l = new Array(d); f < d; f++)
193
- l[f] = o[f].fn;
194
- return l;
195
- }, u.prototype.listenerCount = function(i) {
196
- var s = n ? n + i : i, o = this._events[s];
197
- return o ? o.fn ? 1 : o.length : 0;
198
- }, u.prototype.emit = function(i, s, o, f, d, l) {
199
- var _ = n ? n + i : i;
200
- if (!this._events[_]) return !1;
201
- var a = this._events[_], v = arguments.length, T, E;
202
- if (a.fn) {
203
- switch (a.once && this.removeListener(i, a.fn, void 0, !0), v) {
204
- case 1:
205
- return a.fn.call(a.context), !0;
206
- case 2:
207
- return a.fn.call(a.context, s), !0;
208
- case 3:
209
- return a.fn.call(a.context, s, o), !0;
210
- case 4:
211
- return a.fn.call(a.context, s, o, f), !0;
212
- case 5:
213
- return a.fn.call(a.context, s, o, f, d), !0;
214
- case 6:
215
- return a.fn.call(a.context, s, o, f, d, l), !0;
216
- }
217
- for (E = 1, T = new Array(v - 1); E < v; E++)
218
- T[E - 1] = arguments[E];
219
- a.fn.apply(a.context, T);
220
- } else {
221
- var j = a.length, I;
222
- for (E = 0; E < j; E++)
223
- switch (a[E].once && this.removeListener(i, a[E].fn, void 0, !0), v) {
224
- case 1:
225
- a[E].fn.call(a[E].context);
226
- break;
227
- case 2:
228
- a[E].fn.call(a[E].context, s);
229
- break;
230
- case 3:
231
- a[E].fn.call(a[E].context, s, o);
232
- break;
233
- case 4:
234
- a[E].fn.call(a[E].context, s, o, f);
235
- break;
236
- default:
237
- if (!T) for (I = 1, T = new Array(v - 1); I < v; I++)
238
- T[I - 1] = arguments[I];
239
- a[E].fn.apply(a[E].context, T);
240
- }
241
- }
242
- return !0;
243
- }, u.prototype.on = function(i, s, o) {
244
- return h(this, i, s, o, !1);
245
- }, u.prototype.once = function(i, s, o) {
246
- return h(this, i, s, o, !0);
247
- }, u.prototype.removeListener = function(i, s, o, f) {
248
- var d = n ? n + i : i;
249
- if (!this._events[d]) return this;
250
- if (!s)
251
- return w(this, d), this;
252
- var l = this._events[d];
253
- if (l.fn)
254
- l.fn === s && (!f || l.once) && (!o || l.context === o) && w(this, d);
255
- else {
256
- for (var _ = 0, a = [], v = l.length; _ < v; _++)
257
- (l[_].fn !== s || f && !l[_].once || o && l[_].context !== o) && a.push(l[_]);
258
- a.length ? this._events[d] = a.length === 1 ? a[0] : a : w(this, d);
259
- }
260
- return this;
261
- }, u.prototype.removeAllListeners = function(i) {
262
- var s;
263
- return i ? (s = n ? n + i : i, this._events[s] && w(this, s)) : (this._events = new r(), this._eventsCount = 0), this;
264
- }, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u.prefixed = n, u.EventEmitter = u, e.exports = u;
265
- }(W)), W.exports;
266
- }
267
- X();
268
- class Z {
269
- subscriptions = {};
270
- on(t) {
271
- const { event: n, handler: r } = t;
272
- return this.subscriptions[n] || (this.subscriptions[n] = []), this.subscriptions[n].push(r), t;
273
- }
274
- off(t) {
275
- const { event: n, handler: r } = t;
276
- return this.subscriptions[n] && (this.subscriptions[n] = this.subscriptions[n].filter((p) => p !== r)), t;
277
- }
278
- emit(t, n) {
279
- this.subscriptions[t] && this.subscriptions[t].forEach((r) => r(n));
280
- }
281
- }
282
- var g = /* @__PURE__ */ ((e) => (e.ACTIVATE = "ACTIVATE", e.UPDATE_HEIGHT = "UPDATE_HEIGHT", e.SET_FULL_HEIGHT = "SET_FULL_HEIGHT", e.EMIT_COW_EVENT = "EMIT_COW_EVENT", e.PROVIDER_RPC_REQUEST = "PROVIDER_RPC_REQUEST", e.INTERCEPT_WINDOW_OPEN = "INTERCEPT_WINDOW_OPEN", e))(g || {}), A = /* @__PURE__ */ ((e) => (e.UPDATE_PARAMS = "UPDATE_PARAMS", e.UPDATE_APP_DATA = "UPDATE_APP_DATA", e.PROVIDER_RPC_RESPONSE = "PROVIDER_RPC_RESPONSE", e.PROVIDER_ON_EVENT = "PROVIDER_ON_EVENT", e))(A || {}), D = /* @__PURE__ */ ((e) => (e.SWAP = "swap", e.LIMIT = "limit", e.ADVANCED = "advanced", e.YIELD = "yield", e))(D || {});
283
- const Te = [
284
- "primary",
285
- "background",
286
- "paper",
287
- "text",
288
- "danger",
289
- "warning",
290
- "alert",
291
- "info",
292
- "success"
293
- ], R = new U("cowSwapWidget");
294
- class ee {
295
- constructor(t, n = []) {
296
- this.contentWindow = t, this.updateListeners(n), this.widgetListener = R.listenToMessageFromWindow(
297
- this.contentWindow,
298
- g.EMIT_COW_EVENT,
299
- (r) => this.eventEmitter.emit(r.event, r.payload)
300
- );
301
- }
302
- eventEmitter = new Z();
303
- listeners = [];
304
- widgetListener;
305
- // TODO: Add proper return type annotation
306
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
307
- stopListeningIframe() {
308
- R.stopListeningWindowListener(this.contentWindow, this.widgetListener);
309
- }
310
- updateListeners(t) {
311
- for (const n of this.listeners)
312
- this.eventEmitter.off(n);
313
- this.listeners = t || [];
314
- for (const n of this.listeners)
315
- this.eventEmitter.on(n);
316
- }
317
- }
318
- class te {
319
- constructor(t, n) {
320
- this.appWindow = t, this.iframeWidow = n, this.forwardSdkMessage = (r) => {
321
- ne(r.data) && (typeof window < "u" && r.origin === window.location.origin || (re(r.data) ? this.appWindow.parent.postMessage(r.data, "*") : se(r.data) && this.iframeWidow.postMessage(r.data, "*")));
322
- }, this.startListening();
323
- }
324
- forwardSdkMessage;
325
- // TODO: Add proper return type annotation
326
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
327
- startListening() {
328
- this.appWindow.addEventListener("message", this.forwardSdkMessage);
329
- }
330
- // TODO: Add proper return type annotation
331
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
332
- stopListening() {
333
- this.appWindow.removeEventListener("message", this.forwardSdkMessage);
334
- }
335
- }
336
- function ne(e) {
337
- return typeof e == "object" && e !== null && "id" in e && typeof e.id == "string";
338
- }
339
- function re(e) {
340
- return "method" in e && typeof e.method == "string" && "params" in e && "env" in e && typeof e.env == "object" && e.env !== null && "sdkVersion" in e.env;
341
- }
342
- function se(e) {
343
- return "success" in e && typeof e.success == "boolean" && "version" in e && typeof e.version == "string";
344
- }
345
- function oe(e) {
346
- return !!(e && typeof e == "object");
347
- }
348
- const N = "_";
349
- function ie(e) {
350
- const t = typeof e.baseUrl == "string" ? e.baseUrl : "https://swap.cow.fi", n = k(e);
351
- return t + "/#" + n + "?" + H(e);
352
- }
353
- function k(e) {
354
- const { chainId: t = 1, sell: n, buy: r, tradeType: p = D.SWAP } = e, h = [n?.asset || N, r?.asset || N].map(encodeURIComponent).join("/");
355
- return `/${t}/widget/${p}/${h}`;
356
- }
357
- function H(e) {
358
- const t = new URLSearchParams();
359
- return ue(ce(ae(t, e), e), e);
360
- }
361
- function ae(e, t) {
362
- const { sell: n, buy: r } = t;
363
- return n?.amount && e.append("sellAmount", n.amount), r?.amount && e.append("buyAmount", r.amount), e;
364
- }
365
- function ce(e, t) {
366
- const n = t.theme;
367
- return n ? (oe(n) ? (e.append("palette", encodeURIComponent(JSON.stringify(n))), e.append("theme", n.baseTheme)) : (e.append("palette", "null"), e.append("theme", n)), e) : (e.append("palette", "null"), e);
368
- }
369
- function ue(e, t) {
370
- return t.targetChainId && e.append("targetChainId", t.targetChainId.toString()), e;
371
- }
372
- const Q = "640px", de = "450px", fe = 20, pe = {
373
- updateParams: () => {
374
- },
375
- updateListeners: () => {
376
- },
377
- updateProvider: () => {
378
- },
379
- destroy: () => {
380
- }
381
- };
382
- function M(e, t) {
383
- const { params: n, provider: r, listeners: p } = t;
384
- let h = r, w = n;
385
- if (typeof window > "u") return pe;
386
- const u = le(n);
387
- e.innerHTML = "", e.appendChild(u);
388
- const { contentWindow: c } = u;
389
- if (!c)
390
- throw console.error("Iframe does not contain a window", u), new Error("Iframe does not contain a window!");
391
- const i = [];
392
- i.push(he(c, n.appCode)), i.push(...we(u, n.height, n.maxHeight)), i.push(Ee());
393
- const s = new ee(window, p);
394
- let o = V(c, null, h);
395
- u.addEventListener("load", () => F(c, w, h));
396
- const f = new te(window, c);
397
- return {
398
- updateParams: (d) => {
399
- w = d, F(c, w, h);
400
- },
401
- updateListeners: (d) => s.updateListeners(d),
402
- updateProvider: (d) => {
403
- h = d, o = V(c, o, d);
404
- },
405
- destroy: () => {
406
- o.disconnect(), s.stopListeningIframe(), i.forEach((d) => window.removeEventListener("message", d)), f.stopListening(), e.removeChild(u);
407
- }
408
- };
409
- }
410
- function V(e, t, n) {
411
- t && t.disconnect();
412
- const r = t || new K(e);
413
- return n && r.onConnect(n), r;
414
- }
415
- function le(e) {
416
- const { width: t = de, height: n = Q } = e, r = document.createElement("iframe");
417
- return r.src = ie(e), r.width = t, r.height = n, r.style.border = "0", r.allow = "clipboard-read; clipboard-write", r;
418
- }
419
- function F(e, t, n) {
420
- const r = !!n, p = k(t), h = H(t).toString(), { theme: w, ...u } = t;
421
- R.postMessageToWindow(e, A.UPDATE_PARAMS, {
422
- urlParams: {
423
- pathname: p,
424
- search: h
425
- },
426
- appParams: u,
427
- hasProvider: r
428
- });
429
- }
430
- function he(e, t) {
431
- return R.listenToMessageFromWindow(window, g.ACTIVATE, () => {
432
- R.postMessageToWindow(e, A.UPDATE_APP_DATA, {
433
- metaData: t ? { appCode: t } : void 0
434
- });
435
- });
436
- }
437
- function Ee() {
438
- return R.listenToMessageFromWindow(
439
- window,
440
- g.INTERCEPT_WINDOW_OPEN,
441
- ({ href: e, rel: t, target: n }) => {
442
- const r = e.toString();
443
- if (!r.startsWith("http") && r.match(/^[a-zA-Z0-9]+:\/\//)) {
444
- window.open(r, n, t);
445
- return;
446
- }
447
- }
448
- );
449
- }
450
- function we(e, t = Q, n) {
451
- return [
452
- R.listenToMessageFromWindow(window, g.UPDATE_HEIGHT, (r) => {
453
- const p = r.height ? r.height + fe : void 0;
454
- e.style.height = p ? `${n ? Math.min(p, n) : p}px` : t;
455
- }),
456
- R.listenToMessageFromWindow(window, g.SET_FULL_HEIGHT, ({ isUpToSmall: r }) => {
457
- e.style.height = r ? t : `${n || document.body.offsetHeight}px`;
458
- })
459
- ];
460
- }
461
- const _e = Object.values(D);
462
- function Pe(e, t, n) {
463
- if (C(e)) {
464
- const r = e[n];
465
- return S(r) ? r[t] : r;
466
- }
467
- if (S(e)) {
468
- const r = e[t];
469
- return C(r) ? r[n] : r;
470
- }
471
- return e;
472
- }
473
- function C(e) {
474
- return typeof e != "object" ? !1 : Object.keys(e).every((t) => _e.includes(t));
475
- }
476
- const ve = /^\d+$/;
477
- function S(e) {
478
- return typeof e != "object" ? !1 : Object.keys(e).every((t) => ve.test(t));
479
- }
480
- function ge(e) {
481
- return C(e) ? Object.values(e).flatMap((t) => S(t) ? Object.values(t) : [t]) : S(e) ? Object.values(e).flatMap((t) => C(t) ? Object.values(t) : [t]) : [e];
482
- }
483
- function Ie(e) {
484
- const { params: t, provider: n, listeners: r } = e, [p, h] = q(null), w = O(null), u = O(n), c = O(r), i = O(null), s = O(null), o = $((f, d) => {
485
- try {
486
- console.log(`[WIDGET] ${f}`), d();
487
- } catch (l) {
488
- const _ = `Error ${f.toLowerCase()}`;
489
- console.error(`[WIDGET] ${_}`, l), h({ message: _, error: l });
490
- }
491
- }, []);
492
- return y(() => () => {
493
- w.current = null, u.current = void 0, c.current = void 0;
494
- const f = s.current;
495
- f && (o("💥 Destroy widget", () => f.destroy()), s.current = null);
496
- }, []), y(() => {
497
- if (!i.current || JSON.stringify(w.current) === JSON.stringify(t))
498
- return;
499
- const f = i.current, d = s.current;
500
- w.current = t, d === null ? o("Creating a new widget", () => {
501
- s.current = M(f, { params: t, provider: u.current, listeners: r }), c.current = r;
502
- }) : o("Updating the widget", () => d.updateParams(t));
503
- }, [t, o]), y(() => {
504
- if (!s.current || u.current === n)
505
- return;
506
- u.current = n;
507
- const f = i.current;
508
- f && o("Updating the provider", () => {
509
- s.current?.destroy(), s.current = M(f, { params: t, provider: u.current, listeners: r });
510
- });
511
- }, [n, o]), y(() => {
512
- if (!s.current || c.current === r) return;
513
- const f = s.current;
514
- o("Updating the listeners", () => f.updateListeners(r));
515
- }, [r, o]), p ? /* @__PURE__ */ G("div", { style: { color: "#ff3a3a" }, children: [
516
- p.message,
517
- p.error.message && /* @__PURE__ */ L("pre", { style: { whiteSpace: "pre-wrap", fontSize: "0.75em" }, children: p.error.message })
518
- ] }) : /* @__PURE__ */ L("div", { ref: i, style: { width: "100%" } });
519
- }
520
- export {
521
- Ie as CowSwapWidget,
522
- D as TradeType,
523
- Te as WIDGET_PALETTE_COLORS,
524
- g as WidgetMethodsEmit,
525
- A as WidgetMethodsListen,
526
- M as createCowSwapWidget,
527
- oe as isCowSwapWidgetPalette,
528
- S as isPerNetworkConfig,
529
- C as isPerTradeTypeConfig,
530
- Pe as resolveFlexibleConfig,
531
- ge as resolveFlexibleConfigValues,
532
- R as widgetIframeTransport
533
- };
@@ -1,2 +0,0 @@
1
- import { CowSwapWidgetProps } from '@cowprotocol/widget-lib';
2
- export declare function CowSwapWidget(props: CowSwapWidgetProps): import("react/jsx-runtime").JSX.Element;