arky-sdk 0.3.61 → 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 +12 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +12 -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 +3 -2
- package/dist/types.d.ts +3 -2
- 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
|
@@ -216,6 +216,9 @@ var createUserApi = (apiConfig) => {
|
|
|
216
216
|
if (params.apiTokens !== void 0) payload.apiTokens = params.apiTokens;
|
|
217
217
|
return apiConfig.httpClient.put("/v1/users", payload, options);
|
|
218
218
|
},
|
|
219
|
+
async deleteUser(params, options) {
|
|
220
|
+
return apiConfig.httpClient.delete("/v1/users", options);
|
|
221
|
+
},
|
|
219
222
|
async addPhoneNumber(params, options) {
|
|
220
223
|
return apiConfig.httpClient.post("/v1/users/phone-number", params, options);
|
|
221
224
|
},
|
|
@@ -682,44 +685,30 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
|
682
685
|
return acc;
|
|
683
686
|
});
|
|
684
687
|
};
|
|
685
|
-
var getImageUrl = (imageBlock, isBlock = true
|
|
688
|
+
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
686
689
|
if (!imageBlock) return null;
|
|
687
|
-
const isExternalUrl = (url) => {
|
|
688
|
-
return url.startsWith("http://") || url.startsWith("https://");
|
|
689
|
-
};
|
|
690
690
|
if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
|
|
691
691
|
const mediaValue = imageBlock.value[0];
|
|
692
692
|
if (mediaValue && mediaValue.mimeType) {
|
|
693
693
|
if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
|
|
694
|
-
|
|
695
|
-
return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
|
|
694
|
+
return mediaValue.resolutions.original.url;
|
|
696
695
|
}
|
|
697
696
|
if (mediaValue.url) {
|
|
698
|
-
return
|
|
697
|
+
return mediaValue.url;
|
|
699
698
|
}
|
|
700
699
|
}
|
|
701
700
|
return null;
|
|
702
701
|
}
|
|
703
702
|
if (isBlock) {
|
|
704
703
|
if (typeof imageBlock === "string") {
|
|
705
|
-
|
|
706
|
-
return imageBlock;
|
|
707
|
-
}
|
|
708
|
-
return `${storageUrl}/${imageBlock}`;
|
|
704
|
+
return imageBlock;
|
|
709
705
|
}
|
|
710
706
|
if (imageBlock.url) {
|
|
711
|
-
|
|
712
|
-
return imageBlock.url;
|
|
713
|
-
}
|
|
714
|
-
return `${storageUrl}/${imageBlock.url}`;
|
|
707
|
+
return imageBlock.url;
|
|
715
708
|
}
|
|
716
709
|
}
|
|
717
710
|
if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
|
|
718
|
-
|
|
719
|
-
if (isExternalUrl(url)) {
|
|
720
|
-
return url;
|
|
721
|
-
}
|
|
722
|
-
return `${storageUrl}/${url}`;
|
|
711
|
+
return imageBlock.resolutions.original.url;
|
|
723
712
|
}
|
|
724
713
|
return null;
|
|
725
714
|
};
|
|
@@ -764,7 +753,7 @@ var createCmsApi = (apiConfig) => {
|
|
|
764
753
|
},
|
|
765
754
|
getImage(key) {
|
|
766
755
|
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
767
|
-
return getImageUrl(block, true
|
|
756
|
+
return getImageUrl(block, true);
|
|
768
757
|
}
|
|
769
758
|
};
|
|
770
759
|
},
|
|
@@ -1525,7 +1514,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1525
1514
|
}
|
|
1526
1515
|
|
|
1527
1516
|
// src/index.ts
|
|
1528
|
-
var SDK_VERSION = "0.3.
|
|
1517
|
+
var SDK_VERSION = "0.3.63";
|
|
1529
1518
|
var SUPPORTED_FRAMEWORKS = [
|
|
1530
1519
|
"astro",
|
|
1531
1520
|
"react",
|
|
@@ -1539,11 +1528,9 @@ function createArkySDK(config) {
|
|
|
1539
1528
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1540
1529
|
);
|
|
1541
1530
|
const httpClient = createHttpClient(config);
|
|
1542
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1543
1531
|
const apiConfig = {
|
|
1544
1532
|
httpClient,
|
|
1545
1533
|
businessId: config.businessId,
|
|
1546
|
-
storageUrl,
|
|
1547
1534
|
baseUrl: config.baseUrl,
|
|
1548
1535
|
market: config.market,
|
|
1549
1536
|
locale,
|
|
@@ -1580,7 +1567,7 @@ function createArkySDK(config) {
|
|
|
1580
1567
|
setToken: config.setToken,
|
|
1581
1568
|
utils: {
|
|
1582
1569
|
// Block utilities
|
|
1583
|
-
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock
|
|
1570
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
1584
1571
|
getBlockValue,
|
|
1585
1572
|
getBlockValues,
|
|
1586
1573
|
getBlockLabel,
|