@eluvio/elv-client-js 3.2.27 → 3.2.29

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.
@@ -24,6 +24,9 @@ var Utils = require("./Utils");
24
24
 
25
25
  var permissionLevels = require("./client/ContentAccess").permissionLevels;
26
26
 
27
+ var _require = require("./LogMessage"),
28
+ LogMessage = _require.LogMessage;
29
+
27
30
  var FrameClient = /*#__PURE__*/function () {
28
31
  "use strict";
29
32
 
@@ -202,6 +205,12 @@ var FrameClient = /*#__PURE__*/function () {
202
205
 
203
206
 
204
207
  _createClass(FrameClient, [{
208
+ key: "Log",
209
+ value: function Log(message) {
210
+ var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
211
+ LogMessage(this, message, error);
212
+ }
213
+ }, {
205
214
  key: "PassRequest",
206
215
  value: function () {
207
216
  var _PassRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
@@ -476,7 +485,10 @@ var FrameClient = /*#__PURE__*/function () {
476
485
  * @returns {Array<string>} - List of ElvClient methods available to a FrameClient
477
486
  */
478
487
  function AllowedMethods() {
479
- return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFiles", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
488
+ return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData",
489
+ /*"UploadFiles",*/
490
+ //Override
491
+ "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
480
492
  }
481
493
  }, {
482
494
  key: "AllowedUserProfileMethods",
@@ -503,4 +515,8 @@ var FrameClient = /*#__PURE__*/function () {
503
515
  return FrameClient;
504
516
  }();
505
517
 
518
+ var _require2 = require("./client/Files"),
519
+ UploadFiles = _require2.UploadFiles;
520
+
521
+ FrameClient.prototype.UploadFiles = UploadFiles;
506
522
  exports.FrameClient = FrameClient;
@@ -2037,17 +2037,18 @@ exports.ListingAttributes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regene
2037
2037
  * @methodGroup Purchase
2038
2038
  * @namedParams
2039
2039
  * @param {Object} marketplaceParams - Parameters of the marketplace
2040
- * @param {string} sku - The SKU of the item to claime
2040
+ * @param {string} sku - The SKU of the item to claim
2041
+ * @param {string=} email - Email address of the user. If specified, this will bind the user to the tenant of the specified marketplace
2041
2042
  */
2042
2043
 
2043
2044
  exports.ClaimItem = /*#__PURE__*/function () {
2044
2045
  var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(_ref62) {
2045
- var marketplaceParams, sku, marketplaceInfo;
2046
+ var marketplaceParams, sku, email, marketplaceInfo;
2046
2047
  return _regeneratorRuntime.wrap(function _callee32$(_context32) {
2047
2048
  while (1) {
2048
2049
  switch (_context32.prev = _context32.next) {
2049
2050
  case 0:
2050
- marketplaceParams = _ref62.marketplaceParams, sku = _ref62.sku;
2051
+ marketplaceParams = _ref62.marketplaceParams, sku = _ref62.sku, email = _ref62.email;
2051
2052
  _context32.next = 3;
2052
2053
  return this.MarketplaceInfo({
2053
2054
  marketplaceParams: marketplaceParams
@@ -2062,7 +2063,8 @@ exports.ClaimItem = /*#__PURE__*/function () {
2062
2063
  body: {
2063
2064
  op: "nft-claim",
2064
2065
  sid: marketplaceInfo.marketplaceId,
2065
- sku: sku
2066
+ sku: sku,
2067
+ email: email
2066
2068
  },
2067
2069
  headers: {
2068
2070
  Authorization: "Bearer ".concat(this.AuthToken())
@@ -36,6 +36,12 @@ var Ethers = require("ethers");
36
36
 
37
37
  var inBrowser = typeof window !== "undefined";
38
38
  var embedded = inBrowser && window.top !== window.self;
39
+ var localStorageAvailable = false;
40
+
41
+ try {
42
+ typeof localStorage !== "undefined" && localStorage.getItem("test");
43
+ localStorageAvailable = true; // eslint-disable-next-line no-empty
44
+ } catch (error) {}
39
45
  /**
40
46
  * Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
41
47
  *
@@ -43,6 +49,7 @@ var embedded = inBrowser && window.top !== window.self;
43
49
  * See the Modules section on the sidebar for all client methods unrelated to login and authorization
44
50
  */
45
51
 
52
+
46
53
  var ElvWalletClient = /*#__PURE__*/function () {
47
54
  "use strict";
48
55
 
@@ -115,6 +122,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
115
122
  * @param {string} mode=production - Environment to use (`production`, `staging`)
116
123
  * @param {Object=} marketplaceParams - Marketplace parameters
117
124
  * @param {boolean=} storeAuthToken=true - If specified, auth tokens will be stored in localstorage (if available)
125
+ * @param {Object=} client - Existing instance of ElvClient to use instead of initializing a new one
118
126
  *
119
127
  * @returns {Promise<ElvWalletClient>}
120
128
  */
@@ -532,7 +540,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
532
540
  this.loggedIn = false;
533
541
  this.cachedMarketplaces = {}; // Delete saved auth token
534
542
 
535
- if (typeof localStorage !== "undefined") {
543
+ if (localStorageAvailable) {
536
544
  try {
537
545
  localStorage.removeItem("__elv-token-".concat(this.network)); // eslint-disable-next-line no-empty
538
546
  } catch (error) {}
@@ -891,7 +899,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
891
899
  this.cachedMarketplaces = {};
892
900
  var token = this.ClientAuthToken();
893
901
 
894
- if (this.storeAuthToken && typeof localStorage !== "undefined") {
902
+ if (this.storeAuthToken && localStorageAvailable) {
895
903
  try {
896
904
  localStorage.setItem("__elv-token-".concat(this.network), token); // eslint-disable-next-line no-empty
897
905
  } catch (error) {}
@@ -1809,13 +1817,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
1809
1817
  key: "Initialize",
1810
1818
  value: function () {
1811
1819
  var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref18) {
1812
- var _ref18$appId, appId, _ref18$network, network, _ref18$mode, mode, marketplaceParams, previewMarketplaceId, _ref18$storeAuthToken, storeAuthToken, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, client, previewMarketplaceHash, walletClient, url, savedToken;
1820
+ var client, _ref18$appId, appId, _ref18$network, network, _ref18$mode, mode, marketplaceParams, previewMarketplaceId, _ref18$storeAuthToken, storeAuthToken, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
1813
1821
 
1814
1822
  return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1815
1823
  while (1) {
1816
1824
  switch (_context18.prev = _context18.next) {
1817
1825
  case 0:
1818
- _ref18$appId = _ref18.appId, appId = _ref18$appId === void 0 ? "general" : _ref18$appId, _ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, marketplaceParams = _ref18.marketplaceParams, previewMarketplaceId = _ref18.previewMarketplaceId, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken;
1826
+ client = _ref18.client, _ref18$appId = _ref18.appId, appId = _ref18$appId === void 0 ? "general" : _ref18$appId, _ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, marketplaceParams = _ref18.marketplaceParams, previewMarketplaceId = _ref18.previewMarketplaceId, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken;
1819
1827
  _ref19 = marketplaceParams || {}, tenantSlug = _ref19.tenantSlug, marketplaceSlug = _ref19.marketplaceSlug, marketplaceId = _ref19.marketplaceId, marketplaceHash = _ref19.marketplaceHash;
1820
1828
 
1821
1829
  if (Configuration[network]) {
@@ -1834,30 +1842,37 @@ var ElvWalletClient = /*#__PURE__*/function () {
1834
1842
  throw Error("ElvWalletClient: Invalid mode ".concat(mode));
1835
1843
 
1836
1844
  case 8:
1837
- _context18.next = 10;
1845
+ if (client) {
1846
+ _context18.next = 12;
1847
+ break;
1848
+ }
1849
+
1850
+ _context18.next = 11;
1838
1851
  return ElvClient.FromNetworkName({
1839
1852
  networkName: network,
1840
1853
  assumeV3: true
1841
1854
  });
1842
1855
 
1843
- case 10:
1856
+ case 11:
1844
1857
  client = _context18.sent;
1858
+
1859
+ case 12:
1845
1860
  previewMarketplaceHash = previewMarketplaceId;
1846
1861
 
1847
1862
  if (!(previewMarketplaceHash && !previewMarketplaceHash.startsWith("hq__"))) {
1848
- _context18.next = 16;
1863
+ _context18.next = 17;
1849
1864
  break;
1850
1865
  }
1851
1866
 
1852
- _context18.next = 15;
1867
+ _context18.next = 16;
1853
1868
  return client.LatestVersionHash({
1854
1869
  objectId: previewMarketplaceId
1855
1870
  });
1856
1871
 
1857
- case 15:
1872
+ case 16:
1858
1873
  previewMarketplaceHash = _context18.sent;
1859
1874
 
1860
- case 16:
1875
+ case 17:
1861
1876
  walletClient = new ElvWalletClient({
1862
1877
  appId: appId,
1863
1878
  client: client,
@@ -1874,69 +1889,69 @@ var ElvWalletClient = /*#__PURE__*/function () {
1874
1889
  });
1875
1890
 
1876
1891
  if (!(inBrowser && window.location && window.location.href)) {
1877
- _context18.next = 36;
1892
+ _context18.next = 37;
1878
1893
  break;
1879
1894
  }
1880
1895
 
1881
1896
  url = new URL(window.location.href);
1882
1897
 
1883
1898
  if (!url.searchParams.get("elvToken")) {
1884
- _context18.next = 26;
1899
+ _context18.next = 27;
1885
1900
  break;
1886
1901
  }
1887
1902
 
1888
- _context18.next = 22;
1903
+ _context18.next = 23;
1889
1904
  return walletClient.Authenticate({
1890
1905
  token: url.searchParams.get("elvToken")
1891
1906
  });
1892
1907
 
1893
- case 22:
1908
+ case 23:
1894
1909
  url.searchParams["delete"]("elvToken");
1895
1910
  window.history.replaceState("", "", url);
1896
- _context18.next = 36;
1911
+ _context18.next = 37;
1897
1912
  break;
1898
1913
 
1899
- case 26:
1900
- if (!(storeAuthToken && typeof localStorage !== "undefined")) {
1901
- _context18.next = 36;
1914
+ case 27:
1915
+ if (!(storeAuthToken && localStorageAvailable)) {
1916
+ _context18.next = 37;
1902
1917
  break;
1903
1918
  }
1904
1919
 
1905
- _context18.prev = 27;
1920
+ _context18.prev = 28;
1906
1921
  // Load saved auth token
1907
1922
  savedToken = localStorage.getItem("__elv-token-".concat(network));
1908
1923
 
1909
1924
  if (!savedToken) {
1910
- _context18.next = 32;
1925
+ _context18.next = 33;
1911
1926
  break;
1912
1927
  }
1913
1928
 
1914
- _context18.next = 32;
1929
+ _context18.next = 33;
1915
1930
  return walletClient.Authenticate({
1916
1931
  token: savedToken
1917
1932
  });
1918
1933
 
1919
- case 32:
1920
- _context18.next = 36;
1934
+ case 33:
1935
+ _context18.next = 37;
1921
1936
  break;
1922
1937
 
1923
- case 34:
1924
- _context18.prev = 34;
1925
- _context18.t0 = _context18["catch"](27);
1938
+ case 35:
1939
+ _context18.prev = 35;
1940
+ _context18.t0 = _context18["catch"](28);
1926
1941
 
1927
- case 36:
1928
- _context18.next = 38;
1942
+ case 37:
1943
+ _context18.next = 39;
1929
1944
  return walletClient.LoadAvailableMarketplaces();
1930
1945
 
1931
- case 38:
1946
+ case 39:
1932
1947
  return _context18.abrupt("return", walletClient);
1933
1948
 
1934
- case 39:
1949
+ case 40:
1935
1950
  case "end":
1936
1951
  return _context18.stop();
1937
1952
  }
1938
1953
  }
1939
- }, _callee18, null, [[27, 34]]);
1954
+ }, _callee18, null, [[28, 35]]);
1940
1955
  }));
1941
1956
 
1942
1957
  function Initialize(_x21) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.27",
3
+ "version": "3.2.29",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -1,8 +1,13 @@
1
1
  const Id = require("./Id");
2
2
  const Utils = require("./Utils");
3
3
  const permissionLevels = require("./client/ContentAccess").permissionLevels;
4
+ const {LogMessage} = require("./LogMessage");
4
5
 
5
6
  class FrameClient {
7
+ Log(message, error = false) {
8
+ LogMessage(this, message, error);
9
+ }
10
+
6
11
  /**
7
12
  * FrameClient is a client that looks to the user like an ElvClient, but works by passing messages
8
13
  * to another frame with an actual ElvClient instead of making the calls itself.
@@ -195,7 +200,6 @@ class FrameClient {
195
200
  methodListener = async (event) => {
196
201
  try {
197
202
  const message = event.data;
198
-
199
203
  if(message.type !== "ElvFrameResponse" || message.requestId !== requestId) {
200
204
  return;
201
205
  }
@@ -431,7 +435,7 @@ class FrameClient {
431
435
  "UpdateContentObjectGraph",
432
436
  "UpdateNTPInstance",
433
437
  "UploadFileData",
434
- "UploadFiles",
438
+ /*"UploadFiles",*/ //Override
435
439
  "UploadFilesFromS3",
436
440
  "UploadJobStatus",
437
441
  "UploadPart",
@@ -462,4 +466,7 @@ class FrameClient {
462
466
  }
463
467
  }
464
468
 
469
+ const { UploadFiles } = require("./client/Files");
470
+ FrameClient.prototype.UploadFiles=UploadFiles;
471
+
465
472
  exports.FrameClient = FrameClient;
@@ -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