@eluvio/elv-client-js 4.0.45 → 4.0.47
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/ElvClient-min.js +10 -10
- package/dist/ElvClient-node-min.js +5 -5
- package/dist/ElvFrameClient-min.js +5 -5
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +4 -4
- package/dist/ElvWalletClient-node-min.js +8 -8
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/Validation.js +1 -1
- package/dist/src/client/ContentAccess.js +574 -405
- package/dist/src/client/ContentManagement.js +1 -1
- package/package.json +1 -1
- package/src/FrameClient.js +1 -0
- package/src/Validation.js +7 -1
- package/src/client/ContentAccess.js +143 -0
|
@@ -2215,7 +2215,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
|
|
|
2215
2215
|
return _context30.delegateYield(_loop(), "t0", 8);
|
|
2216
2216
|
case 8:
|
|
2217
2217
|
_ret = _context30.t0;
|
|
2218
|
-
if (!
|
|
2218
|
+
if (!_ret) {
|
|
2219
2219
|
_context30.next = 11;
|
|
2220
2220
|
break;
|
|
2221
2221
|
}
|
package/package.json
CHANGED
package/src/FrameClient.js
CHANGED
package/src/Validation.js
CHANGED
|
@@ -41,7 +41,13 @@ exports.ValidateWriteToken = (writeToken) => {
|
|
|
41
41
|
exports.ValidatePartHash = (partHash) => {
|
|
42
42
|
if(!partHash) {
|
|
43
43
|
throw Error("Part hash not specified");
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
|
+
else if(!partHash.toString().startsWith("hqp_") &&
|
|
46
|
+
!partHash.toString().startsWith("hqpe") &&
|
|
47
|
+
!partHash.toString().startsWith("hqt_") &&
|
|
48
|
+
!partHash.toString().startsWith("hqte") &&
|
|
49
|
+
!partHash.toString().startsWith("hql_") &&
|
|
50
|
+
!partHash.toString().startsWith("hqle")) {
|
|
45
51
|
throw Error(`Invalid part hash: ${partHash}`);
|
|
46
52
|
}
|
|
47
53
|
};
|
|
@@ -2131,6 +2131,149 @@ exports.ContentObjectImageUrl = async function({libraryId, objectId, versionHash
|
|
|
2131
2131
|
return this.objectImageUrls[versionHash];
|
|
2132
2132
|
};
|
|
2133
2133
|
|
|
2134
|
+
/**
|
|
2135
|
+
* Get an embed URL for the specified object
|
|
2136
|
+
*
|
|
2137
|
+
* @methodGroup URL Generation
|
|
2138
|
+
* @namedParams
|
|
2139
|
+
* @param {string} objectId - ID of the object
|
|
2140
|
+
* @param {string} versionHash - Version hash of the object
|
|
2141
|
+
* @param {number} duration - Time until the token expires, in milliseconds (1 day = 24 * 60 * 60 * 1000 = 86400000)
|
|
2142
|
+
* @param {Object} options - Additional video/player options
|
|
2143
|
+
* autoplay - If enabled, video will autoplay
|
|
2144
|
+
* capLevelToPlayerSize - Caps video quality to player size
|
|
2145
|
+
* clipEnd - End time for the video
|
|
2146
|
+
* clipStart - Start time for the video
|
|
2147
|
+
* controls - Sets the player control visibility. Values: browserDefault | autoHide | show | hide | hideWithVolume. Defaults to autoHide
|
|
2148
|
+
* description - Sets the page description
|
|
2149
|
+
* directLink - If enabled, sets direct link
|
|
2150
|
+
* linkPath - Video link path
|
|
2151
|
+
* loop - If enabled, video will loop
|
|
2152
|
+
* muted - Mutes the player
|
|
2153
|
+
* offerings - Offerings to play, as an array
|
|
2154
|
+
* posterUrl - URL of the player poster image
|
|
2155
|
+
* protocols - Video protocols, as an array
|
|
2156
|
+
* showShare - Show social media share buttons
|
|
2157
|
+
* showTitle - Shows the video title, which is set from the title option (if set) or the metadata
|
|
2158
|
+
* title - Sets the page title
|
|
2159
|
+
* viewRecordKey - Contains record key
|
|
2160
|
+
*
|
|
2161
|
+
* @returns {Promise<string>} - Will return an embed URL
|
|
2162
|
+
*/
|
|
2163
|
+
exports.EmbedUrl = async function({
|
|
2164
|
+
objectId,
|
|
2165
|
+
versionHash,
|
|
2166
|
+
duration=86400000,
|
|
2167
|
+
options={}
|
|
2168
|
+
}) {
|
|
2169
|
+
if(versionHash) {
|
|
2170
|
+
ValidateVersion(versionHash);
|
|
2171
|
+
} else if(objectId) {
|
|
2172
|
+
ValidateObject(objectId);
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
// Default options
|
|
2176
|
+
options.controls = options.controls === undefined ? "autoHide" : options.controls;
|
|
2177
|
+
|
|
2178
|
+
const controlsMap = {
|
|
2179
|
+
autoHide: "h",
|
|
2180
|
+
browserDefault: "d",
|
|
2181
|
+
show: "s",
|
|
2182
|
+
hideWithVolume: "hv"
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
let embedUrl = new URL("https://embed.v3.contentfabric.io");
|
|
2186
|
+
const networkInfo = await this.NetworkInfo();
|
|
2187
|
+
const networkName = networkInfo.name === "demov3" ? "demo" : (networkInfo.name === "test" && networkInfo.id === 955205) ? "testv4" : networkInfo.name;
|
|
2188
|
+
const permission = await this.Permission({
|
|
2189
|
+
objectId: objectId ? objectId : this.utils.DecodeVersionHash(versionHash).objectId
|
|
2190
|
+
});
|
|
2191
|
+
|
|
2192
|
+
embedUrl.searchParams.set("p", "");
|
|
2193
|
+
embedUrl.searchParams.set("net", networkName);
|
|
2194
|
+
|
|
2195
|
+
if(versionHash) {
|
|
2196
|
+
embedUrl.searchParams.set("vid", versionHash);
|
|
2197
|
+
} else if(objectId) {
|
|
2198
|
+
embedUrl.searchParams.set("oid", objectId);
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
const data = {};
|
|
2202
|
+
for(const option of Object.keys(options)) {
|
|
2203
|
+
switch(option) {
|
|
2204
|
+
case "autoplay":
|
|
2205
|
+
embedUrl.searchParams.set("ap", "");
|
|
2206
|
+
break;
|
|
2207
|
+
case "capLevelToPlayerSize":
|
|
2208
|
+
embedUrl.searchParams.set("cap", "");
|
|
2209
|
+
break;
|
|
2210
|
+
case "clipEnd":
|
|
2211
|
+
embedUrl.searchParams.set("end", options.clipEnd);
|
|
2212
|
+
break;
|
|
2213
|
+
case "clipStart":
|
|
2214
|
+
embedUrl.searchParams.set("start", options.clipStart);
|
|
2215
|
+
break;
|
|
2216
|
+
case "controls":
|
|
2217
|
+
if(options.controls !== "hide") {
|
|
2218
|
+
embedUrl.searchParams.set("ct", controlsMap[options.controls]);
|
|
2219
|
+
}
|
|
2220
|
+
break;
|
|
2221
|
+
case "description":
|
|
2222
|
+
data["og:description"] = options.description;
|
|
2223
|
+
break;
|
|
2224
|
+
case "directLink":
|
|
2225
|
+
embedUrl.searchParams.set("dr", "");
|
|
2226
|
+
break;
|
|
2227
|
+
case "linkPath":
|
|
2228
|
+
embedUrl.searchParams.set("ln", this.utils.B64(options.linkPath));
|
|
2229
|
+
break;
|
|
2230
|
+
case "loop":
|
|
2231
|
+
embedUrl.searchParams.set("lp", "");
|
|
2232
|
+
break;
|
|
2233
|
+
case "muted":
|
|
2234
|
+
embedUrl.searchParams.set("m", "");
|
|
2235
|
+
break;
|
|
2236
|
+
case "offerings":
|
|
2237
|
+
embedUrl.searchParams.set("off", options.offerings.join(","));
|
|
2238
|
+
break;
|
|
2239
|
+
case "posterUrl":
|
|
2240
|
+
embedUrl.searchParams.set("pst", options.posterUrl);
|
|
2241
|
+
break;
|
|
2242
|
+
case "protocols":
|
|
2243
|
+
embedUrl.searchParams.set("ptc", options.protocols.join(","));
|
|
2244
|
+
break;
|
|
2245
|
+
case "showShare":
|
|
2246
|
+
embedUrl.searchParams.set("sh", "");
|
|
2247
|
+
break;
|
|
2248
|
+
case "showTitle":
|
|
2249
|
+
embedUrl.searchParams.set("st", "");
|
|
2250
|
+
break;
|
|
2251
|
+
case "title":
|
|
2252
|
+
data["og:title"] = options.title;
|
|
2253
|
+
break;
|
|
2254
|
+
case "viewRecordKey":
|
|
2255
|
+
embedUrl.searchParams.set("vrk", options.viewRecordKey);
|
|
2256
|
+
break;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
if(Object.keys(data).length > 0) {
|
|
2261
|
+
embedUrl.searchParams.set("data", this.utils.B64(JSON.stringify({meta_tags: data})));
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
if(["owner", "editable", "viewable"].includes(permission)) {
|
|
2265
|
+
const token = await this.CreateSignedToken({
|
|
2266
|
+
objectId,
|
|
2267
|
+
versionHash,
|
|
2268
|
+
duration
|
|
2269
|
+
});
|
|
2270
|
+
|
|
2271
|
+
embedUrl.searchParams.set("ath", token);
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
return embedUrl.toString();
|
|
2275
|
+
};
|
|
2276
|
+
|
|
2134
2277
|
/* Links */
|
|
2135
2278
|
|
|
2136
2279
|
/**
|