@eluvio/elv-client-js 3.2.26 → 3.2.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.26",
3
+ "version": "3.2.28",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -1101,9 +1101,10 @@ exports.ListingAttributes = async function({marketplaceParams, displayName}={})
1101
1101
  * @methodGroup Purchase
1102
1102
  * @namedParams
1103
1103
  * @param {Object} marketplaceParams - Parameters of the marketplace
1104
- * @param {string} sku - The SKU of the item to claime
1104
+ * @param {string} sku - The SKU of the item to claim
1105
+ * @param {string=} email - Email address of the user. If specified, this will bind the user to the tenant of the specified marketplace
1105
1106
  */
1106
- exports.ClaimItem = async function({marketplaceParams, sku}) {
1107
+ exports.ClaimItem = async function({marketplaceParams, sku, email}) {
1107
1108
  const marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
1108
1109
 
1109
1110
  await this.client.authClient.MakeAuthServiceRequest({
@@ -1112,7 +1113,8 @@ exports.ClaimItem = async function({marketplaceParams, sku}) {
1112
1113
  body: {
1113
1114
  op: "nft-claim",
1114
1115
  sid: marketplaceInfo.marketplaceId,
1115
- sku
1116
+ sku,
1117
+ email
1116
1118
  },
1117
1119
  headers: {
1118
1120
  Authorization: `Bearer ${this.AuthToken()}`
@@ -9,6 +9,13 @@ const Ethers = require("ethers");
9
9
  const inBrowser = typeof window !== "undefined";
10
10
  const embedded = inBrowser && window.top !== window.self;
11
11
 
12
+ let localStorageAvailable = false;
13
+ try {
14
+ typeof localStorage !== "undefined" && localStorage.getItem("test");
15
+ localStorageAvailable = true;
16
+ // eslint-disable-next-line no-empty
17
+ } catch(error) {}
18
+
12
19
  /**
13
20
  * Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
14
21
  *
@@ -129,7 +136,7 @@ class ElvWalletClient {
129
136
  url.searchParams.delete("elvToken");
130
137
 
131
138
  window.history.replaceState("", "", url);
132
- } else if(storeAuthToken && typeof localStorage !== "undefined") {
139
+ } else if(storeAuthToken && localStorageAvailable) {
133
140
  try {
134
141
  // Load saved auth token
135
142
  let savedToken = localStorage.getItem(`__elv-token-${network}`);
@@ -342,7 +349,7 @@ class ElvWalletClient {
342
349
  this.cachedMarketplaces = {};
343
350
 
344
351
  // Delete saved auth token
345
- if(typeof localStorage !== "undefined") {
352
+ if(localStorageAvailable) {
346
353
  try {
347
354
  localStorage.removeItem(`__elv-token-${this.network}`);
348
355
  // eslint-disable-next-line no-empty
@@ -532,7 +539,7 @@ class ElvWalletClient {
532
539
 
533
540
  const token = this.ClientAuthToken();
534
541
 
535
- if(this.storeAuthToken && typeof localStorage !== "undefined") {
542
+ if(this.storeAuthToken && localStorageAvailable) {
536
543
  try {
537
544
  localStorage.setItem(`__elv-token-${this.network}`, token);
538
545
  // eslint-disable-next-line no-empty