@lydianpay/lydianconnect 1.3.0 → 1.4.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.
package/dist/index.js CHANGED
@@ -298,6 +298,10 @@ var BaseConnector = class {
298
298
  function deriveUrl() {
299
299
  return typeof window !== "undefined" ? window.location.origin : "";
300
300
  }
301
+ function deriveRedirectUrl() {
302
+ if (typeof window === "undefined") return "";
303
+ return window.location.origin + window.location.pathname;
304
+ }
301
305
 
302
306
  // src/connectors/eip155/chain.ts
303
307
  var CHAIN_SETTLE = { timeoutMs: 4e3, intervalMs: 100 };
@@ -1258,13 +1262,16 @@ var WalletConnectConnector = class extends BaseConnector {
1258
1262
  }
1259
1263
  async getClient() {
1260
1264
  if (this.client) return this.client;
1265
+ const redirectUrl = deriveRedirectUrl();
1261
1266
  const client = await SignClient.init({
1262
1267
  projectId: this.options.projectId,
1263
1268
  metadata: {
1264
1269
  name: this.app.appName,
1265
1270
  description: this.app.description ?? this.app.appName,
1266
1271
  url: deriveUrl(),
1267
- icons: this.app.icon ? [this.app.icon] : []
1272
+ icons: this.app.icon ? [this.app.icon] : [],
1273
+ // Wallets may use this to return the user after deep-link approvals.
1274
+ ...redirectUrl ? { redirect: { universal: redirectUrl } } : {}
1268
1275
  },
1269
1276
  relayUrl: this.options.relayUrl
1270
1277
  });