@eluvio/elv-client-js 4.0.14 → 4.0.16

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.
@@ -116,12 +116,6 @@ var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
116
116
  value: function getAddress() {
117
117
  return this.address;
118
118
  }
119
-
120
- /**
121
- * Sign a hashed piece of data
122
- * @param {String} digest - Hex string of hashed data
123
- * @returns - the signed message as a hex string
124
- */
125
119
  }, {
126
120
  key: "signDigest",
127
121
  value: function () {
@@ -1276,7 +1276,8 @@ exports.ProduceMetadataLinks = /*#__PURE__*/function () {
1276
1276
  objectId: objectId,
1277
1277
  versionHash: versionHash,
1278
1278
  linkPath: path,
1279
- authorizationToken: authorizationToken
1279
+ authorizationToken: authorizationToken,
1280
+ noAuth: noAuth
1280
1281
  });
1281
1282
  case 13:
1282
1283
  _context22.t3 = _context22.sent;
@@ -1341,7 +1342,7 @@ exports.MetadataAuth = /*#__PURE__*/function () {
1341
1342
  if (versionHash) {
1342
1343
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1343
1344
  }
1344
- noAuth = this.noAuth || noAuth;
1345
+ noAuth = this.noAuth || noAuth || this.staticToken;
1345
1346
  isPublic = noAuth;
1346
1347
  if (noAuth) {
1347
1348
  _context23.next = 14;
@@ -1551,8 +1552,25 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
1551
1552
  if (versionHash) {
1552
1553
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1553
1554
  }
1554
- path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree); // Main authorization
1555
- _context24.next = 8;
1555
+ path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree);
1556
+ if (versionHash) {
1557
+ _context24.next = 12;
1558
+ break;
1559
+ }
1560
+ if (libraryId) {
1561
+ _context24.next = 11;
1562
+ break;
1563
+ }
1564
+ _context24.next = 10;
1565
+ return this.ContentObjectLibraryId({
1566
+ objectId: objectId
1567
+ });
1568
+ case 10:
1569
+ libraryId = _context24.sent;
1570
+ case 11:
1571
+ path = UrlJoin("qlibs", libraryId, path);
1572
+ case 12:
1573
+ _context24.next = 14;
1556
1574
  return this.MetadataAuth({
1557
1575
  libraryId: libraryId,
1558
1576
  objectId: objectId,
@@ -1560,15 +1578,15 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
1560
1578
  path: metadataSubtree,
1561
1579
  noAuth: noAuth
1562
1580
  });
1563
- case 8:
1581
+ case 14:
1564
1582
  defaultAuthToken = _context24.sent;
1565
1583
  // All authorization
1566
1584
  authTokens = [authorizationToken, queryParams.authorization, defaultAuthToken].flat().filter(function (token) {
1567
1585
  return token;
1568
1586
  });
1569
1587
  delete queryParams.authorization;
1570
- _context24.prev = 11;
1571
- _context24.next = 14;
1588
+ _context24.prev = 17;
1589
+ _context24.next = 20;
1572
1590
  return this.utils.ResponseToJson(this.HttpClient.Request({
1573
1591
  headers: {
1574
1592
  "Authorization": authTokens.map(function (token) {
@@ -1586,37 +1604,37 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
1586
1604
  method: "GET",
1587
1605
  path: path
1588
1606
  }));
1589
- case 14:
1607
+ case 20:
1590
1608
  metadata = _context24.sent;
1591
- _context24.next = 27;
1609
+ _context24.next = 33;
1592
1610
  break;
1593
- case 17:
1594
- _context24.prev = 17;
1595
- _context24.t0 = _context24["catch"](11);
1611
+ case 23:
1612
+ _context24.prev = 23;
1613
+ _context24.t0 = _context24["catch"](17);
1596
1614
  if (!(_context24.t0.status !== 404)) {
1597
- _context24.next = 21;
1615
+ _context24.next = 27;
1598
1616
  break;
1599
1617
  }
1600
1618
  throw _context24.t0;
1601
- case 21:
1619
+ case 27:
1602
1620
  // For a 404 error, check if error was due to write token not found
1603
1621
  errQwtoken = objectPath.get(_context24.t0.body, "errors[0].cause.cause.cause.qwtoken");
1604
1622
  if (!errQwtoken) {
1605
- _context24.next = 26;
1623
+ _context24.next = 32;
1606
1624
  break;
1607
1625
  }
1608
1626
  throw _context24.t0;
1609
- case 26:
1627
+ case 32:
1610
1628
  // For all other 404 errors (not just 'subtree not found'), suppress error and
1611
1629
  // return an empty value. (there are function call chains that depend on this behavior,
1612
1630
  // e.g. CreateABRMezzanine -> CreateEncryptionConk -> ContentObjectMetadata)
1613
1631
  metadata = metadataSubtree === "/" ? {} : undefined;
1614
- case 27:
1632
+ case 33:
1615
1633
  if (!produceLinkUrls) {
1616
- _context24.next = 31;
1634
+ _context24.next = 37;
1617
1635
  break;
1618
1636
  }
1619
- _context24.next = 30;
1637
+ _context24.next = 36;
1620
1638
  return this.ProduceMetadataLinks({
1621
1639
  libraryId: libraryId,
1622
1640
  objectId: objectId,
@@ -1626,36 +1644,36 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
1626
1644
  authorizationToken: authorizationToken,
1627
1645
  noAuth: noAuth
1628
1646
  });
1629
- case 30:
1647
+ case 36:
1630
1648
  metadata = _context24.sent;
1631
- case 31:
1649
+ case 37:
1632
1650
  if (localizationSubtree) {
1633
- _context24.next = 33;
1651
+ _context24.next = 39;
1634
1652
  break;
1635
1653
  }
1636
1654
  return _context24.abrupt("return", metadata);
1637
- case 33:
1638
- _context24.prev = 33;
1639
- _context24.next = 36;
1655
+ case 39:
1656
+ _context24.prev = 39;
1657
+ _context24.next = 42;
1640
1658
  return this.ContentObjectMetadata(_objectSpread(_objectSpread({}, _args24[0]), {}, {
1641
1659
  metadataSubtree: localizationSubtree,
1642
1660
  localizationSubtree: undefined
1643
1661
  }));
1644
- case 36:
1662
+ case 42:
1645
1663
  localizedMetadata = _context24.sent;
1646
1664
  return _context24.abrupt("return", MergeWith({}, metadata, localizedMetadata, function (a, b) {
1647
1665
  return b === null || b === "" ? a : undefined;
1648
1666
  }));
1649
- case 40:
1650
- _context24.prev = 40;
1651
- _context24.t1 = _context24["catch"](33);
1667
+ case 46:
1668
+ _context24.prev = 46;
1669
+ _context24.t1 = _context24["catch"](39);
1652
1670
  this.Log(_context24.t1, true);
1653
1671
  return _context24.abrupt("return", metadata);
1654
- case 44:
1672
+ case 50:
1655
1673
  case "end":
1656
1674
  return _context24.stop();
1657
1675
  }
1658
- }, _callee24, this, [[11, 17], [33, 40]]);
1676
+ }, _callee24, this, [[17, 23], [39, 46]]);
1659
1677
  }));
1660
1678
  return function (_x25) {
1661
1679
  return _ref41.apply(this, arguments);
@@ -11,7 +11,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
  */
12
12
 
13
13
  var UrlJoin = require("url-join");
14
- var ImageType = require("image-type");
15
14
  var Ethers = require("ethers");
16
15
  var Pako = require("pako");
17
16
 
@@ -577,7 +576,7 @@ exports.SetContentLibraryImage = /*#__PURE__*/function () {
577
576
  */
578
577
  exports.SetContentObjectImage = /*#__PURE__*/function () {
579
578
  var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
580
- var libraryId, objectId, writeToken, image, imageName, _ref12$imagePath, imagePath, type, mimeType;
579
+ var libraryId, objectId, writeToken, image, imageName, _ref12$imagePath, imagePath;
581
580
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
582
581
  while (1) switch (_context7.prev = _context7.next) {
583
582
  case 0:
@@ -598,10 +597,7 @@ exports.SetContentObjectImage = /*#__PURE__*/function () {
598
597
  case 8:
599
598
  image = _context7.sent;
600
599
  case 9:
601
- // Determine image type
602
- type = ImageType(image);
603
- mimeType = ["jpg", "jpeg", "png", "gif", "webp"].includes(type.ext) ? type.mime : "image/*";
604
- _context7.next = 13;
600
+ _context7.next = 11;
605
601
  return this.UploadFiles({
606
602
  libraryId: libraryId,
607
603
  objectId: objectId,
@@ -609,13 +605,13 @@ exports.SetContentObjectImage = /*#__PURE__*/function () {
609
605
  encrypted: false,
610
606
  fileInfo: [{
611
607
  path: imageName,
612
- mime_type: mimeType,
608
+ mime_type: "image/*",
613
609
  size: image.size || image.length || image.byteLength,
614
610
  data: image
615
611
  }]
616
612
  });
617
- case 13:
618
- _context7.next = 15;
613
+ case 11:
614
+ _context7.next = 13;
619
615
  return this.ReplaceMetadata({
620
616
  libraryId: libraryId,
621
617
  objectId: objectId,
@@ -625,7 +621,7 @@ exports.SetContentObjectImage = /*#__PURE__*/function () {
625
621
  "/": "./files/".concat(imageName)
626
622
  }
627
623
  });
628
- case 15:
624
+ case 13:
629
625
  case "end":
630
626
  return _context7.stop();
631
627
  }
@@ -2092,7 +2092,7 @@ exports.CollectionRedemptionStatus = /*#__PURE__*/function () {
2092
2092
  exports.LoadDrop = /*#__PURE__*/function () {
2093
2093
  var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(_ref75) {
2094
2094
  var _this = this;
2095
- var tenantSlug, eventSlug, dropId, mainSiteHash, event, eventId;
2095
+ var tenantSlug, eventSlug, dropId, event, eventId;
2096
2096
  return _regeneratorRuntime.wrap(function _callee38$(_context38) {
2097
2097
  while (1) switch (_context38.prev = _context38.next) {
2098
2098
  case 0:
@@ -2107,18 +2107,13 @@ exports.LoadDrop = /*#__PURE__*/function () {
2107
2107
  this.drops[tenantSlug][eventSlug] = {};
2108
2108
  }
2109
2109
  if (this.drops[tenantSlug][eventSlug][dropId]) {
2110
- _context38.next = 16;
2110
+ _context38.next = 13;
2111
2111
  break;
2112
2112
  }
2113
2113
  _context38.next = 7;
2114
- return this.client.LatestVersionHash({
2115
- objectId: this.mainSiteId
2116
- });
2117
- case 7:
2118
- mainSiteHash = _context38.sent;
2119
- _context38.next = 10;
2120
2114
  return this.client.ContentObjectMetadata({
2121
- versionHash: mainSiteHash,
2115
+ libraryId: this.mainSiteLibraryId,
2116
+ objectId: this.mainSiteId,
2122
2117
  metadataSubtree: UrlJoin("public", "asset_metadata", "tenants", tenantSlug, "sites", eventSlug, "info"),
2123
2118
  resolveLinks: true,
2124
2119
  linkDepthLimit: 2,
@@ -2127,14 +2122,14 @@ exports.LoadDrop = /*#__PURE__*/function () {
2127
2122
  select: [".", "drops"],
2128
2123
  noAuth: true
2129
2124
  });
2130
- case 10:
2125
+ case 7:
2131
2126
  _context38.t0 = _context38.sent;
2132
2127
  if (_context38.t0) {
2133
- _context38.next = 13;
2128
+ _context38.next = 10;
2134
2129
  break;
2135
2130
  }
2136
2131
  _context38.t0 = [];
2137
- case 13:
2132
+ case 10:
2138
2133
  event = _context38.t0;
2139
2134
  eventId = Utils.DecodeVersionHash(event["."].source).objectId;
2140
2135
  event.drops.forEach(function (drop) {
@@ -2144,9 +2139,9 @@ exports.LoadDrop = /*#__PURE__*/function () {
2144
2139
  _this.drops[tenantSlug][eventSlug][drop.uuid] = drop;
2145
2140
  _this.drops[drop.uuid] = drop;
2146
2141
  });
2147
- case 16:
2142
+ case 13:
2148
2143
  return _context38.abrupt("return", this.drops[dropId]);
2149
- case 17:
2144
+ case 14:
2150
2145
  case "end":
2151
2146
  return _context38.stop();
2152
2147
  }
@@ -3,20 +3,23 @@ var WalletConfiguration = {
3
3
  configUrl: "https://demov3.net955210.contentfabric.io/config",
4
4
  stateStoreUrls: ["https://appsvc.svc.eluv.io/dv3"],
5
5
  staging: {
6
+ siteLibraryId: "ilib36Wi5fJDLXix8ckL7ZfaAJwJXWGD",
6
7
  siteId: "iq__2gkNh8CCZqFFnoRpEUmz7P3PaBQG",
7
8
  purchaseMode: "develop",
8
- appUrl: "https://core.test.contentfabric.io/wallet-demo"
9
+ appUrl: "https://wallet.demov3.contentfabric.io"
9
10
  }
10
11
  },
11
12
  main: {
12
13
  configUrl: "https://main.net955305.contentfabric.io/config",
13
14
  stateStoreUrls: ["https://appsvc.svc.eluv.io/main"],
14
15
  staging: {
16
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
15
17
  siteId: "iq__inauxD1KLyKWPHargCWjdCh2ayr",
16
18
  purchaseMode: "production",
17
19
  appUrl: "https://wallet.preview.contentfabric.io"
18
20
  },
19
21
  production: {
22
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
20
23
  siteId: "iq__suqRJUt2vmXsyiWS5ZaSGwtFU9R",
21
24
  purchaseMode: "production",
22
25
  appUrl: "https://wallet.contentfabric.io"
@@ -53,6 +53,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
53
53
  this.network = network;
54
54
  this.mode = mode;
55
55
  this.purchaseMode = Configuration[network][mode].purchaseMode;
56
+ this.mainSiteLibraryId = Configuration[network][mode].siteLibraryId;
56
57
  this.mainSiteId = Configuration[network][mode].siteId;
57
58
  this.appUrl = Configuration[network][mode].appUrl;
58
59
  this.publicStaticToken = client.staticToken;
@@ -828,7 +829,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
828
829
  var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
829
830
  var _this4 = this;
830
831
  var forceReload,
831
- mainSiteHash,
832
832
  metadata,
833
833
  previewTenantSlug,
834
834
  previewMarketplaceSlug,
@@ -847,14 +847,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
847
847
  return _context12.abrupt("return");
848
848
  case 3:
849
849
  _context12.next = 5;
850
- return this.client.LatestVersionHash({
851
- objectId: this.mainSiteId
852
- });
853
- case 5:
854
- mainSiteHash = _context12.sent;
855
- _context12.next = 8;
856
850
  return this.client.ContentObjectMetadata({
857
- versionHash: mainSiteHash,
851
+ libraryId: this.mainSiteLibraryId,
852
+ objectId: this.mainSiteId,
858
853
  metadataSubtree: "public/asset_metadata/tenants",
859
854
  resolveLinks: true,
860
855
  linkDepthLimit: 2,
@@ -866,10 +861,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
866
861
  select: ["*/.", "*/marketplaces/*/.", "*/marketplaces/*/info/tenant_id", "*/marketplaces/*/info/tenant_name", "*/marketplaces/*/info/branding", "*/marketplaces/*/info/storefront/background", "*/marketplaces/*/info/storefront/background_mobile"],
867
862
  remove: ["*/marketplaces/*/info/branding/custom_css"]
868
863
  });
869
- case 8:
864
+ case 5:
870
865
  metadata = _context12.sent;
871
866
  if (!this.previewMarketplaceId) {
872
- _context12.next = 24;
867
+ _context12.next = 21;
873
868
  break;
874
869
  }
875
870
  previewTenantSlug = "PREVIEW";
@@ -892,10 +887,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
892
887
 
893
888
  // Marketplace not present in branch, or preview version is different - Load metadata directly
894
889
  if (previewMarketplaceMetadata) {
895
- _context12.next = 17;
890
+ _context12.next = 14;
896
891
  break;
897
892
  }
898
- _context12.next = 15;
893
+ _context12.next = 12;
899
894
  return this.client.ContentObjectMetadata({
900
895
  versionHash: this.previewMarketplaceHash,
901
896
  metadataSubtree: "public/asset_metadata",
@@ -905,12 +900,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
905
900
  select: ["slug", "info/tenant_id", "info/tenant_name", "info/branding"],
906
901
  remove: ["info/branding/custom_css"]
907
902
  });
908
- case 15:
903
+ case 12:
909
904
  previewMarketplaceMetadata = _context12.sent;
910
905
  if (!previewMarketplaceSlug) {
911
906
  previewMarketplaceSlug = previewMarketplaceMetadata.slug;
912
907
  }
913
- case 17:
908
+ case 14:
914
909
  previewMarketplaceMetadata["."] = {
915
910
  source: this.previewMarketplaceHash
916
911
  };
@@ -922,7 +917,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
922
917
  metadata[previewTenantSlug] = metadata[previewTenantSlug] || {};
923
918
  metadata[previewTenantSlug].marketplaces = metadata[previewTenantSlug].marketplaces || {};
924
919
  metadata[previewTenantSlug].marketplaces[previewMarketplaceSlug] = previewMarketplaceMetadata;
925
- case 24:
920
+ case 21:
926
921
  availableMarketplaces = _objectSpread({}, this.availableMarketplaces || {});
927
922
  availableMarketplacesById = _objectSpread({}, this.availableMarketplacesById || {});
928
923
  Object.keys(metadata || {}).forEach(function (tenantSlug) {
@@ -964,7 +959,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
964
959
  });
965
960
  this.availableMarketplaces = availableMarketplaces;
966
961
  this.availableMarketplacesById = availableMarketplacesById;
967
- case 29:
962
+ case 26:
968
963
  case "end":
969
964
  return _context12.stop();
970
965
  }
@@ -979,7 +974,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
979
974
  key: "LatestMarketplaceHash",
980
975
  value: function () {
981
976
  var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref12) {
982
- var marketplaceParams, marketplaceInfo, mainSiteHash, marketplaceLink;
977
+ var marketplaceParams, marketplaceInfo, marketplaceLink;
983
978
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
984
979
  while (1) switch (_context13.prev = _context13.next) {
985
980
  case 0:
@@ -997,21 +992,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
997
992
  return _context13.abrupt("return", this.availableMarketplaces[marketplaceInfo.tenantSlug][marketplaceInfo.marketplaceSlug]["."].source);
998
993
  case 6:
999
994
  _context13.next = 8;
1000
- return this.client.LatestVersionHash({
1001
- objectId: this.mainSiteId
1002
- });
1003
- case 8:
1004
- mainSiteHash = _context13.sent;
1005
- _context13.next = 11;
1006
995
  return this.client.ContentObjectMetadata({
1007
- versionHash: mainSiteHash,
996
+ libraryId: this.mainSiteLibraryId,
997
+ objectId: this.mainSiteId,
1008
998
  metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug),
1009
- resolveLinks: false
999
+ resolveLinks: false,
1000
+ noAuth: true
1010
1001
  });
1011
- case 11:
1002
+ case 8:
1012
1003
  marketplaceLink = _context13.sent;
1013
1004
  return _context13.abrupt("return", LinkTargetHash(marketplaceLink));
1014
- case 13:
1005
+ case 10:
1015
1006
  case "end":
1016
1007
  return _context13.stop();
1017
1008
  }
@@ -1027,7 +1018,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1027
1018
  value: function () {
1028
1019
  var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(marketplaceParams) {
1029
1020
  var _this5 = this;
1030
- var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
1021
+ var marketplaceInfo, marketplaceId, marketplaceHashPromise, marketplace;
1031
1022
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1032
1023
  while (1) switch (_context15.prev = _context15.next) {
1033
1024
  case 0:
@@ -1035,23 +1026,21 @@ var ElvWalletClient = /*#__PURE__*/function () {
1035
1026
  marketplaceParams: marketplaceParams
1036
1027
  });
1037
1028
  marketplaceId = marketplaceInfo.marketplaceId;
1038
- _context15.next = 4;
1039
- return this.LatestMarketplaceHash({
1029
+ marketplaceHashPromise = this.LatestMarketplaceHash({
1040
1030
  marketplaceParams: marketplaceParams
1041
1031
  });
1042
- case 4:
1043
- marketplaceHash = _context15.sent;
1044
1032
  if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
1045
1033
  delete this.cachedMarketplaces[marketplaceId];
1046
1034
  }
1047
1035
  if (this.cachedMarketplaces[marketplaceId]) {
1048
- _context15.next = 21;
1036
+ _context15.next = 23;
1049
1037
  break;
1050
1038
  }
1051
- _context15.next = 9;
1039
+ _context15.next = 7;
1052
1040
  return this.client.ContentObjectMetadata({
1053
- versionHash: marketplaceHash,
1054
- metadataSubtree: "public/asset_metadata/info",
1041
+ libraryId: this.mainSiteLibraryId,
1042
+ objectId: this.mainSiteId,
1043
+ metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug, "info"),
1055
1044
  localizationSubtree: this.localization ? UrlJoin("public", "asset_metadata", "localizations", this.localization, "info") : "",
1056
1045
  linkDepthLimit: 1,
1057
1046
  resolveLinks: true,
@@ -1060,9 +1049,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
1060
1049
  produceLinkUrls: true,
1061
1050
  authorizationToken: this.publicStaticToken
1062
1051
  });
1063
- case 9:
1052
+ case 7:
1064
1053
  marketplace = _context15.sent;
1065
- _context15.next = 12;
1054
+ _context15.next = 10;
1066
1055
  return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
1067
1056
  var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(item, index) {
1068
1057
  var authorizationToken;
@@ -1112,7 +1101,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1112
1101
  return _ref13.apply(this, arguments);
1113
1102
  };
1114
1103
  }()));
1115
- case 12:
1104
+ case 10:
1116
1105
  marketplace.items = _context15.sent;
1117
1106
  marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
1118
1107
  return _objectSpread(_objectSpread({}, collection), {}, {
@@ -1121,8 +1110,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
1121
1110
  });
1122
1111
  marketplace.retrievedAt = Date.now();
1123
1112
  marketplace.marketplaceId = marketplaceId;
1124
- marketplace.versionHash = marketplaceHash;
1125
- marketplace.marketplaceHash = marketplaceHash;
1113
+ _context15.next = 16;
1114
+ return marketplaceHashPromise;
1115
+ case 16:
1116
+ marketplace.versionHash = _context15.sent;
1117
+ _context15.next = 19;
1118
+ return marketplaceHashPromise;
1119
+ case 19:
1120
+ marketplace.marketplaceHash = _context15.sent;
1126
1121
  if (this.previewMarketplaceId && marketplaceId === this.previewMarketplaceId) {
1127
1122
  marketplace.branding.preview = true;
1128
1123
  }
@@ -1148,9 +1143,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
1148
1143
  } catch (error) {}
1149
1144
  });
1150
1145
  this.cachedMarketplaces[marketplaceId] = marketplace;
1151
- case 21:
1146
+ case 23:
1152
1147
  return _context15.abrupt("return", this.cachedMarketplaces[marketplaceId]);
1153
- case 22:
1148
+ case 24:
1154
1149
  case "end":
1155
1150
  return _context15.stop();
1156
1151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -69,7 +69,6 @@
69
69
  "ethers": "^5.7.2",
70
70
  "fraction.js": "^4.0.12",
71
71
  "hash.js": "^1.1.7",
72
- "image-type": "^4.1.0",
73
72
  "isarray": "^2.0.5",
74
73
  "js-polyfills": "^0.1.42",
75
74
  "jsonpath-plus": "^6.0.1",
@@ -747,7 +747,7 @@ exports.ProduceMetadataLinks = async function({
747
747
  // Is file or rep link - produce a url
748
748
  return {
749
749
  ...metadata,
750
- url: await this.LinkUrl({libraryId, objectId, versionHash, linkPath: path, authorizationToken})
750
+ url: await this.LinkUrl({libraryId, objectId, versionHash, linkPath: path, authorizationToken, noAuth})
751
751
  };
752
752
  }
753
753
 
@@ -783,7 +783,8 @@ exports.MetadataAuth = async function({
783
783
 
784
784
  if(versionHash) { objectId = this.utils.DecodeVersionHash(versionHash).objectId; }
785
785
 
786
- noAuth = this.noAuth || noAuth;
786
+ noAuth = this.noAuth || noAuth || this.staticToken;
787
+
787
788
  let isPublic = noAuth;
788
789
  let accessType;
789
790
  if(!noAuth) {
@@ -900,6 +901,14 @@ exports.ContentObjectMetadata = async function({
900
901
 
901
902
  let path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree);
902
903
 
904
+ if(!versionHash) {
905
+ if(!libraryId) {
906
+ libraryId = await this.ContentObjectLibraryId({objectId});
907
+ }
908
+
909
+ path = UrlJoin("qlibs", libraryId, path);
910
+ }
911
+
903
912
  // Main authorization
904
913
  let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree, noAuth});
905
914
 
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  const UrlJoin = require("url-join");
8
- const ImageType = require("image-type");
9
8
  const Ethers = require("ethers");
10
9
  const Pako = require("pako");
11
10
 
@@ -386,10 +385,6 @@ exports.SetContentObjectImage = async function({libraryId, objectId, writeToken,
386
385
  image = await new Response(image).arrayBuffer();
387
386
  }
388
387
 
389
- // Determine image type
390
- const type = ImageType(image);
391
- let mimeType = ["jpg", "jpeg", "png", "gif", "webp"].includes(type.ext) ? type.mime : "image/*";
392
-
393
388
  await this.UploadFiles({
394
389
  libraryId,
395
390
  objectId,
@@ -398,7 +393,7 @@ exports.SetContentObjectImage = async function({libraryId, objectId, writeToken,
398
393
  fileInfo: [
399
394
  {
400
395
  path: imageName,
401
- mime_type: mimeType,
396
+ mime_type: "image/*",
402
397
  size: image.size || image.length || image.byteLength,
403
398
  data: image
404
399
  }
@@ -1244,9 +1244,9 @@ exports.LoadDrop = async function({tenantSlug, eventSlug, dropId}) {
1244
1244
  }
1245
1245
 
1246
1246
  if(!this.drops[tenantSlug][eventSlug][dropId]) {
1247
- const mainSiteHash = await this.client.LatestVersionHash({objectId: this.mainSiteId});
1248
1247
  const event = (await this.client.ContentObjectMetadata({
1249
- versionHash: mainSiteHash,
1248
+ libraryId: this.mainSiteLibraryId,
1249
+ objectId: this.mainSiteId,
1250
1250
  metadataSubtree: UrlJoin("public", "asset_metadata", "tenants", tenantSlug, "sites", eventSlug, "info"),
1251
1251
  resolveLinks: true,
1252
1252
  linkDepthLimit: 2,
@@ -3,20 +3,23 @@ let WalletConfiguration = {
3
3
  configUrl: "https://demov3.net955210.contentfabric.io/config",
4
4
  stateStoreUrls: ["https://appsvc.svc.eluv.io/dv3"],
5
5
  staging: {
6
+ siteLibraryId: "ilib36Wi5fJDLXix8ckL7ZfaAJwJXWGD",
6
7
  siteId: "iq__2gkNh8CCZqFFnoRpEUmz7P3PaBQG",
7
8
  purchaseMode: "develop",
8
- appUrl: "https://core.test.contentfabric.io/wallet-demo"
9
+ appUrl: "https://wallet.demov3.contentfabric.io"
9
10
  }
10
11
  },
11
12
  main: {
12
13
  configUrl: "https://main.net955305.contentfabric.io/config",
13
14
  stateStoreUrls: ["https://appsvc.svc.eluv.io/main"],
14
15
  staging: {
16
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
15
17
  siteId: "iq__inauxD1KLyKWPHargCWjdCh2ayr",
16
18
  purchaseMode: "production",
17
19
  appUrl: "https://wallet.preview.contentfabric.io",
18
20
  },
19
21
  production: {
22
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
20
23
  siteId: "iq__suqRJUt2vmXsyiWS5ZaSGwtFU9R",
21
24
  purchaseMode: "production",
22
25
  appUrl: "https://wallet.contentfabric.io"