arky-sdk 0.3.62 → 0.3.63
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/index.cjs +9 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/dist/{svg-D_ajyHnG.d.cts → svg-3F_m7296.d.cts} +1 -1
- package/dist/{svg-WKQadzp2.d.ts → svg-4hIdMU6f.d.ts} +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +6 -20
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +6 -20
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -685,44 +685,30 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
|
685
685
|
return acc;
|
|
686
686
|
});
|
|
687
687
|
};
|
|
688
|
-
var getImageUrl = (imageBlock, isBlock = true
|
|
688
|
+
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
689
689
|
if (!imageBlock) return null;
|
|
690
|
-
const isExternalUrl = (url) => {
|
|
691
|
-
return url.startsWith("http://") || url.startsWith("https://");
|
|
692
|
-
};
|
|
693
690
|
if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
|
|
694
691
|
const mediaValue = imageBlock.value[0];
|
|
695
692
|
if (mediaValue && mediaValue.mimeType) {
|
|
696
693
|
if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
|
|
697
|
-
|
|
698
|
-
return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
|
|
694
|
+
return mediaValue.resolutions.original.url;
|
|
699
695
|
}
|
|
700
696
|
if (mediaValue.url) {
|
|
701
|
-
return
|
|
697
|
+
return mediaValue.url;
|
|
702
698
|
}
|
|
703
699
|
}
|
|
704
700
|
return null;
|
|
705
701
|
}
|
|
706
702
|
if (isBlock) {
|
|
707
703
|
if (typeof imageBlock === "string") {
|
|
708
|
-
|
|
709
|
-
return imageBlock;
|
|
710
|
-
}
|
|
711
|
-
return `${storageUrl}/${imageBlock}`;
|
|
704
|
+
return imageBlock;
|
|
712
705
|
}
|
|
713
706
|
if (imageBlock.url) {
|
|
714
|
-
|
|
715
|
-
return imageBlock.url;
|
|
716
|
-
}
|
|
717
|
-
return `${storageUrl}/${imageBlock.url}`;
|
|
707
|
+
return imageBlock.url;
|
|
718
708
|
}
|
|
719
709
|
}
|
|
720
710
|
if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
|
|
721
|
-
|
|
722
|
-
if (isExternalUrl(url)) {
|
|
723
|
-
return url;
|
|
724
|
-
}
|
|
725
|
-
return `${storageUrl}/${url}`;
|
|
711
|
+
return imageBlock.resolutions.original.url;
|
|
726
712
|
}
|
|
727
713
|
return null;
|
|
728
714
|
};
|
|
@@ -767,7 +753,7 @@ var createCmsApi = (apiConfig) => {
|
|
|
767
753
|
},
|
|
768
754
|
getImage(key) {
|
|
769
755
|
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
770
|
-
return getImageUrl(block, true
|
|
756
|
+
return getImageUrl(block, true);
|
|
771
757
|
}
|
|
772
758
|
};
|
|
773
759
|
},
|
|
@@ -1528,7 +1514,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1528
1514
|
}
|
|
1529
1515
|
|
|
1530
1516
|
// src/index.ts
|
|
1531
|
-
var SDK_VERSION = "0.3.
|
|
1517
|
+
var SDK_VERSION = "0.3.63";
|
|
1532
1518
|
var SUPPORTED_FRAMEWORKS = [
|
|
1533
1519
|
"astro",
|
|
1534
1520
|
"react",
|
|
@@ -1542,11 +1528,9 @@ function createArkySDK(config) {
|
|
|
1542
1528
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1543
1529
|
);
|
|
1544
1530
|
const httpClient = createHttpClient(config);
|
|
1545
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1546
1531
|
const apiConfig = {
|
|
1547
1532
|
httpClient,
|
|
1548
1533
|
businessId: config.businessId,
|
|
1549
|
-
storageUrl,
|
|
1550
1534
|
baseUrl: config.baseUrl,
|
|
1551
1535
|
market: config.market,
|
|
1552
1536
|
locale,
|
|
@@ -1583,7 +1567,7 @@ function createArkySDK(config) {
|
|
|
1583
1567
|
setToken: config.setToken,
|
|
1584
1568
|
utils: {
|
|
1585
1569
|
// Block utilities
|
|
1586
|
-
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock
|
|
1570
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
1587
1571
|
getBlockValue,
|
|
1588
1572
|
getBlockValues,
|
|
1589
1573
|
getBlockLabel,
|