@funkit/connect 9.0.3 → 9.2.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 +43 -0
  2. package/dist/__generated__/default_configs.d.ts +6 -0
  3. package/dist/clients/chunk-SBQ2UUPK.js +214 -0
  4. package/dist/clients/fanatics.js +3 -211
  5. package/dist/clients/polymarket.d.ts +41 -0
  6. package/dist/clients/polymarket.js +345 -0
  7. package/dist/components/Dropdown/ReceiveTokenDropdown.d.ts +3 -1
  8. package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +13 -0
  9. package/dist/components/FunDivider/FunDivider.d.ts +2 -1
  10. package/dist/consts/bluvo.d.ts +5 -1
  11. package/dist/consts/customers.d.ts +0 -1
  12. package/dist/domains/swapped.d.ts +5 -1
  13. package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -1
  14. package/dist/hooks/useCheckoutDirectExecution.d.ts +1 -1
  15. package/dist/hooks/useFrogAccount.d.ts +1 -1
  16. package/dist/hooks/useFunkitMaxCheckoutUsdInfo.d.ts +5 -5
  17. package/dist/hooks/useIsUsUser.d.ts +0 -1
  18. package/dist/index.css +130 -118
  19. package/dist/index.js +21451 -21458
  20. package/dist/modals/CheckoutModal/Brokerage/components/BrokerageSuccess.d.ts +1 -1
  21. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +0 -1
  22. package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +1 -4
  23. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +1 -5
  24. package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsList.d.ts +4 -3
  25. package/dist/modals/CheckoutModal/SourceChange/sourceChange.css.d.ts +1 -0
  26. package/dist/modals/CheckoutModal/stepTransition.d.ts +1 -7
  27. package/dist/modals/WithdrwalModal/WithdrawalCallbackSuccess.d.ts +10 -0
  28. package/dist/providers/FunkitCheckoutContext/index.d.ts +1 -1
  29. package/dist/providers/FunkitCheckoutContext/types.d.ts +6 -4
  30. package/dist/utils/flags/config.d.ts +15 -1
  31. package/dist/utils/withdrawal.d.ts +13 -0
  32. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  37. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  39. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  40. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  41. package/dist/wallets/walletConnectors/index.js +51 -51
  42. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  43. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  44. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  49. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  50. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  51. package/package.json +3 -3
  52. package/dist/modals/CheckoutModal/DirectExecutionNotifCenter/DirectExecutionNotifCenter.d.ts +0 -12
  53. package/dist/modals/CheckoutModal/DirectExecutionNotifCenter/DirectExecutionNotifCenterContent.d.ts +0 -10
  54. package/dist/modals/CheckoutModal/SourceChange/DefiPurchaseSection.d.ts +0 -7
  55. package/dist/modals/WithdrwalModal/WithdrawalNotification.d.ts +0 -12
  56. package/dist/wallets/walletConnectors/{chunk-NEK7T3IC.js → chunk-4C7ER452.js} +3 -3
  57. package/dist/wallets/walletConnectors/{chunk-UVMMPRDM.js → chunk-53VYSPXK.js} +3 -3
  58. package/dist/wallets/walletConnectors/{chunk-I7K6LUZR.js → chunk-6UCI7GM6.js} +3 -3
  59. package/dist/wallets/walletConnectors/{chunk-3Y2GG3PM.js → chunk-6YO27XOM.js} +3 -3
  60. package/dist/wallets/walletConnectors/{chunk-DWMUM4F6.js → chunk-7OARWILZ.js} +3 -3
  61. package/dist/wallets/walletConnectors/{chunk-FDVJHNLL.js → chunk-CJJT7LMT.js} +3 -3
  62. package/dist/wallets/walletConnectors/{chunk-CT3QPTAU.js → chunk-EKJHJFRN.js} +3 -3
  63. package/dist/wallets/walletConnectors/{chunk-TIT5F32X.js → chunk-GH4M6FTK.js} +3 -3
  64. package/dist/wallets/walletConnectors/{chunk-UVYZSGIX.js → chunk-GSHSWVEG.js} +3 -3
  65. package/dist/wallets/walletConnectors/{chunk-CMLFDRCP.js → chunk-GVOQTORD.js} +3 -3
  66. package/dist/wallets/walletConnectors/{chunk-3YCR2ZB4.js → chunk-HETS3KKI.js} +3 -3
  67. package/dist/wallets/walletConnectors/{chunk-C4RP2DNH.js → chunk-HOPH3TQ3.js} +3 -3
  68. package/dist/wallets/walletConnectors/{chunk-CBI3SGOC.js → chunk-IICWJWGZ.js} +3 -3
  69. package/dist/wallets/walletConnectors/{chunk-ZMRIQOR5.js → chunk-KO56HCTI.js} +3 -3
  70. package/dist/wallets/walletConnectors/{chunk-COX3VEDR.js → chunk-LI6QY2B5.js} +3 -3
  71. package/dist/wallets/walletConnectors/{chunk-RLLTYOWT.js → chunk-PKMAPNN6.js} +3 -3
  72. package/dist/wallets/walletConnectors/{chunk-UPUDLUBT.js → chunk-TTHM3WUR.js} +3 -3
  73. package/dist/wallets/walletConnectors/{chunk-N3UJMC3V.js → chunk-XBLHZICW.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 9.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e18c036: Fix withdrawal amount floating-point precision loss by using string through the entire pipeline
8
+ - ee5b133: feat(connect,api-base): pass recipientTargets to fops endpoint to support sol fallback asset
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [ee5b133]
13
+ - @funkit/api-base@2.4.0
14
+
15
+ ## 9.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - c3406b4: Deprecate isDefiMode: remove all defi mode logic from checkout flows, step transitions, and UI rendering. The config field is kept as deprecated for backwards compatibility but is now ignored.
20
+ - 9b8fd18: Add Polymarket V2 PMCT withdrawal callback client
21
+ - ea23c95: Add shared PendingSuccessScreen for withdrawal callback and brokerage success flows
22
+
23
+ ### Patch Changes
24
+
25
+ - 6bcb8f1: feat: move exchange rates call to source screen
26
+ - cbc9fa4: chore: deprecate bankr
27
+ - 51b0c6a: Fix withdrawal receive token defaulting to source token (PMCT bug). Add `defaultReceiveToken` field to `WithdrawalConfigBase` so clients can specify the receive token independently from the source token.
28
+ - 96f5622: make fop priority order a statsig dynamic config
29
+ - 5a2ea07: fix: Fix Solana token addresses being lowercased during checkout initialization, which invalidated base58 addresses during UDA generation
30
+ - 4a7c501: Update Polymarket V2 PMCT deposit and withdrawal to display PMCT token name and icon instead of USDC
31
+ - 960d8cb: Remove DirectExecutionNotifCenter from checkout modal
32
+ - 5f83040: Add quote:trigger logging to differentiate initial, retry, and refresh quotes
33
+ - 9e93823: feat(connect): migrate MaxCheckoutUsd flag to statsig
34
+ - 1791dc1: feat: add gate exchange as coming soon
35
+ - 9dc0504: feat(connect): show unavailable sources as coming soon
36
+ - 28bf845: feat(connect): statsig swapped navigation login events
37
+ - 2027f83: Clarify QR code URI comment with EIP-681 context and known wallet issues
38
+ - a748bda: lighter swapped ui improvements pt1
39
+ - 802eebc: feat: minor adjustments to match swapped loading skeleton
40
+ - a51fbd2: feat(connect): use fop priority to determine primary payment method
41
+ - Updated dependencies [cbc9fa4]
42
+ - Updated dependencies [9e93823]
43
+ - @funkit/api-base@2.3.3
44
+ - @funkit/utils@1.2.4
45
+
3
46
  ## 9.0.3
4
47
 
5
48
  ### Patch Changes
@@ -302,6 +302,9 @@ declare const _default: {
302
302
  readonly enabletokentransferuniversaldepositaddress: {
303
303
  readonly value: true;
304
304
  };
305
+ readonly foppriority: {
306
+ readonly value: readonly ["CARDS", "APPLE_PAY", "GOOGLE_PAY", "REVOLUT_PAY", "PAYPAL", "BANK_TRANSFER", "PIX", "SKRILL"];
307
+ };
305
308
  readonly ischeckoutactivated: {
306
309
  readonly value: true;
307
310
  };
@@ -313,6 +316,9 @@ declare const _default: {
313
316
  readonly isrelaybypassenabled: {
314
317
  readonly value: true;
315
318
  };
319
+ readonly maxcheckoutusd: {
320
+ readonly value: -1;
321
+ };
316
322
  readonly meldquickoptions: {
317
323
  readonly value: {
318
324
  readonly USD: readonly [100, 500, 1000];
@@ -0,0 +1,214 @@
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.sdkVersion = null;
29
+ this.l2Address = null;
30
+ this.isConfigured = false;
31
+ this.logQueue = [];
32
+ this.disableLogging = false;
33
+ }
34
+ getFunLogEnv() {
35
+ if (!this.apiKey || FUN_DEV_API_KEYS.includes(this.apiKey)) {
36
+ return "development" /* DEVELOPMENT */;
37
+ }
38
+ return "production" /* PRODUCTION */;
39
+ }
40
+ logDataDog(level, title, data, error) {
41
+ if (typeof window === "undefined") {
42
+ return;
43
+ }
44
+ const datadogData = {
45
+ data,
46
+ apiKey: this.apiKey,
47
+ userId: this.userId,
48
+ userName: this.userName,
49
+ userAddress: this.userAddress,
50
+ userLoginType: this.userLoginType,
51
+ sdkVersion: this.sdkVersion
52
+ };
53
+ switch (level) {
54
+ case "info":
55
+ datadogLogs.logger.info(title, datadogData);
56
+ break;
57
+ case "debug":
58
+ datadogLogs.logger.debug(title, datadogData);
59
+ break;
60
+ case "warn":
61
+ datadogLogs.logger.warn(title, datadogData);
62
+ break;
63
+ case "error":
64
+ datadogLogs.logger.error(title, datadogData, error);
65
+ }
66
+ }
67
+ processLog(level, title, data, error) {
68
+ if (!this.isConfigured) {
69
+ this.logQueue.push({ level, title, data, error });
70
+ return;
71
+ }
72
+ if (!this.apiKey) {
73
+ console.error(
74
+ "FunLogger: apiKey is not set. Please call configure() with a valid apiKey."
75
+ );
76
+ return;
77
+ }
78
+ const isProd = this.getFunLogEnv() === "production" /* PRODUCTION */;
79
+ if (isProd) {
80
+ this.logDataDog(level, title, data, error);
81
+ }
82
+ if (!isProd || this.isDebugMode) {
83
+ const formattedData = data || "";
84
+ switch (level) {
85
+ case "debug":
86
+ console.debug(title, formattedData);
87
+ break;
88
+ case "info":
89
+ console.log(title, formattedData);
90
+ break;
91
+ case "warn":
92
+ console.warn(title, formattedData);
93
+ break;
94
+ case "error":
95
+ console.error(title, formattedData, error);
96
+ break;
97
+ }
98
+ }
99
+ }
100
+ onDebug({ title, data }) {
101
+ this.processLog("debug", title, data);
102
+ }
103
+ onInfo({ title, data }) {
104
+ this.processLog("info", title, data);
105
+ }
106
+ onWarn({ title, data }) {
107
+ this.processLog("warn", title, data);
108
+ }
109
+ onError({ title, error, data }) {
110
+ this.processLog("error", title, data, error);
111
+ }
112
+ extractError(error) {
113
+ if (error instanceof Error) {
114
+ return error;
115
+ }
116
+ if (typeof error === "object" && error !== null && "error" in error && error.error instanceof Error) {
117
+ return error.error;
118
+ }
119
+ return null;
120
+ }
121
+ /**========================
122
+ * PUBLIC LOGGER FUNCTIONS
123
+ *=========================*/
124
+ log(title, data) {
125
+ this.onInfo({ title, data });
126
+ }
127
+ info(title, data) {
128
+ this.onInfo({ title, data });
129
+ }
130
+ debug(title, data) {
131
+ this.onDebug({ title, data });
132
+ }
133
+ warn(title, data) {
134
+ this.onWarn({ title, data });
135
+ }
136
+ /**
137
+ * @param errorOrData -
138
+ * 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.
139
+ * 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.
140
+ */
141
+ error(title, errorOrData, _data = {}) {
142
+ const error = this.extractError(errorOrData) ?? void 0;
143
+ const data = {
144
+ ..._data,
145
+ ...typeof errorOrData === "object" && errorOrData !== null ? errorOrData : {}
146
+ };
147
+ this.onError({ title, error, data });
148
+ }
149
+ flushLogQueue() {
150
+ const queueCopy = [...this.logQueue];
151
+ this.logQueue = [];
152
+ for (const queuedLog of queueCopy) {
153
+ const { level, title, data, error } = queuedLog;
154
+ switch (level) {
155
+ case "debug":
156
+ this.onDebug({ title, data });
157
+ break;
158
+ case "info":
159
+ this.onInfo({ title, data });
160
+ break;
161
+ case "warn":
162
+ this.onWarn({ title, data });
163
+ break;
164
+ case "error":
165
+ this.onError({ title, data, error });
166
+ break;
167
+ }
168
+ }
169
+ }
170
+ configure(apiKey, isDebug, sdkVersion, disableLogging = false) {
171
+ this.apiKey = apiKey;
172
+ this.isDebugMode = isDebug;
173
+ this.sdkVersion = sdkVersion;
174
+ this.disableLogging = disableLogging;
175
+ this.isConfigured = true;
176
+ setDdogEnv(this.getFunLogEnv());
177
+ setDdogTrackingConsent(this.disableLogging ? "not-granted" : "granted");
178
+ this.flushLogQueue();
179
+ }
180
+ getUserId() {
181
+ return this.userId;
182
+ }
183
+ getUserAddress() {
184
+ return this.userAddress;
185
+ }
186
+ getUserName() {
187
+ return this.userName;
188
+ }
189
+ getUserLoginType() {
190
+ return this.userLoginType;
191
+ }
192
+ getL2Address() {
193
+ return this.l2Address;
194
+ }
195
+ setUserInfo(userId, userAddress, userName, userLoginType, l2Address) {
196
+ this.userId = userId;
197
+ this.userAddress = userAddress;
198
+ this.userName = userName;
199
+ this.userLoginType = userLoginType;
200
+ this.l2Address = l2Address ?? null;
201
+ }
202
+ };
203
+ datadogLogs.init({
204
+ clientToken: DDOG_CLIENT_TOKEN,
205
+ site: "datadoghq.com",
206
+ forwardErrorsToLogs: false,
207
+ sessionSampleRate: 100,
208
+ service: "connect-sdk"
209
+ });
210
+ var logger = new FunLogger();
211
+
212
+ export {
213
+ logger
214
+ };
@@ -1,4 +1,7 @@
1
1
  "use client";
2
+ import {
3
+ logger
4
+ } from "./chunk-SBQ2UUPK.js";
2
5
 
3
6
  // src/clients/fanatics.tsx
4
7
  import React7, { useEffect as useEffect2, useMemo as useMemo2 } from "react";
@@ -88,217 +91,6 @@ Box.displayName = "Box";
88
91
 
89
92
  // src/components/AsyncImage/useAsyncImage.ts
90
93
  import { useEffect, useReducer } from "react";
91
-
92
- // src/utils/funLogger.ts
93
- import { datadogLogs } from "@datadog/browser-logs";
94
- import { DEV_API_KEY } from "@funkit/api-base";
95
- var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
96
- var FUN_DEV_API_KEYS = [
97
- "hnHevQR0y394nBprGrvNx4HgoZHUwMet5mXTOBhf",
98
- "MYny3w7xJh6PRlRgkJ9604sHouY2MTke6lCPpSHq",
99
- DEV_API_KEY
100
- ];
101
- function setDdogEnv(environment) {
102
- datadogLogs.setGlobalContextProperty("env", environment);
103
- }
104
- function setDdogTrackingConsent(consent) {
105
- datadogLogs.setTrackingConsent(consent);
106
- }
107
- var FunLogger = class {
108
- constructor() {
109
- setDdogEnv("development" /* DEVELOPMENT */);
110
- setDdogTrackingConsent("granted");
111
- this.apiKey = null;
112
- this.isDebugMode = false;
113
- this.userId = null;
114
- this.userAddress = null;
115
- this.userName = null;
116
- this.userLoginType = null;
117
- this.sdkVersion = null;
118
- this.l2Address = null;
119
- this.isConfigured = false;
120
- this.logQueue = [];
121
- this.disableLogging = false;
122
- }
123
- getFunLogEnv() {
124
- if (!this.apiKey || FUN_DEV_API_KEYS.includes(this.apiKey)) {
125
- return "development" /* DEVELOPMENT */;
126
- }
127
- return "production" /* PRODUCTION */;
128
- }
129
- logDataDog(level, title, data, error) {
130
- if (typeof window === "undefined") {
131
- return;
132
- }
133
- const datadogData = {
134
- data,
135
- apiKey: this.apiKey,
136
- userId: this.userId,
137
- userName: this.userName,
138
- userAddress: this.userAddress,
139
- userLoginType: this.userLoginType,
140
- sdkVersion: this.sdkVersion
141
- };
142
- switch (level) {
143
- case "info":
144
- datadogLogs.logger.info(title, datadogData);
145
- break;
146
- case "debug":
147
- datadogLogs.logger.debug(title, datadogData);
148
- break;
149
- case "warn":
150
- datadogLogs.logger.warn(title, datadogData);
151
- break;
152
- case "error":
153
- datadogLogs.logger.error(title, datadogData, error);
154
- }
155
- }
156
- processLog(level, title, data, error) {
157
- if (!this.isConfigured) {
158
- this.logQueue.push({ level, title, data, error });
159
- return;
160
- }
161
- if (!this.apiKey) {
162
- console.error(
163
- "FunLogger: apiKey is not set. Please call configure() with a valid apiKey."
164
- );
165
- return;
166
- }
167
- const isProd = this.getFunLogEnv() === "production" /* PRODUCTION */;
168
- if (isProd) {
169
- this.logDataDog(level, title, data, error);
170
- }
171
- if (!isProd || this.isDebugMode) {
172
- const formattedData = data || "";
173
- switch (level) {
174
- case "debug":
175
- console.debug(title, formattedData);
176
- break;
177
- case "info":
178
- console.log(title, formattedData);
179
- break;
180
- case "warn":
181
- console.warn(title, formattedData);
182
- break;
183
- case "error":
184
- console.error(title, formattedData, error);
185
- break;
186
- }
187
- }
188
- }
189
- onDebug({ title, data }) {
190
- this.processLog("debug", title, data);
191
- }
192
- onInfo({ title, data }) {
193
- this.processLog("info", title, data);
194
- }
195
- onWarn({ title, data }) {
196
- this.processLog("warn", title, data);
197
- }
198
- onError({ title, error, data }) {
199
- this.processLog("error", title, data, error);
200
- }
201
- extractError(error) {
202
- if (error instanceof Error) {
203
- return error;
204
- }
205
- if (typeof error === "object" && error !== null && "error" in error && error.error instanceof Error) {
206
- return error.error;
207
- }
208
- return null;
209
- }
210
- /**========================
211
- * PUBLIC LOGGER FUNCTIONS
212
- *=========================*/
213
- log(title, data) {
214
- this.onInfo({ title, data });
215
- }
216
- info(title, data) {
217
- this.onInfo({ title, data });
218
- }
219
- debug(title, data) {
220
- this.onDebug({ title, data });
221
- }
222
- warn(title, data) {
223
- this.onWarn({ title, data });
224
- }
225
- /**
226
- * @param errorOrData -
227
- * 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.
228
- * 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.
229
- */
230
- error(title, errorOrData, _data = {}) {
231
- const error = this.extractError(errorOrData) ?? void 0;
232
- const data = {
233
- ..._data,
234
- ...typeof errorOrData === "object" && errorOrData !== null ? errorOrData : {}
235
- };
236
- this.onError({ title, error, data });
237
- }
238
- flushLogQueue() {
239
- const queueCopy = [...this.logQueue];
240
- this.logQueue = [];
241
- for (const queuedLog of queueCopy) {
242
- const { level, title, data, error } = queuedLog;
243
- switch (level) {
244
- case "debug":
245
- this.onDebug({ title, data });
246
- break;
247
- case "info":
248
- this.onInfo({ title, data });
249
- break;
250
- case "warn":
251
- this.onWarn({ title, data });
252
- break;
253
- case "error":
254
- this.onError({ title, data, error });
255
- break;
256
- }
257
- }
258
- }
259
- configure(apiKey, isDebug, sdkVersion, disableLogging = false) {
260
- this.apiKey = apiKey;
261
- this.isDebugMode = isDebug;
262
- this.sdkVersion = sdkVersion;
263
- this.disableLogging = disableLogging;
264
- this.isConfigured = true;
265
- setDdogEnv(this.getFunLogEnv());
266
- setDdogTrackingConsent(this.disableLogging ? "not-granted" : "granted");
267
- this.flushLogQueue();
268
- }
269
- getUserId() {
270
- return this.userId;
271
- }
272
- getUserAddress() {
273
- return this.userAddress;
274
- }
275
- getUserName() {
276
- return this.userName;
277
- }
278
- getUserLoginType() {
279
- return this.userLoginType;
280
- }
281
- getL2Address() {
282
- return this.l2Address;
283
- }
284
- setUserInfo(userId, userAddress, userName, userLoginType, l2Address) {
285
- this.userId = userId;
286
- this.userAddress = userAddress;
287
- this.userName = userName;
288
- this.userLoginType = userLoginType;
289
- this.l2Address = l2Address ?? null;
290
- }
291
- };
292
- datadogLogs.init({
293
- clientToken: DDOG_CLIENT_TOKEN,
294
- site: "datadoghq.com",
295
- forwardErrorsToLogs: false,
296
- sessionSampleRate: 100,
297
- service: "connect-sdk"
298
- });
299
- var logger = new FunLogger();
300
-
301
- // src/components/AsyncImage/useAsyncImage.ts
302
94
  var cachedUrls = /* @__PURE__ */ new Map();
303
95
  var cachedRequestPromises = /* @__PURE__ */ new Map();
304
96
  async function loadAsyncImage(asyncImage) {
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Polymarket V2 PMCT withdrawal.
3
+ *
4
+ * Withdrawal flow:
5
+ * 1. Generate a UDA (User Deposit Address) for the withdrawal via api-base
6
+ * 2. Transfer PMCT from user's Polymarket proxy to the UDA
7
+ * 3. Backend handles: unwrap PMCT → USDC via PermissionedRamp + route to user
8
+ *
9
+ * The callback conforms to CustomWithdrawalConfig.withdrawCallback.
10
+ */
11
+ import type { Address } from 'viem';
12
+ import type { CustomWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
13
+ export declare const PMCT_WITHDRAW_ACTION_TYPE = "PMCT_WITHDRAW";
14
+ export interface PolymarketWithdrawalCallbackConfig {
15
+ userId: string;
16
+ modalTitle?: string;
17
+ disableConnectedWallet?: boolean;
18
+ /**
19
+ * Execute the ERC-20 transfer of PMCT from the user's proxy to the UDA.
20
+ * Called after the UDA address is generated.
21
+ * Should return when the transaction has been submitted (not necessarily confirmed).
22
+ */
23
+ sendPmctTransfer: (params: {
24
+ /** The UDA address to send PMCT to */
25
+ udaAddress: Address;
26
+ /** Amount in base units (from the quote) */
27
+ amountBaseUnit: bigint;
28
+ }) => Promise<void>;
29
+ }
30
+ /**
31
+ * Creates a full CustomWithdrawalConfig for Polymarket V2 PMCT withdrawals.
32
+ *
33
+ * Usage:
34
+ * ```ts
35
+ * const withdrawalConfig = createPolymarketWithdrawalConfig({
36
+ * userId: walletAddress,
37
+ * sendPmctTransfer: async ({ udaAddress, amountBaseUnit }) => { ... },
38
+ * })
39
+ * ```
40
+ */
41
+ export declare function createPolymarketWithdrawalConfig(config: PolymarketWithdrawalCallbackConfig): CustomWithdrawalConfig;