@funkit/connect 9.0.3 → 9.2.1
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/CHANGELOG.md +56 -0
- package/dist/__generated__/default_configs.d.ts +6 -0
- package/dist/{chunk-SC53AFEE.js → chunk-3U6TWV25.js} +14 -4
- package/dist/{chunk-XCM74QX2.js → chunk-P6FYL3PM.js} +5 -1
- package/dist/{chunk-WSCXOKCX.js → chunk-VLXKSNSJ.js} +5 -1
- package/dist/clients/chunk-SBQ2UUPK.js +214 -0
- package/dist/clients/fanatics.css +4075 -3817
- package/dist/clients/fanatics.js +5 -213
- package/dist/clients/polymarket.d.ts +41 -0
- package/dist/clients/polymarket.js +345 -0
- package/dist/components/Box/Box.d.ts +22 -22
- package/dist/components/Dropdown/ReceiveTokenDropdown.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +13 -0
- package/dist/components/FunDivider/FunDivider.d.ts +3 -1
- package/dist/consts/bluvo.d.ts +5 -1
- package/dist/consts/customers.d.ts +0 -1
- package/dist/css/sprinkles.css.d.ts +34 -22
- package/dist/domains/swapped.d.ts +5 -1
- package/dist/hooks/queries/useFops.d.ts +4 -198
- package/dist/hooks/statsig/useDynamicConfig.d.ts +3 -1
- package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -1
- package/dist/hooks/useCheckoutDirectExecution.d.ts +1 -1
- package/dist/hooks/useCheckoutTransferInit.d.ts +5 -1
- package/dist/hooks/useFrogAccount.d.ts +1 -1
- package/dist/hooks/useFunkitMaxCheckoutUsdInfo.d.ts +5 -5
- package/dist/hooks/useIsUsUser.d.ts +0 -1
- package/dist/hooks/usePaymentSources.d.ts +6 -2
- package/dist/hooks/useScrollDivider.d.ts +1 -0
- package/dist/index.css +4260 -3951
- package/dist/index.js +14274 -13956
- package/dist/modals/CheckoutModal/Brokerage/components/BrokerageSuccess.d.ts +1 -1
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +0 -1
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +1 -4
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +1 -5
- package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsList.d.ts +4 -3
- package/dist/modals/CheckoutModal/SourceChange/SourceList.d.ts +4 -3
- package/dist/modals/CheckoutModal/SourceChange/sourceChange.css.d.ts +5 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +1 -7
- package/dist/modals/WithdrwalModal/WithdrawalCallbackSuccess.d.ts +10 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +6 -4
- package/dist/providers/FunkitConfigContext.d.ts +2 -0
- package/dist/providers/FunkitThemeProvider.d.ts +18 -0
- package/dist/themes/baseTheme.js +1 -1
- package/dist/themes/darkTheme.js +2 -2
- package/dist/themes/lightTheme.js +2 -2
- package/dist/utils/flags/config.d.ts +15 -1
- package/dist/utils/withdrawal.d.ts +13 -0
- package/dist/wallets/walletConnectors/index.js +30 -30
- package/package.json +3 -3
- package/dist/modals/CheckoutModal/DirectExecutionNotifCenter/DirectExecutionNotifCenter.d.ts +0 -12
- package/dist/modals/CheckoutModal/DirectExecutionNotifCenter/DirectExecutionNotifCenterContent.d.ts +0 -10
- package/dist/modals/CheckoutModal/SourceChange/DefiPurchaseSection.d.ts +0 -7
- package/dist/modals/WithdrwalModal/WithdrawalNotification.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 9.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2e118a1: opinion theme updates
|
|
8
|
+
- f991fe5: feat(connect): show Unavailable badge for geo-blocked payment methods
|
|
9
|
+
- f991fe5: feat(connect): swapped coming soon if enabled without uda params
|
|
10
|
+
- 48ad728: feat(connect): limit forms of payments, sticky top section
|
|
11
|
+
- 030b288: Make logger mandatory on BaseApiRequest and update all call sites
|
|
12
|
+
- 61cd479: feat: hide sepa if not in eu
|
|
13
|
+
- Updated dependencies [030b288]
|
|
14
|
+
- @funkit/api-base@3.0.0
|
|
15
|
+
|
|
16
|
+
## 9.2.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- e18c036: Fix withdrawal amount floating-point precision loss by using string through the entire pipeline
|
|
21
|
+
- ee5b133: feat(connect,api-base): pass recipientTargets to fops endpoint to support sol fallback asset
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [ee5b133]
|
|
26
|
+
- @funkit/api-base@2.4.0
|
|
27
|
+
|
|
28
|
+
## 9.1.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- 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.
|
|
33
|
+
- 9b8fd18: Add Polymarket V2 PMCT withdrawal callback client
|
|
34
|
+
- ea23c95: Add shared PendingSuccessScreen for withdrawal callback and brokerage success flows
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 6bcb8f1: feat: move exchange rates call to source screen
|
|
39
|
+
- cbc9fa4: chore: deprecate bankr
|
|
40
|
+
- 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.
|
|
41
|
+
- 96f5622: make fop priority order a statsig dynamic config
|
|
42
|
+
- 5a2ea07: fix: Fix Solana token addresses being lowercased during checkout initialization, which invalidated base58 addresses during UDA generation
|
|
43
|
+
- 4a7c501: Update Polymarket V2 PMCT deposit and withdrawal to display PMCT token name and icon instead of USDC
|
|
44
|
+
- 960d8cb: Remove DirectExecutionNotifCenter from checkout modal
|
|
45
|
+
- 5f83040: Add quote:trigger logging to differentiate initial, retry, and refresh quotes
|
|
46
|
+
- 9e93823: feat(connect): migrate MaxCheckoutUsd flag to statsig
|
|
47
|
+
- 1791dc1: feat: add gate exchange as coming soon
|
|
48
|
+
- 9dc0504: feat(connect): show unavailable sources as coming soon
|
|
49
|
+
- 28bf845: feat(connect): statsig swapped navigation login events
|
|
50
|
+
- 2027f83: Clarify QR code URI comment with EIP-681 context and known wallet issues
|
|
51
|
+
- a748bda: lighter swapped ui improvements pt1
|
|
52
|
+
- 802eebc: feat: minor adjustments to match swapped loading skeleton
|
|
53
|
+
- a51fbd2: feat(connect): use fop priority to determine primary payment method
|
|
54
|
+
- Updated dependencies [cbc9fa4]
|
|
55
|
+
- Updated dependencies [9e93823]
|
|
56
|
+
- @funkit/api-base@2.3.3
|
|
57
|
+
- @funkit/utils@1.2.4
|
|
58
|
+
|
|
3
59
|
## 9.0.3
|
|
4
60
|
|
|
5
61
|
### 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];
|
|
@@ -24,7 +24,9 @@ var radiusScales = {
|
|
|
24
24
|
skeleton: "4px",
|
|
25
25
|
dropdown: "12px",
|
|
26
26
|
dropdownItem: "4px",
|
|
27
|
-
|
|
27
|
+
dropdownList: "12px",
|
|
28
|
+
modalTopbarIcon: "9999px",
|
|
29
|
+
withdrawalInput: "12px"
|
|
28
30
|
},
|
|
29
31
|
medium: {
|
|
30
32
|
actionButton: "10px",
|
|
@@ -42,7 +44,9 @@ var radiusScales = {
|
|
|
42
44
|
skeleton: "4px",
|
|
43
45
|
dropdown: "10px",
|
|
44
46
|
dropdownItem: "4px",
|
|
45
|
-
|
|
47
|
+
dropdownList: "10px",
|
|
48
|
+
modalTopbarIcon: "9999px",
|
|
49
|
+
withdrawalInput: "10px"
|
|
46
50
|
},
|
|
47
51
|
none: {
|
|
48
52
|
actionButton: "0px",
|
|
@@ -60,7 +64,9 @@ var radiusScales = {
|
|
|
60
64
|
skeleton: "0px",
|
|
61
65
|
dropdown: "0px",
|
|
62
66
|
dropdownItem: "0px",
|
|
63
|
-
|
|
67
|
+
dropdownList: "0px",
|
|
68
|
+
modalTopbarIcon: "0px",
|
|
69
|
+
withdrawalInput: "0px"
|
|
64
70
|
},
|
|
65
71
|
small: {
|
|
66
72
|
actionButton: "8px",
|
|
@@ -78,7 +84,9 @@ var radiusScales = {
|
|
|
78
84
|
skeleton: "4px",
|
|
79
85
|
dropdown: "8px",
|
|
80
86
|
dropdownItem: "4px",
|
|
81
|
-
|
|
87
|
+
dropdownList: "8px",
|
|
88
|
+
modalTopbarIcon: "9999px",
|
|
89
|
+
withdrawalInput: "8px"
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
92
|
var blurs = {
|
|
@@ -272,7 +280,9 @@ var baseTheme = ({
|
|
|
272
280
|
tooltip: radiusScales[borderRadius].tooltip,
|
|
273
281
|
dropdown: radiusScales[borderRadius].dropdown,
|
|
274
282
|
dropdownItem: radiusScales[borderRadius].dropdownItem,
|
|
283
|
+
dropdownList: customBorderRadiuses?.dropdownList ?? customBorderRadiuses?.dropdown ?? radiusScales[borderRadius].dropdown,
|
|
275
284
|
modalTopbarIcon: radiusScales[borderRadius].modalTopbarIcon,
|
|
285
|
+
withdrawalInput: radiusScales[borderRadius].withdrawalInput,
|
|
276
286
|
...customBorderRadiuses
|
|
277
287
|
},
|
|
278
288
|
borderWidths: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
baseTheme
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3U6TWV25.js";
|
|
5
5
|
|
|
6
6
|
// src/themes/lightTheme.ts
|
|
7
7
|
var accentColors = {
|
|
@@ -67,6 +67,8 @@ var lightTheme = ({
|
|
|
67
67
|
secondaryText: "#737373",
|
|
68
68
|
tertiaryText: "rgba(0, 0, 0, 0.35)",
|
|
69
69
|
textSelection: "rgba(0, 0, 0, 0.10)",
|
|
70
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#000",
|
|
71
|
+
selectedDropdownItemBackground: "transparent",
|
|
70
72
|
// input
|
|
71
73
|
inputBackground: "#FFFFFF",
|
|
72
74
|
inputBorderBase: "#F0F0F0",
|
|
@@ -165,7 +167,9 @@ var lightTheme = ({
|
|
|
165
167
|
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
166
168
|
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
167
169
|
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
170
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
168
171
|
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#FFF",
|
|
172
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
169
173
|
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#F7F7F7",
|
|
170
174
|
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
171
175
|
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
baseTheme
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3U6TWV25.js";
|
|
5
5
|
|
|
6
6
|
// src/themes/darkTheme.ts
|
|
7
7
|
var accentColors = {
|
|
@@ -67,6 +67,8 @@ var darkTheme = ({
|
|
|
67
67
|
secondaryText: "#8C8C8C",
|
|
68
68
|
tertiaryText: "rgba(255, 255, 255, 0.35)",
|
|
69
69
|
textSelection: "rgba(255, 255, 255, 0.10)",
|
|
70
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#FFF",
|
|
71
|
+
selectedDropdownItemBackground: "transparent",
|
|
70
72
|
// input
|
|
71
73
|
inputBackground: "#000000",
|
|
72
74
|
inputBorderBase: "#333333",
|
|
@@ -165,7 +167,9 @@ var darkTheme = ({
|
|
|
165
167
|
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
166
168
|
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
167
169
|
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
170
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#333333",
|
|
168
171
|
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#000000",
|
|
172
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
169
173
|
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#1F1F1F",
|
|
170
174
|
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
171
175
|
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
@@ -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
|
+
};
|