@tonconnect/ui 0.0.15 → 0.0.17
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/README.md +36 -0
- package/dist/tonconnect-ui.min.js +7 -7
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.d.ts +15 -2
- package/lib/index.js +39 -18
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +39 -18
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
package/lib/index.umd.js
CHANGED
|
@@ -3080,7 +3080,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3080
3080
|
this.storage = storage;
|
|
3081
3081
|
this.walletConnectionSource = walletConnectionSource;
|
|
3082
3082
|
this.type = "http";
|
|
3083
|
-
this.standardUniversalLink = "
|
|
3083
|
+
this.standardUniversalLink = "tc://";
|
|
3084
3084
|
this.pendingRequests = /* @__PURE__ */ new Map();
|
|
3085
3085
|
this.nextRequestId = 0;
|
|
3086
3086
|
this.session = null;
|
|
@@ -5850,7 +5850,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5850
5850
|
primary: "#0F0F0F",
|
|
5851
5851
|
secondary: "#7A8999",
|
|
5852
5852
|
tertiary: "#C1CAD2",
|
|
5853
|
-
success: "#29CC6A"
|
|
5853
|
+
success: "#29CC6A",
|
|
5854
|
+
error: "#F5A73B"
|
|
5854
5855
|
},
|
|
5855
5856
|
background: {
|
|
5856
5857
|
primary: "#FFFFFF",
|
|
@@ -5875,7 +5876,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5875
5876
|
primary: "#E5E5EA",
|
|
5876
5877
|
secondary: "#909099",
|
|
5877
5878
|
tertiary: "#434347",
|
|
5878
|
-
success: "#29CC6A"
|
|
5879
|
+
success: "#29CC6A",
|
|
5880
|
+
error: "#F5A73B"
|
|
5879
5881
|
},
|
|
5880
5882
|
background: {
|
|
5881
5883
|
primary: "#121214",
|
|
@@ -6974,7 +6976,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
6974
6976
|
const _tmpl$$a = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M7.86358 9.13637C7.51211 8.7849 7.51211 8.21505 7.86358 7.86358C8.21505 7.51211 8.7849 7.51211 9.13637 7.86358L12 10.7272L14.8636 7.86358C15.2151 7.51211 15.7849 7.51211 16.1364 7.86358C16.4878 8.21505 16.4878 8.7849 16.1364 9.13637L13.2728 12L16.1364 14.8636C16.4878 15.2151 16.4878 15.7849 16.1364 16.1364C15.7849 16.4878 15.2151 16.4878 14.8636 16.1364L12 13.2728L9.13637 16.1364C8.7849 16.4878 8.21505 16.4878 7.86358 16.1364C7.51211 15.7849 7.51211 15.2151 7.86358 14.8636L10.7272 12L7.86358 9.13637Z"></path></svg>`);
|
|
6975
6977
|
const ErrorIcon = (props) => {
|
|
6976
6978
|
const theme = useTheme();
|
|
6977
|
-
const fill = () => props.fill || theme.colors.icon.
|
|
6979
|
+
const fill = () => props.fill || theme.colors.icon.error;
|
|
6978
6980
|
return (() => {
|
|
6979
6981
|
const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
6980
6982
|
createRenderEffect((_p$) => {
|
|
@@ -7139,6 +7141,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7139
7141
|
setTimeout(() => setIsCopiedShown(false), 1e3);
|
|
7140
7142
|
});
|
|
7141
7143
|
const onDisconnect = () => {
|
|
7144
|
+
setAction(null);
|
|
7142
7145
|
connector.disconnect();
|
|
7143
7146
|
props.onClose();
|
|
7144
7147
|
};
|
|
@@ -7329,9 +7332,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7329
7332
|
`;
|
|
7330
7333
|
const _tmpl$$4 = /* @__PURE__ */ template$1(`<div></div>`);
|
|
7331
7334
|
const Notifications = (props) => {
|
|
7335
|
+
const timeouts = [];
|
|
7336
|
+
const [openedNotifications, setOpenedNotifications] = createSignal([]);
|
|
7332
7337
|
let lastId = -1;
|
|
7333
7338
|
const liveTimeoutMs = 4500;
|
|
7334
|
-
const [openedNotifications, setOpenedNotifications] = createSignal([]);
|
|
7335
7339
|
createEffect(on(action, (action2) => {
|
|
7336
7340
|
if (action2 && action2.showNotification) {
|
|
7337
7341
|
lastId++;
|
|
@@ -7340,9 +7344,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7340
7344
|
id,
|
|
7341
7345
|
action: action2.name
|
|
7342
7346
|
}));
|
|
7343
|
-
setTimeout(() => setOpenedNotifications((notifications2) => notifications2.filter((notification) => notification.id !== id)), liveTimeoutMs);
|
|
7347
|
+
timeouts.push(setTimeout(() => setOpenedNotifications((notifications2) => notifications2.filter((notification) => notification.id !== id)), liveTimeoutMs));
|
|
7344
7348
|
}
|
|
7345
7349
|
}));
|
|
7350
|
+
onCleanup(() => {
|
|
7351
|
+
timeouts.forEach(clearTimeout);
|
|
7352
|
+
});
|
|
7346
7353
|
return (() => {
|
|
7347
7354
|
const _el$ = _tmpl$$4.cloneNode(true);
|
|
7348
7355
|
insert(_el$, createComponent(TransitionGroup, {
|
|
@@ -10195,6 +10202,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
10195
10202
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", handler);
|
|
10196
10203
|
return () => window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", handler);
|
|
10197
10204
|
}
|
|
10205
|
+
function addQueryParameter(url, key, value) {
|
|
10206
|
+
const parsed = new URL(url);
|
|
10207
|
+
parsed.searchParams.append(key, value);
|
|
10208
|
+
return parsed.toString();
|
|
10209
|
+
}
|
|
10210
|
+
function addReturnStrategy(url, returnStrategy) {
|
|
10211
|
+
return addQueryParameter(url, "ret", returnStrategy);
|
|
10212
|
+
}
|
|
10213
|
+
const [appState, setAppState] = createStore({
|
|
10214
|
+
buttonRootId: null,
|
|
10215
|
+
language: "en",
|
|
10216
|
+
returnStrategy: "back",
|
|
10217
|
+
walletsList: {}
|
|
10218
|
+
});
|
|
10198
10219
|
const QrCodeModal = (props) => {
|
|
10199
10220
|
const connector = useContext(ConnectorContext);
|
|
10200
10221
|
const universalLink = connector.connect({
|
|
@@ -10245,7 +10266,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
10245
10266
|
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
10246
10267
|
openMethod: "universal-link"
|
|
10247
10268
|
}));
|
|
10248
|
-
openLink(universalLink);
|
|
10269
|
+
openLink(addReturnStrategy(universalLink, appState.returnStrategy));
|
|
10249
10270
|
},
|
|
10250
10271
|
get children() {
|
|
10251
10272
|
return createComponent(Translation, {
|
|
@@ -10485,11 +10506,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
10485
10506
|
align-items: center;
|
|
10486
10507
|
}
|
|
10487
10508
|
`;
|
|
10488
|
-
const [appState, setAppState] = createStore({
|
|
10489
|
-
buttonRootId: null,
|
|
10490
|
-
language: "en",
|
|
10491
|
-
walletsList: {}
|
|
10492
|
-
});
|
|
10493
10509
|
function uiWalletToWalletInfo(uiWallet) {
|
|
10494
10510
|
if ("jsBridgeKey" in uiWallet) {
|
|
10495
10511
|
return __spreadProps(__spreadValues({}, uiWallet), {
|
|
@@ -10593,14 +10609,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
10593
10609
|
setSelectedWalletInfo(walletInfo);
|
|
10594
10610
|
return;
|
|
10595
10611
|
}
|
|
10596
|
-
|
|
10612
|
+
openLinkBlank(walletInfo.aboutUrl);
|
|
10597
10613
|
};
|
|
10598
10614
|
const onSelectIfMobile = (walletInfo) => {
|
|
10599
10615
|
const universalLink = connector.connect({
|
|
10600
10616
|
universalLink: walletInfo.universalLink,
|
|
10601
10617
|
bridgeUrl: walletInfo.bridgeUrl
|
|
10602
10618
|
}, additionalRequest());
|
|
10603
|
-
openLink(universalLink);
|
|
10619
|
+
openLink(addReturnStrategy(universalLink, appState.returnStrategy));
|
|
10604
10620
|
};
|
|
10605
10621
|
const onSelectIfInjected = (walletInfo) => {
|
|
10606
10622
|
connector.connect({
|
|
@@ -10990,8 +11006,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
10990
11006
|
setBorderRadius(options.uiPreferences.borderRadius);
|
|
10991
11007
|
}
|
|
10992
11008
|
setAppState((state) => {
|
|
11009
|
+
var _a3;
|
|
10993
11010
|
const merged = mergeOptions(
|
|
10994
|
-
__spreadValues(__spreadValues({}, options.language && { language: options.language }), !!options.
|
|
11011
|
+
__spreadValues(__spreadValues(__spreadValues({}, options.language && { language: options.language }), !!((_a3 = options.actionsConfiguration) == null ? void 0 : _a3.returnStrategy) && {
|
|
11012
|
+
returnStrategy: options.actionsConfiguration.returnStrategy
|
|
11013
|
+
}), !!options.walletsList && { walletsList: options.walletsList }),
|
|
10995
11014
|
unwrap(state)
|
|
10996
11015
|
);
|
|
10997
11016
|
if (options.buttonRootId !== void 0) {
|
|
@@ -11043,6 +11062,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11043
11062
|
});
|
|
11044
11063
|
}
|
|
11045
11064
|
disconnect() {
|
|
11065
|
+
widgetController.clearAction();
|
|
11046
11066
|
this.walletInfoStorage.removeWalletInfo();
|
|
11047
11067
|
return this.connector.disconnect();
|
|
11048
11068
|
}
|
|
@@ -11051,10 +11071,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11051
11071
|
if (!this.connected || !this.walletInfo) {
|
|
11052
11072
|
throw new TonConnectUIError("Connect wallet to send a transaction.");
|
|
11053
11073
|
}
|
|
11074
|
+
const { notifications: notifications2, modals, returnStrategy } = this.getModalsAndNotificationsConfiguration(options);
|
|
11054
11075
|
if ("universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link") {
|
|
11055
|
-
openLink(this.walletInfo.universalLink);
|
|
11076
|
+
openLink(addReturnStrategy(this.walletInfo.universalLink, returnStrategy));
|
|
11056
11077
|
}
|
|
11057
|
-
const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
|
|
11058
11078
|
widgetController.setAction({
|
|
11059
11079
|
name: "confirm-transaction",
|
|
11060
11080
|
showNotification: notifications2.includes("before"),
|
|
@@ -11153,7 +11173,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11153
11173
|
}
|
|
11154
11174
|
return {
|
|
11155
11175
|
notifications: notifications2,
|
|
11156
|
-
modals
|
|
11176
|
+
modals,
|
|
11177
|
+
returnStrategy: (options == null ? void 0 : options.returnStrategy) || "back"
|
|
11157
11178
|
};
|
|
11158
11179
|
}
|
|
11159
11180
|
}
|