@funkit/connect 1.0.14 → 1.0.15

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 1.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - f2c5087: fix: normalization bug
8
+ - 762f52c: feat: processing page with completion time estimation
9
+
3
10
  ## 1.0.14
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3409,7 +3409,7 @@ function formatTimestamp(date, shortened = false) {
3409
3409
  const formattedDate = `${month} ${day}${daySuffix}${shortened ? "" : `, ${year}`} \xB7 ${hours % 12 || 12}:${minutes < 10 ? "0" : ""}${minutes}${shortened ? "" : `:${seconds < 10 ? "0" : ""}${seconds}`} ${ampm}`;
3410
3410
  return formattedDate;
3411
3411
  }
3412
- function formatSecondsToReadableForm(seconds, specifyUnderMinute = false) {
3412
+ function formatSecondsToReadableForm(seconds, specifyUnderMinute = false, omitSeconds = false) {
3413
3413
  const normalizedSeconds = Math.ceil(seconds);
3414
3414
  if (normalizedSeconds < 60) {
3415
3415
  if (specifyUnderMinute) {
@@ -3420,6 +3420,9 @@ function formatSecondsToReadableForm(seconds, specifyUnderMinute = false) {
3420
3420
  }
3421
3421
  const mins = Math.floor(normalizedSeconds / 60);
3422
3422
  const remainingSecs = normalizedSeconds % 60;
3423
+ if (omitSeconds) {
3424
+ return `${mins + 1}mins`;
3425
+ }
3423
3426
  if (remainingSecs === 0) {
3424
3427
  return mins === 1 ? `${mins}min` : `${mins}mins`;
3425
3428
  }
@@ -6335,7 +6338,8 @@ function FunTransactionSummary({
6335
6338
  size: "14"
6336
6339
  }, formatSecondsToReadableForm(
6337
6340
  parseFloat(estTime == null ? void 0 : estTime.toString()),
6338
- true
6341
+ true,
6342
+ false
6339
6343
  )) : null), hasTotal ? /* @__PURE__ */ React65.createElement(Fragment2, null, /* @__PURE__ */ React65.createElement(FunTxSummaryDivider, null), /* @__PURE__ */ React65.createElement(LineItem, null, /* @__PURE__ */ React65.createElement(Text, {
6340
6344
  weight: "medium",
6341
6345
  color: "modalTextDim",
@@ -6993,9 +6997,9 @@ function FunPaymentMoonpayType({
6993
6997
  return signature || "";
6994
6998
  };
6995
6999
  const description = useMemo18(() => {
6996
- const normalizedConvertedAssetName = finalConvertedAssetName.toLowerCase();
7000
+ let normalizedConvertedAssetName = finalConvertedAssetName.toLowerCase();
6997
7001
  if (normalizedConvertedAssetName.startsWith("$")) {
6998
- return normalizedConvertedAssetName.slice(1);
7002
+ normalizedConvertedAssetName = normalizedConvertedAssetName.slice(1);
6999
7003
  }
7000
7004
  const isSame = normalizedConvertedAssetName === depositToken.toLowerCase();
7001
7005
  const conversionText = finalConvertedAssetName && !isSame ? ` that is then automatically converted to ${finalConvertedAssetName}.` : ".";
@@ -13339,6 +13343,7 @@ function FunCheckoutHistoryDetail({
13339
13343
  checkoutHistoryInfo
13340
13344
  }) {
13341
13345
  const checkoutItem = checkoutHistoryInfo.clientMetadata;
13346
+ console.log("checkoutItem", checkoutItem);
13342
13347
  const { isCheckoutDirectCrFlow } = useCheckoutType(checkoutItem);
13343
13348
  const {
13344
13349
  isProcessing,
@@ -13354,6 +13359,17 @@ function FunCheckoutHistoryDetail({
13354
13359
  checkoutHistoryInfo.depositAddr
13355
13360
  );
13356
13361
  useWalletAssetsListener(isProcessing || isCompleted);
13362
+ const estimatedEndTimeInfo = useMemo31(() => {
13363
+ var _a;
13364
+ const estimatedEndTimeMs = (((_a = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _a.finalTimeEstimationMs) || 0) + checkoutHistoryInfo.createdTimeMs;
13365
+ const estimatedEndTimeFromNowMs = estimatedEndTimeMs - Date.now();
13366
+ const isExceededEstimation = estimatedEndTimeFromNowMs <= 0;
13367
+ return {
13368
+ estimatedEndTimeMs,
13369
+ estimatedEndTimeFromNowMs,
13370
+ isExceededEstimation
13371
+ };
13372
+ }, [checkoutHistoryInfo.createdTimeMs, checkoutItem]);
13357
13373
  const timelineLabels = useMemo31(() => {
13358
13374
  const fromExplorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[checkoutHistoryInfo.fromChainId].explorerInfo;
13359
13375
  const toExplorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[checkoutHistoryInfo.toChainId].explorerInfo;
@@ -13381,7 +13397,13 @@ function FunCheckoutHistoryDetail({
13381
13397
  )
13382
13398
  ) : isTerminal ? formatTimestamp(
13383
13399
  new Date(checkoutHistoryInfo.lastUpdatedTimeMs)
13384
- ) : "",
13400
+ ) : estimatedEndTimeInfo.isExceededEstimation ? "" : `Estimated to complete in ${formatSecondsToReadableForm(
13401
+ Math.floor(
13402
+ estimatedEndTimeInfo.estimatedEndTimeFromNowMs / 1e3
13403
+ ),
13404
+ true,
13405
+ true
13406
+ )}`,
13385
13407
  ...isCompleted ? {
13386
13408
  linkText: `View on ${toExplorerInfo.name}`,
13387
13409
  linkUrl: `${toExplorerInfo.url}/address/${checkoutHistoryInfo.recipientAddr}`
@@ -13401,6 +13423,8 @@ function FunCheckoutHistoryDetail({
13401
13423
  isError,
13402
13424
  isExpired,
13403
13425
  isTerminal,
13426
+ estimatedEndTimeInfo.isExceededEstimation,
13427
+ estimatedEndTimeInfo.estimatedEndTimeFromNowMs,
13404
13428
  isCompleted
13405
13429
  ]);
13406
13430
  return /* @__PURE__ */ React137.createElement(Box, {
@@ -13423,7 +13447,7 @@ function FunCheckoutHistoryDetail({
13423
13447
  step: isCheckoutDirectCrFlow ? 2 : isTerminal ? 3 : 2,
13424
13448
  totalSteps: timelineLabels.length,
13425
13449
  labels: timelineLabels
13426
- }), isTerminal ? null : /* @__PURE__ */ React137.createElement(Box, {
13450
+ }), isTerminal || !isCheckoutDirectCrFlow ? null : /* @__PURE__ */ React137.createElement(Box, {
13427
13451
  display: "flex",
13428
13452
  flexDirection: "column",
13429
13453
  alignItems: "center",
@@ -13431,7 +13455,7 @@ function FunCheckoutHistoryDetail({
13431
13455
  }, /* @__PURE__ */ React137.createElement(Text, {
13432
13456
  size: "12",
13433
13457
  color: "modalTextDim"
13434
- }, isCheckoutDirectCrFlow ? "Funds may take up to 10 minutes to arrive." : "You will receive a notification when your order has finished."))), isFailedFinal ? /* @__PURE__ */ React137.createElement(FunToast, {
13458
+ }, "Funds may take up to 10 minutes to arrive."))), isFailedFinal ? /* @__PURE__ */ React137.createElement(FunToast, {
13435
13459
  type: 1 /* ERROR */,
13436
13460
  title: "Order Failed",
13437
13461
  isDescriptionText: false,
@@ -15702,7 +15726,7 @@ function setFunkitConnectVersion({ version }) {
15702
15726
  localStorage.setItem(storageKey4, version);
15703
15727
  }
15704
15728
  function getCurrentSdkVersion() {
15705
- return "1.0.14";
15729
+ return "1.0.15";
15706
15730
  }
15707
15731
  function useFingerprint() {
15708
15732
  const fingerprint = useCallback29(() => {
@@ -8,5 +8,6 @@ export declare function formatTimestamp(date: Date, shortened?: boolean): string
8
8
  * - seconds = 61, output = '1min 1s'
9
9
  * - seconds = 300, output = '5mins'
10
10
  * - seconds = 320, output = '5mins 20s'
11
+ * - seconds = 320, omitSeconds=true, output = '6mins'
11
12
  */
12
- export declare function formatSecondsToReadableForm(seconds: number, specifyUnderMinute?: boolean): string;
13
+ export declare function formatSecondsToReadableForm(seconds: number, specifyUnderMinute?: boolean, omitSeconds?: boolean): string;
@@ -1,10 +1,16 @@
1
1
  "use client";
2
2
  import {
3
- trustWallet
4
- } from "./chunk-Z2DGDHHZ.js";
3
+ zerionWallet
4
+ } from "./chunk-7CQPABJG.js";
5
5
  import {
6
- safeheronWallet
7
- } from "./chunk-63NPZXAL.js";
6
+ zealWallet
7
+ } from "./chunk-DPXMP5KS.js";
8
+ import {
9
+ ramperWallet
10
+ } from "./chunk-ZOL6ZMTJ.js";
11
+ import {
12
+ tahoWallet
13
+ } from "./chunk-H76YCX2M.js";
8
14
  import {
9
15
  talismanWallet
10
16
  } from "./chunk-H273OTQA.js";
@@ -12,32 +18,29 @@ import {
12
18
  tokenPocketWallet
13
19
  } from "./chunk-2UXZAUWT.js";
14
20
  import {
15
- safepalWallet
16
- } from "./chunk-SYELB4QO.js";
17
- import {
18
- uniswapWallet
19
- } from "./chunk-XRSY4JVH.js";
21
+ trustWallet
22
+ } from "./chunk-Z2DGDHHZ.js";
20
23
  import {
21
24
  tokenaryWallet
22
25
  } from "./chunk-ENZLEAG2.js";
23
26
  import {
24
- xdefiWallet
25
- } from "./chunk-L734HTUS.js";
27
+ uniswapWallet
28
+ } from "./chunk-XRSY4JVH.js";
26
29
  import {
27
30
  walletConnectWallet
28
31
  } from "./chunk-ASPRR7T3.js";
29
32
  import {
30
- zealWallet
31
- } from "./chunk-DPXMP5KS.js";
33
+ xdefiWallet
34
+ } from "./chunk-L734HTUS.js";
32
35
  import {
33
- zerionWallet
34
- } from "./chunk-7CQPABJG.js";
36
+ rabbyWallet
37
+ } from "./chunk-XPEBP6XV.js";
35
38
  import {
36
- phantomWallet
37
- } from "./chunk-KGBLSE7L.js";
39
+ rainbowWallet
40
+ } from "./chunk-O5NKWWEG.js";
38
41
  import {
39
- ramperWallet
40
- } from "./chunk-ZOL6ZMTJ.js";
42
+ desigWallet
43
+ } from "./chunk-P4JLZ42R.js";
41
44
  import {
42
45
  roninWallet
43
46
  } from "./chunk-LVRXH33E.js";
@@ -45,62 +48,68 @@ import {
45
48
  safeWallet
46
49
  } from "./chunk-D3DCQ72J.js";
47
50
  import {
48
- rainbowWallet
49
- } from "./chunk-O5NKWWEG.js";
50
- import {
51
- mewWallet
52
- } from "./chunk-PWYTDYBE.js";
51
+ safeheronWallet
52
+ } from "./chunk-63NPZXAL.js";
53
53
  import {
54
- tahoWallet
55
- } from "./chunk-H76YCX2M.js";
54
+ safepalWallet
55
+ } from "./chunk-SYELB4QO.js";
56
56
  import {
57
57
  subWallet
58
58
  } from "./chunk-ZBAQFL6G.js";
59
59
  import {
60
- kresusWallet
61
- } from "./chunk-X6T3CICZ.js";
60
+ metaMaskWallet
61
+ } from "./chunk-3WZRNEZH.js";
62
62
  import {
63
- ledgerWallet
64
- } from "./chunk-Y6VY6E3L.js";
63
+ mewWallet
64
+ } from "./chunk-PWYTDYBE.js";
65
65
  import {
66
66
  oktoWallet
67
67
  } from "./chunk-WKHTUEF5.js";
68
- import {
69
- omniWallet
70
- } from "./chunk-SVN7OEQR.js";
71
68
  import {
72
69
  okxWallet
73
70
  } from "./chunk-NGXIHASN.js";
71
+ import {
72
+ omniWallet
73
+ } from "./chunk-SVN7OEQR.js";
74
74
  import {
75
75
  oneInchWallet
76
76
  } from "./chunk-LCPIZUR3.js";
77
- import {
78
- rabbyWallet
79
- } from "./chunk-XPEBP6XV.js";
80
77
  import {
81
78
  oneKeyWallet
82
79
  } from "./chunk-4WOV4ITL.js";
83
80
  import {
84
- bitverseWallet
85
- } from "./chunk-NL4I7WOT.js";
81
+ phantomWallet
82
+ } from "./chunk-KGBLSE7L.js";
86
83
  import {
87
- bloomWallet
88
- } from "./chunk-NTGZF5BY.js";
84
+ frameWallet
85
+ } from "./chunk-XXFJVY73.js";
89
86
  import {
90
- imTokenWallet
91
- } from "./chunk-5MVV7OVS.js";
87
+ frontierWallet
88
+ } from "./chunk-AM4SSLAP.js";
92
89
  import {
93
90
  gateWallet
94
91
  } from "./chunk-V45EXW7A.js";
95
92
  import {
96
- bybitWallet
97
- } from "./chunk-ZUAHWUEL.js";
93
+ imTokenWallet
94
+ } from "./chunk-5MVV7OVS.js";
98
95
  import {
99
96
  injectedWallet
100
97
  } from "./chunk-KIHCNUU3.js";
101
98
  import {
102
- metaMaskWallet
103
- } from "./chunk-3WZRNEZH.js";
99
+ kresusWallet
100
+ } from "./chunk-X6T3CICZ.js";
101
+ import {
102
+ ledgerWallet
103
+ } from "./chunk-Y6VY6E3L.js";
104
+ import {
105
+ bybitWallet
106
+ } from "./chunk-ZUAHWUEL.js";
107
+ import {
108
+ clvWallet
109
+ } from "./chunk-MIWCKFYE.js";
110
+ import {
111
+ coin98Wallet
112
+ } from "./chunk-4FQLUQNA.js";
104
113
  import {
105
114
  coinbaseWallet
106
115
  } from "./chunk-XBUTWYE4.js";
@@ -110,9 +119,6 @@ import {
110
119
  import {
111
120
  dawnWallet
112
121
  } from "./chunk-4XQDKOGF.js";
113
- import {
114
- desigWallet
115
- } from "./chunk-P4JLZ42R.js";
116
122
  import {
117
123
  enkryptWallet
118
124
  } from "./chunk-FLY7F4XA.js";
@@ -120,14 +126,8 @@ import {
120
126
  foxWallet
121
127
  } from "./chunk-Q4RLUJJD.js";
122
128
  import {
123
- frameWallet
124
- } from "./chunk-XXFJVY73.js";
125
- import {
126
- frontierWallet
127
- } from "./chunk-AM4SSLAP.js";
128
- import {
129
- bitskiWallet
130
- } from "./chunk-C67TQJ6W.js";
129
+ argentWallet
130
+ } from "./chunk-NZ5G23JP.js";
131
131
  import {
132
132
  bifrostWallet
133
133
  } from "./chunk-6LTLPR2Q.js";
@@ -135,19 +135,19 @@ import {
135
135
  bitgetWallet
136
136
  } from "./chunk-ZNXQ4V6G.js";
137
137
  import {
138
- argentWallet
139
- } from "./chunk-NZ5G23JP.js";
138
+ bitskiWallet
139
+ } from "./chunk-C67TQJ6W.js";
140
+ import {
141
+ bitverseWallet
142
+ } from "./chunk-NL4I7WOT.js";
143
+ import {
144
+ bloomWallet
145
+ } from "./chunk-NTGZF5BY.js";
140
146
  import "./chunk-ZOLACFTK.js";
147
+ import "./chunk-ZDU3JFGR.js";
141
148
  import {
142
149
  braveWallet
143
150
  } from "./chunk-ABYQAXUX.js";
144
- import {
145
- clvWallet
146
- } from "./chunk-MIWCKFYE.js";
147
- import {
148
- coin98Wallet
149
- } from "./chunk-4FQLUQNA.js";
150
- import "./chunk-ZDU3JFGR.js";
151
151
  import "./chunk-QII6PY2D.js";
152
152
  export {
153
153
  argentWallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",