@wix/sdk 1.16.0 → 1.17.1
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/build/media/helpers.d.ts +16 -0
- package/build/media/helpers.js +10 -3
- package/build/wixMedia.d.ts +2 -1
- package/build/wixMedia.js +2 -1
- package/cjs/build/media/helpers.d.ts +16 -0
- package/cjs/build/media/helpers.js +12 -3
- package/cjs/build/wixMedia.d.ts +2 -1
- package/cjs/build/wixMedia.js +1 -0
- package/package.json +2 -2
package/build/media/helpers.d.ts
CHANGED
|
@@ -10,6 +10,22 @@ export declare function getImageUrl(val: string): {
|
|
|
10
10
|
altText?: string;
|
|
11
11
|
filename?: string;
|
|
12
12
|
};
|
|
13
|
+
export declare function getShapeUrl(val: string): {
|
|
14
|
+
id: string;
|
|
15
|
+
url: string;
|
|
16
|
+
height: number;
|
|
17
|
+
width: number;
|
|
18
|
+
altText?: string;
|
|
19
|
+
filename?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function getBaseImageUrl(val: string, baseUrl?: string): {
|
|
22
|
+
id: string;
|
|
23
|
+
url: string;
|
|
24
|
+
height: number;
|
|
25
|
+
width: number;
|
|
26
|
+
altText?: string;
|
|
27
|
+
filename?: string;
|
|
28
|
+
};
|
|
13
29
|
export declare function getVideoUrl(val: string, resolution?: VideoResolution): {
|
|
14
30
|
id: string;
|
|
15
31
|
url: string;
|
package/build/media/helpers.js
CHANGED
|
@@ -5,6 +5,7 @@ const WIX_VIDEO = 'video';
|
|
|
5
5
|
const WIX_AUDIO = 'audio';
|
|
6
6
|
const WIX_DOCUMENT = 'document';
|
|
7
7
|
const WIX_IMAGE_URL = 'https://static.wixstatic.com/media/';
|
|
8
|
+
const WIX_SHAPES_URL = 'https://static.wixstatic.com/shapes/';
|
|
8
9
|
const WIX_VIDEO_URL = 'https://video.wixstatic.com/video/';
|
|
9
10
|
const WIX_AUDIO_URL = 'https://static.wixstatic.com/mp3/';
|
|
10
11
|
const WIX_DOCUMENT_URL = 'https://d945e594-8657-47e2-9cd9-e9033c3d8da0.usrfiles.com/ugd/';
|
|
@@ -21,10 +22,16 @@ export function getCroppedImageUrl(wixMediaIdentifier, cropX, cropY, cropWidth,
|
|
|
21
22
|
return sdk.getCropImageURL(img.id, img.height, img.width, cropX, cropY, cropWidth, cropHeight, targetWidth, targetHeight, options);
|
|
22
23
|
}
|
|
23
24
|
export function getImageUrl(val) {
|
|
25
|
+
return getBaseImageUrl(val, WIX_IMAGE_URL);
|
|
26
|
+
}
|
|
27
|
+
export function getShapeUrl(val) {
|
|
28
|
+
return getBaseImageUrl(val, WIX_SHAPES_URL);
|
|
29
|
+
}
|
|
30
|
+
export function getBaseImageUrl(val, baseUrl = WIX_IMAGE_URL) {
|
|
24
31
|
let id, filenameOrAltText;
|
|
25
32
|
let height, width;
|
|
26
|
-
if (val.startsWith(
|
|
27
|
-
id = val.split(
|
|
33
|
+
if (val.startsWith(baseUrl)) {
|
|
34
|
+
id = val.split(baseUrl).pop().split('/')[0];
|
|
28
35
|
width = val.split('/w_').pop().split(',')[0];
|
|
29
36
|
height = val.split(',h_').pop().split(',')[0];
|
|
30
37
|
}
|
|
@@ -42,7 +49,7 @@ export function getImageUrl(val) {
|
|
|
42
49
|
const decodedFilenameOrAltText = decodeText(filenameOrAltText);
|
|
43
50
|
const res = {
|
|
44
51
|
id,
|
|
45
|
-
url: `${
|
|
52
|
+
url: `${baseUrl}${id}`,
|
|
46
53
|
height: Number(height),
|
|
47
54
|
width: Number(width),
|
|
48
55
|
};
|
package/build/wixMedia.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl } from './media/helpers.js';
|
|
1
|
+
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl, getShapeUrl } from './media/helpers.js';
|
|
2
2
|
export { VideoResolution, decodeText } from './media/helpers.js';
|
|
3
3
|
export declare const media: {
|
|
4
4
|
getCroppedImageUrl: typeof getCroppedImageUrl;
|
|
@@ -8,4 +8,5 @@ export declare const media: {
|
|
|
8
8
|
getVideoUrl: typeof getVideoUrl;
|
|
9
9
|
getAudioUrl: typeof getAudioUrl;
|
|
10
10
|
getDocumentUrl: typeof getDocumentUrl;
|
|
11
|
+
getShapeUrl: typeof getShapeUrl;
|
|
11
12
|
};
|
package/build/wixMedia.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl, } from './media/helpers.js';
|
|
1
|
+
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl, getShapeUrl, } from './media/helpers.js';
|
|
2
2
|
export { VideoResolution, decodeText } from './media/helpers.js';
|
|
3
3
|
export const media = {
|
|
4
4
|
getCroppedImageUrl,
|
|
@@ -8,4 +8,5 @@ export const media = {
|
|
|
8
8
|
getVideoUrl,
|
|
9
9
|
getAudioUrl,
|
|
10
10
|
getDocumentUrl,
|
|
11
|
+
getShapeUrl,
|
|
11
12
|
};
|
|
@@ -10,6 +10,22 @@ export declare function getImageUrl(val: string): {
|
|
|
10
10
|
altText?: string;
|
|
11
11
|
filename?: string;
|
|
12
12
|
};
|
|
13
|
+
export declare function getShapeUrl(val: string): {
|
|
14
|
+
id: string;
|
|
15
|
+
url: string;
|
|
16
|
+
height: number;
|
|
17
|
+
width: number;
|
|
18
|
+
altText?: string;
|
|
19
|
+
filename?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function getBaseImageUrl(val: string, baseUrl?: string): {
|
|
22
|
+
id: string;
|
|
23
|
+
url: string;
|
|
24
|
+
height: number;
|
|
25
|
+
width: number;
|
|
26
|
+
altText?: string;
|
|
27
|
+
filename?: string;
|
|
28
|
+
};
|
|
13
29
|
export declare function getVideoUrl(val: string, resolution?: VideoResolution): {
|
|
14
30
|
id: string;
|
|
15
31
|
url: string;
|
|
@@ -5,6 +5,8 @@ exports.getScaledToFillImageUrl = getScaledToFillImageUrl;
|
|
|
5
5
|
exports.getScaledToFitImageUrl = getScaledToFitImageUrl;
|
|
6
6
|
exports.getCroppedImageUrl = getCroppedImageUrl;
|
|
7
7
|
exports.getImageUrl = getImageUrl;
|
|
8
|
+
exports.getShapeUrl = getShapeUrl;
|
|
9
|
+
exports.getBaseImageUrl = getBaseImageUrl;
|
|
8
10
|
exports.getVideoUrl = getVideoUrl;
|
|
9
11
|
exports.getAudioUrl = getAudioUrl;
|
|
10
12
|
exports.getDocumentUrl = getDocumentUrl;
|
|
@@ -16,6 +18,7 @@ const WIX_VIDEO = 'video';
|
|
|
16
18
|
const WIX_AUDIO = 'audio';
|
|
17
19
|
const WIX_DOCUMENT = 'document';
|
|
18
20
|
const WIX_IMAGE_URL = 'https://static.wixstatic.com/media/';
|
|
21
|
+
const WIX_SHAPES_URL = 'https://static.wixstatic.com/shapes/';
|
|
19
22
|
const WIX_VIDEO_URL = 'https://video.wixstatic.com/video/';
|
|
20
23
|
const WIX_AUDIO_URL = 'https://static.wixstatic.com/mp3/';
|
|
21
24
|
const WIX_DOCUMENT_URL = 'https://d945e594-8657-47e2-9cd9-e9033c3d8da0.usrfiles.com/ugd/';
|
|
@@ -32,10 +35,16 @@ function getCroppedImageUrl(wixMediaIdentifier, cropX, cropY, cropWidth, cropHei
|
|
|
32
35
|
return image_kit_1.sdk.getCropImageURL(img.id, img.height, img.width, cropX, cropY, cropWidth, cropHeight, targetWidth, targetHeight, options);
|
|
33
36
|
}
|
|
34
37
|
function getImageUrl(val) {
|
|
38
|
+
return getBaseImageUrl(val, WIX_IMAGE_URL);
|
|
39
|
+
}
|
|
40
|
+
function getShapeUrl(val) {
|
|
41
|
+
return getBaseImageUrl(val, WIX_SHAPES_URL);
|
|
42
|
+
}
|
|
43
|
+
function getBaseImageUrl(val, baseUrl = WIX_IMAGE_URL) {
|
|
35
44
|
let id, filenameOrAltText;
|
|
36
45
|
let height, width;
|
|
37
|
-
if (val.startsWith(
|
|
38
|
-
id = val.split(
|
|
46
|
+
if (val.startsWith(baseUrl)) {
|
|
47
|
+
id = val.split(baseUrl).pop().split('/')[0];
|
|
39
48
|
width = val.split('/w_').pop().split(',')[0];
|
|
40
49
|
height = val.split(',h_').pop().split(',')[0];
|
|
41
50
|
}
|
|
@@ -53,7 +62,7 @@ function getImageUrl(val) {
|
|
|
53
62
|
const decodedFilenameOrAltText = decodeText(filenameOrAltText);
|
|
54
63
|
const res = {
|
|
55
64
|
id,
|
|
56
|
-
url: `${
|
|
65
|
+
url: `${baseUrl}${id}`,
|
|
57
66
|
height: Number(height),
|
|
58
67
|
width: Number(width),
|
|
59
68
|
};
|
package/cjs/build/wixMedia.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl } from './media/helpers.js';
|
|
1
|
+
import { getAudioUrl, getCroppedImageUrl, getDocumentUrl, getImageUrl, getScaledToFillImageUrl, getScaledToFitImageUrl, getVideoUrl, getShapeUrl } from './media/helpers.js';
|
|
2
2
|
export { VideoResolution, decodeText } from './media/helpers.js';
|
|
3
3
|
export declare const media: {
|
|
4
4
|
getCroppedImageUrl: typeof getCroppedImageUrl;
|
|
@@ -8,4 +8,5 @@ export declare const media: {
|
|
|
8
8
|
getVideoUrl: typeof getVideoUrl;
|
|
9
9
|
getAudioUrl: typeof getAudioUrl;
|
|
10
10
|
getDocumentUrl: typeof getDocumentUrl;
|
|
11
|
+
getShapeUrl: typeof getShapeUrl;
|
|
11
12
|
};
|
package/cjs/build/wixMedia.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"wallaby": {
|
|
127
127
|
"autoDetect": true
|
|
128
128
|
},
|
|
129
|
-
"falconPackageHash": "
|
|
129
|
+
"falconPackageHash": "1e32969c85c2ac1d56e7fd2fe1ffc3556907473b9e9e0efe43db5aaa"
|
|
130
130
|
}
|