@wix/sdk 1.5.8 → 1.5.9

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.
@@ -405,7 +405,7 @@ function getImageUrl(val) {
405
405
  };
406
406
  }
407
407
  function getVideoUrl(val, resolution) {
408
- let id, thumbnailId, thumbnailWidth, thumbnailHeight;
408
+ let id, thumbnailId, thumbnailWidth, thumbnailHeight, decodedFilename = "";
409
409
  if (val.startsWith(WIX_VIDEO_URL)) {
410
410
  id = val.split(WIX_VIDEO_URL).pop().split("/")[0];
411
411
  thumbnailId = "".concat(id, ".jpg");
@@ -415,16 +415,25 @@ function getVideoUrl(val, resolution) {
415
415
  const alignedVideo = alignIfLegacy(val, WIX_VIDEO);
416
416
  const { pathname, hash } = new URL(alignedVideo);
417
417
  const hashParams = new URLSearchParams(hash.replace("#", ""));
418
- [id] = pathname.replace("".concat(WIX_VIDEO, "://v1/"), "").split("/");
418
+ const [_id, fileName] = pathname.replace("".concat(WIX_VIDEO, "://v1/"), "").split("/");
419
+ id = _id;
419
420
  thumbnailId = hashParams.get("posterUri") || "".concat(id, ".jpg");
420
421
  thumbnailWidth = hashParams.get("posterWidth") || "50";
421
422
  thumbnailHeight = hashParams.get("posterHeight") || "50";
423
+ decodedFilename = decodeText(fileName);
422
424
  }
423
- return {
425
+ const res = {
424
426
  id,
425
427
  url: "".concat(WIX_VIDEO_URL).concat(id, "/").concat(resolution ? "".concat(resolution, "/mp4/file.mp4") : "file"),
426
428
  thumbnail: "".concat(WIX_PROTOCOL).concat(WIX_IMAGE, "://v1/").concat(thumbnailId, "#originWidth=").concat(thumbnailWidth, "&originHeight=").concat(thumbnailHeight)
427
429
  };
430
+ if (!decodedFilename) {
431
+ return res;
432
+ }
433
+ return {
434
+ ...res,
435
+ filename: decodedFilename
436
+ };
428
437
  }
429
438
  function getAudioUrl(val) {
430
439
  const alignedAudio = alignIfLegacy(val, WIX_AUDIO);
@@ -442,7 +451,7 @@ function getAudioUrl(val) {
442
451
  }
443
452
  return {
444
453
  ...res,
445
- name: decodedFilename
454
+ filename: decodedFilename
446
455
  };
447
456
  }
448
457
  function getDocumentUrl(val) {
@@ -460,7 +469,7 @@ function getDocumentUrl(val) {
460
469
  }
461
470
  return {
462
471
  ...res,
463
- name: decodedFilename
472
+ filename: decodedFilename
464
473
  };
465
474
  }
466
475
  function decodeText(s) {
package/build/index.d.mts CHANGED
@@ -156,17 +156,18 @@ declare function getVideoUrl(val: string, resolution?: VideoResolution): {
156
156
  id: string;
157
157
  url: string;
158
158
  thumbnail: string;
159
+ filename?: string;
159
160
  };
160
161
  declare function getAudioUrl(val: string): {
161
162
  id: string;
162
163
  url: string;
163
164
  duration: number;
164
- name?: string;
165
+ filename?: string;
165
166
  };
166
167
  declare function getDocumentUrl(val: string): {
167
168
  id: string;
168
169
  url: string;
169
- name?: string;
170
+ filename?: string;
170
171
  };
171
172
  declare function decodeText(s: string): string;
172
173
  declare enum VideoResolution {
package/build/index.d.ts CHANGED
@@ -156,17 +156,18 @@ declare function getVideoUrl(val: string, resolution?: VideoResolution): {
156
156
  id: string;
157
157
  url: string;
158
158
  thumbnail: string;
159
+ filename?: string;
159
160
  };
160
161
  declare function getAudioUrl(val: string): {
161
162
  id: string;
162
163
  url: string;
163
164
  duration: number;
164
- name?: string;
165
+ filename?: string;
165
166
  };
166
167
  declare function getDocumentUrl(val: string): {
167
168
  id: string;
168
169
  url: string;
169
- name?: string;
170
+ filename?: string;
170
171
  };
171
172
  declare function decodeText(s: string): string;
172
173
  declare enum VideoResolution {
package/build/index.js CHANGED
@@ -450,7 +450,7 @@ function getImageUrl(val) {
450
450
  };
451
451
  }
452
452
  function getVideoUrl(val, resolution) {
453
- let id, thumbnailId, thumbnailWidth, thumbnailHeight;
453
+ let id, thumbnailId, thumbnailWidth, thumbnailHeight, decodedFilename = "";
454
454
  if (val.startsWith(WIX_VIDEO_URL)) {
455
455
  id = val.split(WIX_VIDEO_URL).pop().split("/")[0];
456
456
  thumbnailId = `${id}.jpg`;
@@ -460,16 +460,25 @@ function getVideoUrl(val, resolution) {
460
460
  const alignedVideo = alignIfLegacy(val, WIX_VIDEO);
461
461
  const { pathname, hash } = new URL(alignedVideo);
462
462
  const hashParams = new URLSearchParams(hash.replace("#", ""));
463
- [id] = pathname.replace(`${WIX_VIDEO}://v1/`, "").split("/");
463
+ const [_id, fileName] = pathname.replace(`${WIX_VIDEO}://v1/`, "").split("/");
464
+ id = _id;
464
465
  thumbnailId = hashParams.get("posterUri") || `${id}.jpg`;
465
466
  thumbnailWidth = hashParams.get("posterWidth") || "50";
466
467
  thumbnailHeight = hashParams.get("posterHeight") || "50";
468
+ decodedFilename = decodeText(fileName);
467
469
  }
468
- return {
470
+ const res = {
469
471
  id,
470
472
  url: `${WIX_VIDEO_URL}${id}/${resolution ? `${resolution}/mp4/file.mp4` : "file"}`,
471
473
  thumbnail: `${WIX_PROTOCOL}${WIX_IMAGE}://v1/${thumbnailId}#originWidth=${thumbnailWidth}&originHeight=${thumbnailHeight}`
472
474
  };
475
+ if (!decodedFilename) {
476
+ return res;
477
+ }
478
+ return {
479
+ ...res,
480
+ filename: decodedFilename
481
+ };
473
482
  }
474
483
  function getAudioUrl(val) {
475
484
  const alignedAudio = alignIfLegacy(val, WIX_AUDIO);
@@ -487,7 +496,7 @@ function getAudioUrl(val) {
487
496
  }
488
497
  return {
489
498
  ...res,
490
- name: decodedFilename
499
+ filename: decodedFilename
491
500
  };
492
501
  }
493
502
  function getDocumentUrl(val) {
@@ -505,7 +514,7 @@ function getDocumentUrl(val) {
505
514
  }
506
515
  return {
507
516
  ...res,
508
- name: decodedFilename
517
+ filename: decodedFilename
509
518
  };
510
519
  }
511
520
  function decodeText(s) {
package/build/index.mjs CHANGED
@@ -403,7 +403,7 @@ function getImageUrl(val) {
403
403
  };
404
404
  }
405
405
  function getVideoUrl(val, resolution) {
406
- let id, thumbnailId, thumbnailWidth, thumbnailHeight;
406
+ let id, thumbnailId, thumbnailWidth, thumbnailHeight, decodedFilename = "";
407
407
  if (val.startsWith(WIX_VIDEO_URL)) {
408
408
  id = val.split(WIX_VIDEO_URL).pop().split("/")[0];
409
409
  thumbnailId = `${id}.jpg`;
@@ -413,16 +413,25 @@ function getVideoUrl(val, resolution) {
413
413
  const alignedVideo = alignIfLegacy(val, WIX_VIDEO);
414
414
  const { pathname, hash } = new URL(alignedVideo);
415
415
  const hashParams = new URLSearchParams(hash.replace("#", ""));
416
- [id] = pathname.replace(`${WIX_VIDEO}://v1/`, "").split("/");
416
+ const [_id, fileName] = pathname.replace(`${WIX_VIDEO}://v1/`, "").split("/");
417
+ id = _id;
417
418
  thumbnailId = hashParams.get("posterUri") || `${id}.jpg`;
418
419
  thumbnailWidth = hashParams.get("posterWidth") || "50";
419
420
  thumbnailHeight = hashParams.get("posterHeight") || "50";
421
+ decodedFilename = decodeText(fileName);
420
422
  }
421
- return {
423
+ const res = {
422
424
  id,
423
425
  url: `${WIX_VIDEO_URL}${id}/${resolution ? `${resolution}/mp4/file.mp4` : "file"}`,
424
426
  thumbnail: `${WIX_PROTOCOL}${WIX_IMAGE}://v1/${thumbnailId}#originWidth=${thumbnailWidth}&originHeight=${thumbnailHeight}`
425
427
  };
428
+ if (!decodedFilename) {
429
+ return res;
430
+ }
431
+ return {
432
+ ...res,
433
+ filename: decodedFilename
434
+ };
426
435
  }
427
436
  function getAudioUrl(val) {
428
437
  const alignedAudio = alignIfLegacy(val, WIX_AUDIO);
@@ -440,7 +449,7 @@ function getAudioUrl(val) {
440
449
  }
441
450
  return {
442
451
  ...res,
443
- name: decodedFilename
452
+ filename: decodedFilename
444
453
  };
445
454
  }
446
455
  function getDocumentUrl(val) {
@@ -458,7 +467,7 @@ function getDocumentUrl(val) {
458
467
  }
459
468
  return {
460
469
  ...res,
461
- name: decodedFilename
470
+ filename: decodedFilename
462
471
  };
463
472
  }
464
473
  function decodeText(s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -33,7 +33,7 @@
33
33
  "@wix/identity": "^1.0.63",
34
34
  "@wix/image-kit": "^1.42.0",
35
35
  "@wix/redirects": "^1.0.28",
36
- "@wix/sdk-types": "1.5.2",
36
+ "@wix/sdk-types": "^1.5.3",
37
37
  "pkce-challenge": "^3.1.0",
38
38
  "querystring": "^0.2.1",
39
39
  "type-fest": "^4.8.3"
@@ -43,19 +43,19 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/is-ci": "^3.0.4",
46
- "@types/node": "^20.10.2",
46
+ "@types/node": "^20.10.4",
47
47
  "@wix/ecom": "^1.0.385",
48
48
  "@wix/events": "^1.0.127",
49
49
  "@wix/metro": "^1.0.67",
50
50
  "@wix/metro-runtime": "^1.1556.0",
51
51
  "eslint": "^7.32.0",
52
52
  "eslint-config-sdk": "0.0.0",
53
- "graphql": "16.8.0",
53
+ "graphql": "^16.8.0",
54
54
  "is-ci": "^3.0.1",
55
55
  "jsdom": "^22.1.0",
56
- "msw": "^2.0.9",
56
+ "msw": "^2.0.10",
57
57
  "tsup": "^7.3.0",
58
- "typescript": "^5.3.2",
58
+ "typescript": "^5.3.3",
59
59
  "vitest": "^0.34.6",
60
60
  "vitest-teamcity-reporter": "^0.2.1"
61
61
  },
@@ -82,5 +82,5 @@
82
82
  "wallaby": {
83
83
  "autoDetect": true
84
84
  },
85
- "falconPackageHash": "abc3cbf2dfe41ba544a61d2a46cac253a1b083d01586f66bd062aba8"
85
+ "falconPackageHash": "5ba41ba27346699ec85cbabd2fc593dd3e33823247aab3de2e26addf"
86
86
  }