@tonconnect/ui-react 0.0.12 → 0.0.14
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/lib/components/TonConnectUIProvider.d.ts +1 -1
- 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 +2 -2
package/lib/index.umd.js
CHANGED
|
@@ -4056,7 +4056,7 @@ var __objRest = (source, exclude) => {
|
|
|
4056
4056
|
this.storage = storage;
|
|
4057
4057
|
this.walletConnectionSource = walletConnectionSource;
|
|
4058
4058
|
this.type = "http";
|
|
4059
|
-
this.standardUniversalLink = "
|
|
4059
|
+
this.standardUniversalLink = "tc://";
|
|
4060
4060
|
this.pendingRequests = /* @__PURE__ */ new Map();
|
|
4061
4061
|
this.nextRequestId = 0;
|
|
4062
4062
|
this.session = null;
|
|
@@ -6825,7 +6825,8 @@ var __objRest = (source, exclude) => {
|
|
|
6825
6825
|
primary: "#0F0F0F",
|
|
6826
6826
|
secondary: "#7A8999",
|
|
6827
6827
|
tertiary: "#C1CAD2",
|
|
6828
|
-
success: "#29CC6A"
|
|
6828
|
+
success: "#29CC6A",
|
|
6829
|
+
error: "#F5A73B"
|
|
6829
6830
|
},
|
|
6830
6831
|
background: {
|
|
6831
6832
|
primary: "#FFFFFF",
|
|
@@ -6850,7 +6851,8 @@ var __objRest = (source, exclude) => {
|
|
|
6850
6851
|
primary: "#E5E5EA",
|
|
6851
6852
|
secondary: "#909099",
|
|
6852
6853
|
tertiary: "#434347",
|
|
6853
|
-
success: "#29CC6A"
|
|
6854
|
+
success: "#29CC6A",
|
|
6855
|
+
error: "#F5A73B"
|
|
6854
6856
|
},
|
|
6855
6857
|
background: {
|
|
6856
6858
|
primary: "#121214",
|
|
@@ -7949,7 +7951,7 @@ var __objRest = (source, exclude) => {
|
|
|
7949
7951
|
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>`);
|
|
7950
7952
|
const ErrorIcon = (props) => {
|
|
7951
7953
|
const theme = useTheme();
|
|
7952
|
-
const fill = () => props.fill || theme.colors.icon.
|
|
7954
|
+
const fill = () => props.fill || theme.colors.icon.error;
|
|
7953
7955
|
return (() => {
|
|
7954
7956
|
const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
7955
7957
|
createRenderEffect((_p$) => {
|
|
@@ -8114,6 +8116,7 @@ var __objRest = (source, exclude) => {
|
|
|
8114
8116
|
setTimeout(() => setIsCopiedShown(false), 1e3);
|
|
8115
8117
|
});
|
|
8116
8118
|
const onDisconnect = () => {
|
|
8119
|
+
setAction(null);
|
|
8117
8120
|
connector.disconnect();
|
|
8118
8121
|
props.onClose();
|
|
8119
8122
|
};
|
|
@@ -8304,9 +8307,10 @@ var __objRest = (source, exclude) => {
|
|
|
8304
8307
|
`;
|
|
8305
8308
|
const _tmpl$$4 = /* @__PURE__ */ template$1(`<div></div>`);
|
|
8306
8309
|
const Notifications = (props) => {
|
|
8310
|
+
const timeouts = [];
|
|
8311
|
+
const [openedNotifications, setOpenedNotifications] = createSignal([]);
|
|
8307
8312
|
let lastId = -1;
|
|
8308
8313
|
const liveTimeoutMs = 4500;
|
|
8309
|
-
const [openedNotifications, setOpenedNotifications] = createSignal([]);
|
|
8310
8314
|
createEffect(on(action, (action2) => {
|
|
8311
8315
|
if (action2 && action2.showNotification) {
|
|
8312
8316
|
lastId++;
|
|
@@ -8315,9 +8319,12 @@ var __objRest = (source, exclude) => {
|
|
|
8315
8319
|
id,
|
|
8316
8320
|
action: action2.name
|
|
8317
8321
|
}));
|
|
8318
|
-
setTimeout(() => setOpenedNotifications((notifications2) => notifications2.filter((notification) => notification.id !== id)), liveTimeoutMs);
|
|
8322
|
+
timeouts.push(setTimeout(() => setOpenedNotifications((notifications2) => notifications2.filter((notification) => notification.id !== id)), liveTimeoutMs));
|
|
8319
8323
|
}
|
|
8320
8324
|
}));
|
|
8325
|
+
onCleanup(() => {
|
|
8326
|
+
timeouts.forEach(clearTimeout);
|
|
8327
|
+
});
|
|
8321
8328
|
return (() => {
|
|
8322
8329
|
const _el$ = _tmpl$$4.cloneNode(true);
|
|
8323
8330
|
insert(_el$, createComponent(TransitionGroup, {
|
|
@@ -11170,6 +11177,20 @@ var __objRest = (source, exclude) => {
|
|
|
11170
11177
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", handler);
|
|
11171
11178
|
return () => window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", handler);
|
|
11172
11179
|
}
|
|
11180
|
+
function addQueryParameter(url, key, value) {
|
|
11181
|
+
const parsed = new URL(url);
|
|
11182
|
+
parsed.searchParams.append(key, value);
|
|
11183
|
+
return parsed.toString();
|
|
11184
|
+
}
|
|
11185
|
+
function addReturnStrategy(url, returnStrategy) {
|
|
11186
|
+
return addQueryParameter(url, "ret", returnStrategy);
|
|
11187
|
+
}
|
|
11188
|
+
const [appState, setAppState] = createStore({
|
|
11189
|
+
buttonRootId: null,
|
|
11190
|
+
language: "en",
|
|
11191
|
+
returnStrategy: "back",
|
|
11192
|
+
walletsList: {}
|
|
11193
|
+
});
|
|
11173
11194
|
const QrCodeModal = (props) => {
|
|
11174
11195
|
const connector = useContext(ConnectorContext);
|
|
11175
11196
|
const universalLink = connector.connect({
|
|
@@ -11220,7 +11241,7 @@ var __objRest = (source, exclude) => {
|
|
|
11220
11241
|
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
11221
11242
|
openMethod: "universal-link"
|
|
11222
11243
|
}));
|
|
11223
|
-
openLink(universalLink);
|
|
11244
|
+
openLink(addReturnStrategy(universalLink, appState.returnStrategy));
|
|
11224
11245
|
},
|
|
11225
11246
|
get children() {
|
|
11226
11247
|
return createComponent(Translation, {
|
|
@@ -11460,11 +11481,6 @@ var __objRest = (source, exclude) => {
|
|
|
11460
11481
|
align-items: center;
|
|
11461
11482
|
}
|
|
11462
11483
|
`;
|
|
11463
|
-
const [appState, setAppState] = createStore({
|
|
11464
|
-
buttonRootId: null,
|
|
11465
|
-
language: "en",
|
|
11466
|
-
walletsList: {}
|
|
11467
|
-
});
|
|
11468
11484
|
function uiWalletToWalletInfo(uiWallet) {
|
|
11469
11485
|
if ("jsBridgeKey" in uiWallet) {
|
|
11470
11486
|
return __spreadProps(__spreadValues({}, uiWallet), {
|
|
@@ -11568,14 +11584,14 @@ var __objRest = (source, exclude) => {
|
|
|
11568
11584
|
setSelectedWalletInfo(walletInfo);
|
|
11569
11585
|
return;
|
|
11570
11586
|
}
|
|
11571
|
-
|
|
11587
|
+
openLinkBlank(walletInfo.aboutUrl);
|
|
11572
11588
|
};
|
|
11573
11589
|
const onSelectIfMobile = (walletInfo) => {
|
|
11574
11590
|
const universalLink = connector.connect({
|
|
11575
11591
|
universalLink: walletInfo.universalLink,
|
|
11576
11592
|
bridgeUrl: walletInfo.bridgeUrl
|
|
11577
11593
|
}, additionalRequest());
|
|
11578
|
-
openLink(universalLink);
|
|
11594
|
+
openLink(addReturnStrategy(universalLink, appState.returnStrategy));
|
|
11579
11595
|
};
|
|
11580
11596
|
const onSelectIfInjected = (walletInfo) => {
|
|
11581
11597
|
connector.connect({
|
|
@@ -11965,8 +11981,11 @@ var __objRest = (source, exclude) => {
|
|
|
11965
11981
|
setBorderRadius(options.uiPreferences.borderRadius);
|
|
11966
11982
|
}
|
|
11967
11983
|
setAppState((state) => {
|
|
11984
|
+
var _a2;
|
|
11968
11985
|
const merged = mergeOptions(
|
|
11969
|
-
__spreadValues(__spreadValues({}, options.language && { language: options.language }), !!options.
|
|
11986
|
+
__spreadValues(__spreadValues(__spreadValues({}, options.language && { language: options.language }), !!((_a2 = options.actionsConfiguration) == null ? void 0 : _a2.returnStrategy) && {
|
|
11987
|
+
returnStrategy: options.actionsConfiguration.returnStrategy
|
|
11988
|
+
}), !!options.walletsList && { walletsList: options.walletsList }),
|
|
11970
11989
|
unwrap(state)
|
|
11971
11990
|
);
|
|
11972
11991
|
if (options.buttonRootId !== void 0) {
|
|
@@ -12018,6 +12037,7 @@ var __objRest = (source, exclude) => {
|
|
|
12018
12037
|
});
|
|
12019
12038
|
}
|
|
12020
12039
|
disconnect() {
|
|
12040
|
+
widgetController.clearAction();
|
|
12021
12041
|
this.walletInfoStorage.removeWalletInfo();
|
|
12022
12042
|
return this.connector.disconnect();
|
|
12023
12043
|
}
|
|
@@ -12026,10 +12046,10 @@ var __objRest = (source, exclude) => {
|
|
|
12026
12046
|
if (!this.connected || !this.walletInfo) {
|
|
12027
12047
|
throw new TonConnectUIError("Connect wallet to send a transaction.");
|
|
12028
12048
|
}
|
|
12049
|
+
const { notifications: notifications2, modals, returnStrategy } = this.getModalsAndNotificationsConfiguration(options);
|
|
12029
12050
|
if ("universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link") {
|
|
12030
|
-
openLink(this.walletInfo.universalLink);
|
|
12051
|
+
openLink(addReturnStrategy(this.walletInfo.universalLink, returnStrategy));
|
|
12031
12052
|
}
|
|
12032
|
-
const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
|
|
12033
12053
|
widgetController.setAction({
|
|
12034
12054
|
name: "confirm-transaction",
|
|
12035
12055
|
showNotification: notifications2.includes("before"),
|
|
@@ -12128,7 +12148,8 @@ var __objRest = (source, exclude) => {
|
|
|
12128
12148
|
}
|
|
12129
12149
|
return {
|
|
12130
12150
|
notifications: notifications2,
|
|
12131
|
-
modals
|
|
12151
|
+
modals,
|
|
12152
|
+
returnStrategy: (options == null ? void 0 : options.returnStrategy) || "back"
|
|
12132
12153
|
};
|
|
12133
12154
|
}
|
|
12134
12155
|
}
|