@web3auth/modal 8.2.0 → 8.2.2

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/modal.cjs.js CHANGED
@@ -173,7 +173,7 @@ class Web3Auth extends no_modal_namespaceObject.Web3AuthNoModal {
173
173
  super.checkInitRequirements();
174
174
  let projectConfig;
175
175
  try {
176
- projectConfig = await (0,base_.fetchProjectConfig)(this.options.clientId);
176
+ projectConfig = await (0,base_.fetchProjectConfig)(this.options.clientId, this.options.web3AuthNetwork);
177
177
  } catch (e) {
178
178
  throw base_.WalletInitializationError.notReady("failed to fetch project configurations");
179
179
  }
@@ -188,7 +188,8 @@ class Web3Auth extends no_modal_namespaceObject.Web3AuthNoModal {
188
188
  }));
189
189
  this.subscribeToLoginModalEvents();
190
190
  const {
191
- sms_otp_enabled: smsOtpEnabled
191
+ sms_otp_enabled: smsOtpEnabled,
192
+ whitelist
192
193
  } = projectConfig;
193
194
  if (smsOtpEnabled !== undefined) {
194
195
  var _params;
@@ -268,6 +269,9 @@ class Web3Auth extends no_modal_namespaceObject.Web3AuthNoModal {
268
269
  }
269
270
  };
270
271
  }
272
+ if (whitelist) {
273
+ finalOpenloginAdapterSettings.originData = whitelist.signed_urls;
274
+ }
271
275
  if (this.options.uiConfig.uxMode) {
272
276
  finalOpenloginAdapterSettings.uxMode = this.options.uiConfig.uxMode;
273
277
  }
@@ -328,6 +332,11 @@ class Web3Auth extends no_modal_namespaceObject.Web3AuthNoModal {
328
332
  }
329
333
  });
330
334
  }
335
+ if (whitelist) {
336
+ openloginAdapter.setAdapterSettings({
337
+ originData: whitelist.signed_urls
338
+ });
339
+ }
331
340
  if ((_this$options$uiConfi = this.options.uiConfig) !== null && _this$options$uiConfi !== void 0 && _this$options$uiConfi.uxMode) {
332
341
  openloginAdapter.setAdapterSettings({
333
342
  uxMode: this.options.uiConfig.uxMode
@@ -355,14 +364,17 @@ class Web3Auth extends no_modal_namespaceObject.Web3AuthNoModal {
355
364
  });
356
365
  this.modalConfig.adapters[base_.WALLET_ADAPTERS.WALLET_CONNECT_V2].showOnModal = false;
357
366
  } else {
358
- if (!walletConnectProjectId) throw base_.WalletInitializationError.invalidParams("Invalid wallet connect project id. Please configure it on the dashboard");
359
- walletConnectAdapter.setAdapterSettings({
360
- adapterSettings: {
361
- walletConnectInitOptions: {
362
- projectId: walletConnectProjectId
367
+ var _walletConnectAdapter;
368
+ if (!(walletConnectAdapter !== null && walletConnectAdapter !== void 0 && (_walletConnectAdapter = walletConnectAdapter.adapterOptions) !== null && _walletConnectAdapter !== void 0 && (_walletConnectAdapter = _walletConnectAdapter.adapterSettings) !== null && _walletConnectAdapter !== void 0 && (_walletConnectAdapter = _walletConnectAdapter.walletConnectInitOptions) !== null && _walletConnectAdapter !== void 0 && _walletConnectAdapter.projectId) && !walletConnectProjectId) throw base_.WalletInitializationError.invalidParams("Invalid wallet connect project id. Please configure it on the dashboard");
369
+ if (walletConnectProjectId) {
370
+ walletConnectAdapter.setAdapterSettings({
371
+ adapterSettings: {
372
+ walletConnectInitOptions: {
373
+ projectId: walletConnectProjectId
374
+ }
363
375
  }
364
- }
365
- });
376
+ });
377
+ }
366
378
  }
367
379
  }
368
380
  return adapterName;
package/dist/modal.esm.js CHANGED
@@ -112,7 +112,7 @@ class Web3Auth extends Web3AuthNoModal {
112
112
  super.checkInitRequirements();
113
113
  let projectConfig;
114
114
  try {
115
- projectConfig = await fetchProjectConfig(this.options.clientId);
115
+ projectConfig = await fetchProjectConfig(this.options.clientId, this.options.web3AuthNetwork);
116
116
  } catch (e) {
117
117
  throw WalletInitializationError.notReady("failed to fetch project configurations");
118
118
  }
@@ -127,7 +127,8 @@ class Web3Auth extends Web3AuthNoModal {
127
127
  }));
128
128
  this.subscribeToLoginModalEvents();
129
129
  const {
130
- sms_otp_enabled: smsOtpEnabled
130
+ sms_otp_enabled: smsOtpEnabled,
131
+ whitelist
131
132
  } = projectConfig;
132
133
  if (smsOtpEnabled !== undefined) {
133
134
  var _params;
@@ -207,6 +208,9 @@ class Web3Auth extends Web3AuthNoModal {
207
208
  }
208
209
  };
209
210
  }
211
+ if (whitelist) {
212
+ finalOpenloginAdapterSettings.originData = whitelist.signed_urls;
213
+ }
210
214
  if (this.options.uiConfig.uxMode) {
211
215
  finalOpenloginAdapterSettings.uxMode = this.options.uiConfig.uxMode;
212
216
  }
@@ -267,6 +271,11 @@ class Web3Auth extends Web3AuthNoModal {
267
271
  }
268
272
  });
269
273
  }
274
+ if (whitelist) {
275
+ openloginAdapter.setAdapterSettings({
276
+ originData: whitelist.signed_urls
277
+ });
278
+ }
270
279
  if ((_this$options$uiConfi = this.options.uiConfig) !== null && _this$options$uiConfi !== void 0 && _this$options$uiConfi.uxMode) {
271
280
  openloginAdapter.setAdapterSettings({
272
281
  uxMode: this.options.uiConfig.uxMode
@@ -294,14 +303,17 @@ class Web3Auth extends Web3AuthNoModal {
294
303
  });
295
304
  this.modalConfig.adapters[WALLET_ADAPTERS.WALLET_CONNECT_V2].showOnModal = false;
296
305
  } else {
297
- if (!walletConnectProjectId) throw WalletInitializationError.invalidParams("Invalid wallet connect project id. Please configure it on the dashboard");
298
- walletConnectAdapter.setAdapterSettings({
299
- adapterSettings: {
300
- walletConnectInitOptions: {
301
- projectId: walletConnectProjectId
306
+ var _walletConnectAdapter;
307
+ if (!(walletConnectAdapter !== null && walletConnectAdapter !== void 0 && (_walletConnectAdapter = walletConnectAdapter.adapterOptions) !== null && _walletConnectAdapter !== void 0 && (_walletConnectAdapter = _walletConnectAdapter.adapterSettings) !== null && _walletConnectAdapter !== void 0 && (_walletConnectAdapter = _walletConnectAdapter.walletConnectInitOptions) !== null && _walletConnectAdapter !== void 0 && _walletConnectAdapter.projectId) && !walletConnectProjectId) throw WalletInitializationError.invalidParams("Invalid wallet connect project id. Please configure it on the dashboard");
308
+ if (walletConnectProjectId) {
309
+ walletConnectAdapter.setAdapterSettings({
310
+ adapterSettings: {
311
+ walletConnectInitOptions: {
312
+ projectId: walletConnectProjectId
313
+ }
302
314
  }
303
- }
304
- });
315
+ });
316
+ }
305
317
  }
306
318
  }
307
319
  return adapterName;