@funkit/connect 9.10.0 → 9.11.0-next.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 (73) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/chunk-64NZSUGQ.js +368 -0
  3. package/dist/chunk-B2B6HDIE.js +238 -0
  4. package/dist/chunk-OQNN7EMQ.js +238 -0
  5. package/dist/chunk-S65TG73G.js +247 -0
  6. package/dist/chunk-VLAOBEJN.js +247 -0
  7. package/dist/clients/chunk-3LSYVQXK.js +289 -0
  8. package/dist/clients/chunk-5HU2XDR2.js +289 -0
  9. package/dist/clients/chunk-DKWYHSW3.js +225 -0
  10. package/dist/clients/chunk-IPK5DVIL.js +229 -0
  11. package/dist/clients/chunk-PVOHWTSR.js +289 -0
  12. package/dist/clients/chunk-SBQ2UUPK.js +214 -0
  13. package/dist/clients/fanatics.css +1 -1
  14. package/dist/clients/fanatics.js +1 -1
  15. package/dist/clients/lighter.css +1 -1
  16. package/dist/clients/lighter.js +1 -1
  17. package/dist/clients/rolly.d.ts +42 -0
  18. package/dist/clients/rolly.js +91 -0
  19. package/dist/components/Dropdown/TokenAndChainDropdown.css.d.ts +1 -0
  20. package/dist/hooks/queries/useSwappedExchanges.d.ts +14 -0
  21. package/dist/hooks/statsig/checkFeatureGate.d.ts +19 -0
  22. package/dist/hooks/track/CheckoutTrackingContext.d.ts +60 -0
  23. package/dist/hooks/useExchangeOptions.d.ts +10 -0
  24. package/dist/hooks/useTokenChain.d.ts +21 -0
  25. package/dist/index.css +10 -10
  26. package/dist/index.js +1 -1
  27. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeContainer.d.ts +17 -0
  28. package/dist/modals/WithdrwalModal/WithdrawalCallbackSuccess.d.ts +10 -0
  29. package/dist/modals/WithdrwalModal/WithdrawalContent.d.ts +11 -0
  30. package/dist/modals/WithdrwalModal/WithdrawalModal.d.ts +9 -0
  31. package/dist/modals/WithdrwalModal/WithdrawalSuccess.d.ts +15 -0
  32. package/dist/modals/WithdrwalModal/types.d.ts +5 -0
  33. package/dist/modals/WithdrwalModal/useWithdrawal.d.ts +24 -0
  34. package/dist/utils/openExternalFlowPopup.d.ts +21 -0
  35. package/dist/wallets/walletConnectors/chunk-34HACM5U.js +110 -0
  36. package/dist/wallets/walletConnectors/chunk-4C7ER452.js +93 -0
  37. package/dist/wallets/walletConnectors/chunk-53VYSPXK.js +66 -0
  38. package/dist/wallets/walletConnectors/chunk-5TN5Z2WY.js +87 -0
  39. package/dist/wallets/walletConnectors/chunk-6DRCY52E.js +69 -0
  40. package/dist/wallets/walletConnectors/chunk-6UCI7GM6.js +98 -0
  41. package/dist/wallets/walletConnectors/chunk-6YO27XOM.js +96 -0
  42. package/dist/wallets/walletConnectors/chunk-7OARWILZ.js +92 -0
  43. package/dist/wallets/walletConnectors/chunk-7V33VJAL.js +218 -0
  44. package/dist/wallets/walletConnectors/chunk-APHCF4DT.js +103 -0
  45. package/dist/wallets/walletConnectors/chunk-CJJT7LMT.js +96 -0
  46. package/dist/wallets/walletConnectors/chunk-DEFRRPXB.js +98 -0
  47. package/dist/wallets/walletConnectors/chunk-EKJHJFRN.js +69 -0
  48. package/dist/wallets/walletConnectors/chunk-FG2LDVXL.js +92 -0
  49. package/dist/wallets/walletConnectors/chunk-GH4M6FTK.js +95 -0
  50. package/dist/wallets/walletConnectors/chunk-GSHSWVEG.js +70 -0
  51. package/dist/wallets/walletConnectors/chunk-GVOQTORD.js +87 -0
  52. package/dist/wallets/walletConnectors/chunk-HETS3KKI.js +218 -0
  53. package/dist/wallets/walletConnectors/chunk-HOPH3TQ3.js +99 -0
  54. package/dist/wallets/walletConnectors/chunk-HRDPUW3V.js +94 -0
  55. package/dist/wallets/walletConnectors/chunk-HXWUH73P.js +93 -0
  56. package/dist/wallets/walletConnectors/chunk-IICWJWGZ.js +110 -0
  57. package/dist/wallets/walletConnectors/chunk-KO56HCTI.js +106 -0
  58. package/dist/wallets/walletConnectors/chunk-KWX2SYU2.js +100 -0
  59. package/dist/wallets/walletConnectors/chunk-LCIPVVH5.js +70 -0
  60. package/dist/wallets/walletConnectors/chunk-LI6QY2B5.js +94 -0
  61. package/dist/wallets/walletConnectors/chunk-PKMAPNN6.js +92 -0
  62. package/dist/wallets/walletConnectors/chunk-T4ROGPMF.js +106 -0
  63. package/dist/wallets/walletConnectors/chunk-TTHM3WUR.js +100 -0
  64. package/dist/wallets/walletConnectors/chunk-UDTBQV4Q.js +96 -0
  65. package/dist/wallets/walletConnectors/chunk-V6UOWTEZ.js +95 -0
  66. package/dist/wallets/walletConnectors/chunk-VJZWNQOF.js +92 -0
  67. package/dist/wallets/walletConnectors/chunk-XBLHZICW.js +103 -0
  68. package/dist/wallets/walletConnectors/chunk-XVBSJCW5.js +96 -0
  69. package/dist/wallets/walletConnectors/chunk-YIEASHLS.js +99 -0
  70. package/dist/wallets/walletConnectors/chunk-ZPSPK6LH.js +66 -0
  71. package/dist/wallets/walletConnectors/index.js +65 -65
  72. package/package.json +3 -3
  73. /package/dist/clients/{chunk-LMEQD56M.js → chunk-GCAV3VTB.js} +0 -0
@@ -0,0 +1,225 @@
1
+ "use client";
2
+
3
+ // src/utils/funLogger.ts
4
+ import { datadogLogs } from "@datadog/browser-logs";
5
+ import { DEV_API_KEY } from "@funkit/api-base";
6
+ var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
7
+ var FUN_DEV_API_KEYS = [
8
+ "hnHevQR0y394nBprGrvNx4HgoZHUwMet5mXTOBhf",
9
+ "MYny3w7xJh6PRlRgkJ9604sHouY2MTke6lCPpSHq",
10
+ DEV_API_KEY
11
+ ];
12
+ function setDdogEnv(environment) {
13
+ datadogLogs.setGlobalContextProperty("env", environment);
14
+ }
15
+ function setDdogTrackingConsent(consent) {
16
+ datadogLogs.setTrackingConsent(consent);
17
+ }
18
+ var FunLogger = class {
19
+ constructor() {
20
+ setDdogEnv("development" /* DEVELOPMENT */);
21
+ setDdogTrackingConsent("granted");
22
+ this.apiKey = null;
23
+ this.isDebugMode = false;
24
+ this.userId = null;
25
+ this.userAddress = null;
26
+ this.userName = null;
27
+ this.userLoginType = null;
28
+ this.typeLabel = null;
29
+ this.sdkVersion = null;
30
+ this.l2Address = null;
31
+ this.isConfigured = false;
32
+ this.logQueue = [];
33
+ this.disableLogging = false;
34
+ }
35
+ getFunLogEnv() {
36
+ if (!this.apiKey || FUN_DEV_API_KEYS.includes(this.apiKey)) {
37
+ return "development" /* DEVELOPMENT */;
38
+ }
39
+ return "production" /* PRODUCTION */;
40
+ }
41
+ logDataDog(level, title, data, error) {
42
+ if (typeof window === "undefined") {
43
+ return;
44
+ }
45
+ const datadogData = {
46
+ data,
47
+ apiKey: this.apiKey,
48
+ userId: this.userId,
49
+ userName: this.userName,
50
+ userAddress: this.userAddress,
51
+ userLoginType: this.userLoginType,
52
+ typeLabel: this.typeLabel,
53
+ sdkVersion: this.sdkVersion
54
+ };
55
+ switch (level) {
56
+ case "info":
57
+ datadogLogs.logger.info(title, datadogData);
58
+ break;
59
+ case "debug":
60
+ datadogLogs.logger.debug(title, datadogData);
61
+ break;
62
+ case "warn":
63
+ datadogLogs.logger.warn(title, datadogData);
64
+ break;
65
+ case "error":
66
+ datadogLogs.logger.error(title, datadogData, error);
67
+ }
68
+ }
69
+ processLog(level, title, data, error) {
70
+ if (!this.isConfigured) {
71
+ this.logQueue.push({ level, title, data, error });
72
+ return;
73
+ }
74
+ if (!this.apiKey) {
75
+ console.error(
76
+ "FunLogger: apiKey is not set. Please call configure() with a valid apiKey."
77
+ );
78
+ return;
79
+ }
80
+ const isProd = this.getFunLogEnv() === "production" /* PRODUCTION */;
81
+ if (isProd) {
82
+ this.logDataDog(level, title, data, error);
83
+ }
84
+ if (!isProd || this.isDebugMode) {
85
+ const formattedData = data || "";
86
+ switch (level) {
87
+ case "debug":
88
+ console.debug(title, formattedData);
89
+ break;
90
+ case "info":
91
+ console.log(title, formattedData);
92
+ break;
93
+ case "warn":
94
+ console.warn(title, formattedData);
95
+ break;
96
+ case "error":
97
+ console.error(title, formattedData, error);
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ onDebug({ title, data }) {
103
+ this.processLog("debug", title, data);
104
+ }
105
+ onInfo({ title, data }) {
106
+ this.processLog("info", title, data);
107
+ }
108
+ onWarn({ title, data }) {
109
+ this.processLog("warn", title, data);
110
+ }
111
+ onError({ title, error, data }) {
112
+ this.processLog("error", title, data, error);
113
+ }
114
+ extractError(error) {
115
+ if (error instanceof Error) {
116
+ return error;
117
+ }
118
+ if (typeof error === "object" && error !== null && "error" in error && error.error instanceof Error) {
119
+ return error.error;
120
+ }
121
+ return null;
122
+ }
123
+ /**========================
124
+ * PUBLIC LOGGER FUNCTIONS
125
+ *=========================*/
126
+ log(title, data) {
127
+ this.onInfo({ title, data });
128
+ }
129
+ info(title, data) {
130
+ this.onInfo({ title, data });
131
+ }
132
+ debug(title, data) {
133
+ this.onDebug({ title, data });
134
+ }
135
+ warn(title, data) {
136
+ this.onWarn({ title, data });
137
+ }
138
+ /**
139
+ * @param errorOrData -
140
+ * Previously was called "error" but since in the {@link Logger} interface, error is defined as object (which is the same thing as "any"), we treat it as of unknown type here for safety.
141
+ * In a lot of places it's actually being used as a "data" prop, which also usually has an `.error` property representing an actual {@link Error} object.
142
+ */
143
+ error(title, errorOrData, _data = {}) {
144
+ const error = this.extractError(errorOrData) ?? void 0;
145
+ const data = {
146
+ ..._data,
147
+ ...typeof errorOrData === "object" && errorOrData !== null ? errorOrData : {}
148
+ };
149
+ this.onError({ title, error, data });
150
+ }
151
+ flushLogQueue() {
152
+ const queueCopy = [...this.logQueue];
153
+ this.logQueue = [];
154
+ for (const queuedLog of queueCopy) {
155
+ const { level, title, data, error } = queuedLog;
156
+ switch (level) {
157
+ case "debug":
158
+ this.onDebug({ title, data });
159
+ break;
160
+ case "info":
161
+ this.onInfo({ title, data });
162
+ break;
163
+ case "warn":
164
+ this.onWarn({ title, data });
165
+ break;
166
+ case "error":
167
+ this.onError({ title, data, error });
168
+ break;
169
+ }
170
+ }
171
+ }
172
+ configure(apiKey, isDebug, sdkVersion, disableLogging = false) {
173
+ this.apiKey = apiKey;
174
+ this.isDebugMode = isDebug;
175
+ this.sdkVersion = sdkVersion;
176
+ this.disableLogging = disableLogging;
177
+ this.isConfigured = true;
178
+ setDdogEnv(this.getFunLogEnv());
179
+ setDdogTrackingConsent(this.disableLogging ? "not-granted" : "granted");
180
+ this.flushLogQueue();
181
+ }
182
+ getUserId() {
183
+ return this.userId;
184
+ }
185
+ getUserAddress() {
186
+ return this.userAddress;
187
+ }
188
+ getUserName() {
189
+ return this.userName;
190
+ }
191
+ getUserLoginType() {
192
+ return this.userLoginType;
193
+ }
194
+ getTypeLabel() {
195
+ return this.typeLabel;
196
+ }
197
+ getL2Address() {
198
+ return this.l2Address;
199
+ }
200
+ setUserInfo(userId, userAddress, userName, userLoginType, typeLabel, l2Address) {
201
+ this.userId = userId;
202
+ this.userAddress = userAddress;
203
+ this.userName = userName;
204
+ this.userLoginType = userLoginType;
205
+ this.typeLabel = typeLabel;
206
+ this.l2Address = l2Address ?? null;
207
+ }
208
+ };
209
+ datadogLogs.init({
210
+ clientToken: DDOG_CLIENT_TOKEN,
211
+ site: "datadoghq.com",
212
+ forwardErrorsToLogs: false,
213
+ sessionSampleRate: 100,
214
+ service: "connect-sdk"
215
+ // proxy(params) {
216
+ // console.log('proxy', params)
217
+ // console.log('dd-params', params)
218
+ // return ''
219
+ // },
220
+ });
221
+ var logger = new FunLogger();
222
+
223
+ export {
224
+ logger
225
+ };
@@ -0,0 +1,229 @@
1
+ "use client";
2
+
3
+ // src/utils/funLogger.ts
4
+ import { datadogLogs } from "@datadog/browser-logs";
5
+ import { DEV_API_KEY } from "@funkit/api-base";
6
+ import { deflateSync, strToU8 } from "fflate";
7
+ var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
8
+ var FUN_DEV_API_KEYS = [
9
+ "hnHevQR0y394nBprGrvNx4HgoZHUwMet5mXTOBhf",
10
+ "MYny3w7xJh6PRlRgkJ9604sHouY2MTke6lCPpSHq",
11
+ DEV_API_KEY
12
+ ];
13
+ function setDdogEnv(environment) {
14
+ datadogLogs.setGlobalContextProperty("env", environment);
15
+ }
16
+ function setDdogTrackingConsent(consent) {
17
+ datadogLogs.setTrackingConsent(consent);
18
+ }
19
+ var FunLogger = class {
20
+ constructor() {
21
+ setDdogEnv("development" /* DEVELOPMENT */);
22
+ setDdogTrackingConsent("granted");
23
+ this.apiKey = null;
24
+ this.isDebugMode = false;
25
+ this.userId = null;
26
+ this.userAddress = null;
27
+ this.userName = null;
28
+ this.userLoginType = null;
29
+ this.typeLabel = null;
30
+ this.sdkVersion = null;
31
+ this.l2Address = null;
32
+ this.isConfigured = false;
33
+ this.logQueue = [];
34
+ this.disableLogging = false;
35
+ }
36
+ getFunLogEnv() {
37
+ if (!this.apiKey || FUN_DEV_API_KEYS.includes(this.apiKey)) {
38
+ return "development" /* DEVELOPMENT */;
39
+ }
40
+ return "production" /* PRODUCTION */;
41
+ }
42
+ logDataDog(level, title, data, error) {
43
+ if (typeof window === "undefined") {
44
+ return;
45
+ }
46
+ const datadogData = {
47
+ data,
48
+ apiKey: this.apiKey,
49
+ userId: this.userId,
50
+ userName: this.userName,
51
+ userAddress: this.userAddress,
52
+ userLoginType: this.userLoginType,
53
+ typeLabel: this.typeLabel,
54
+ sdkVersion: this.sdkVersion
55
+ };
56
+ switch (level) {
57
+ case "info":
58
+ datadogLogs.logger.info(title, datadogData);
59
+ break;
60
+ case "debug":
61
+ datadogLogs.logger.debug(title, datadogData);
62
+ break;
63
+ case "warn":
64
+ datadogLogs.logger.warn(title, datadogData);
65
+ break;
66
+ case "error":
67
+ datadogLogs.logger.error(title, datadogData, error);
68
+ }
69
+ }
70
+ processLog(level, title, data, error) {
71
+ if (!this.isConfigured) {
72
+ this.logQueue.push({ level, title, data, error });
73
+ return;
74
+ }
75
+ if (!this.apiKey) {
76
+ console.error(
77
+ "FunLogger: apiKey is not set. Please call configure() with a valid apiKey."
78
+ );
79
+ return;
80
+ }
81
+ const isProd = this.getFunLogEnv() === "production" /* PRODUCTION */;
82
+ if (isProd) {
83
+ this.logDataDog(level, title, data, error);
84
+ }
85
+ if (!isProd || this.isDebugMode) {
86
+ const formattedData = data || "";
87
+ switch (level) {
88
+ case "debug":
89
+ console.debug(title, formattedData);
90
+ break;
91
+ case "info":
92
+ console.log(title, formattedData);
93
+ break;
94
+ case "warn":
95
+ console.warn(title, formattedData);
96
+ break;
97
+ case "error":
98
+ console.error(title, formattedData, error);
99
+ break;
100
+ }
101
+ }
102
+ }
103
+ onDebug({ title, data }) {
104
+ this.processLog("debug", title, data);
105
+ }
106
+ onInfo({ title, data }) {
107
+ this.processLog("info", title, data);
108
+ }
109
+ onWarn({ title, data }) {
110
+ this.processLog("warn", title, data);
111
+ }
112
+ onError({ title, error, data }) {
113
+ this.processLog("error", title, data, error);
114
+ }
115
+ extractError(error) {
116
+ if (error instanceof Error) {
117
+ return error;
118
+ }
119
+ if (typeof error === "object" && error !== null && "error" in error && error.error instanceof Error) {
120
+ return error.error;
121
+ }
122
+ return null;
123
+ }
124
+ /**========================
125
+ * PUBLIC LOGGER FUNCTIONS
126
+ *=========================*/
127
+ log(title, data) {
128
+ this.onInfo({ title, data });
129
+ }
130
+ info(title, data) {
131
+ this.onInfo({ title, data });
132
+ }
133
+ debug(title, data) {
134
+ this.onDebug({ title, data });
135
+ }
136
+ warn(title, data) {
137
+ this.onWarn({ title, data });
138
+ }
139
+ /**
140
+ * @param errorOrData -
141
+ * Previously was called "error" but since in the {@link Logger} interface, error is defined as object (which is the same thing as "any"), we treat it as of unknown type here for safety.
142
+ * In a lot of places it's actually being used as a "data" prop, which also usually has an `.error` property representing an actual {@link Error} object.
143
+ */
144
+ error(title, errorOrData, _data = {}) {
145
+ const error = this.extractError(errorOrData) ?? void 0;
146
+ const data = {
147
+ ..._data,
148
+ ...typeof errorOrData === "object" && errorOrData !== null ? errorOrData : {}
149
+ };
150
+ this.onError({ title, error, data });
151
+ }
152
+ flushLogQueue() {
153
+ const queueCopy = [...this.logQueue];
154
+ this.logQueue = [];
155
+ for (const queuedLog of queueCopy) {
156
+ const { level, title, data, error } = queuedLog;
157
+ switch (level) {
158
+ case "debug":
159
+ this.onDebug({ title, data });
160
+ break;
161
+ case "info":
162
+ this.onInfo({ title, data });
163
+ break;
164
+ case "warn":
165
+ this.onWarn({ title, data });
166
+ break;
167
+ case "error":
168
+ this.onError({ title, data, error });
169
+ break;
170
+ }
171
+ }
172
+ }
173
+ configure(apiKey, isDebug, sdkVersion, disableLogging = false) {
174
+ this.apiKey = apiKey;
175
+ this.isDebugMode = isDebug;
176
+ this.sdkVersion = sdkVersion;
177
+ this.disableLogging = disableLogging;
178
+ this.isConfigured = true;
179
+ setDdogEnv(this.getFunLogEnv());
180
+ setDdogTrackingConsent(this.disableLogging ? "not-granted" : "granted");
181
+ this.flushLogQueue();
182
+ }
183
+ getUserId() {
184
+ return this.userId;
185
+ }
186
+ getUserAddress() {
187
+ return this.userAddress;
188
+ }
189
+ getUserName() {
190
+ return this.userName;
191
+ }
192
+ getUserLoginType() {
193
+ return this.userLoginType;
194
+ }
195
+ getTypeLabel() {
196
+ return this.typeLabel;
197
+ }
198
+ getL2Address() {
199
+ return this.l2Address;
200
+ }
201
+ setUserInfo(userId, userAddress, userName, userLoginType, typeLabel, l2Address) {
202
+ this.userId = userId;
203
+ this.userAddress = userAddress;
204
+ this.userName = userName;
205
+ this.userLoginType = userLoginType;
206
+ this.typeLabel = typeLabel;
207
+ this.l2Address = l2Address ?? null;
208
+ }
209
+ };
210
+ function encode(params) {
211
+ const compressed = deflateSync(strToU8(JSON.stringify(params)));
212
+ return btoa(String.fromCharCode(...compressed)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
213
+ }
214
+ datadogLogs.init({
215
+ clientToken: DDOG_CLIENT_TOKEN,
216
+ site: "datadoghq.com",
217
+ forwardErrorsToLogs: false,
218
+ sessionSampleRate: 100,
219
+ service: "connect-sdk",
220
+ proxy(params) {
221
+ const encoded = encode(params);
222
+ return `https://puppy.fun.xyz/api?a=${encoded}`;
223
+ }
224
+ });
225
+ var logger = new FunLogger();
226
+
227
+ export {
228
+ logger
229
+ };