arky-sdk 0.3.62 → 0.3.64
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 +46 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +46 -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
|
},
|
|
@@ -1173,6 +1159,42 @@ var createReservationApi = (apiConfig) => {
|
|
|
1173
1159
|
};
|
|
1174
1160
|
};
|
|
1175
1161
|
|
|
1162
|
+
// src/api/database.ts
|
|
1163
|
+
var createDatabaseApi = (apiConfig) => {
|
|
1164
|
+
return {
|
|
1165
|
+
async scanData(params, options) {
|
|
1166
|
+
const response = await apiConfig.httpClient.get(
|
|
1167
|
+
`/v1/operations/data`,
|
|
1168
|
+
{
|
|
1169
|
+
...options,
|
|
1170
|
+
params: {
|
|
1171
|
+
key: params.key
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
);
|
|
1175
|
+
return response.value || [];
|
|
1176
|
+
},
|
|
1177
|
+
async putData(params, options) {
|
|
1178
|
+
return apiConfig.httpClient.post(
|
|
1179
|
+
`/v1/operations/data`,
|
|
1180
|
+
params,
|
|
1181
|
+
options
|
|
1182
|
+
);
|
|
1183
|
+
},
|
|
1184
|
+
async deleteData(params, options) {
|
|
1185
|
+
return apiConfig.httpClient.delete(
|
|
1186
|
+
`/v1/operations/data`,
|
|
1187
|
+
{
|
|
1188
|
+
...options,
|
|
1189
|
+
params: {
|
|
1190
|
+
key: params.key
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1176
1198
|
// src/utils/currency.ts
|
|
1177
1199
|
function getCurrencySymbol(currency) {
|
|
1178
1200
|
const currencySymbols = {
|
|
@@ -1528,7 +1550,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1528
1550
|
}
|
|
1529
1551
|
|
|
1530
1552
|
// src/index.ts
|
|
1531
|
-
var SDK_VERSION = "0.3.
|
|
1553
|
+
var SDK_VERSION = "0.3.64";
|
|
1532
1554
|
var SUPPORTED_FRAMEWORKS = [
|
|
1533
1555
|
"astro",
|
|
1534
1556
|
"react",
|
|
@@ -1542,11 +1564,9 @@ function createArkySDK(config) {
|
|
|
1542
1564
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1543
1565
|
);
|
|
1544
1566
|
const httpClient = createHttpClient(config);
|
|
1545
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1546
1567
|
const apiConfig = {
|
|
1547
1568
|
httpClient,
|
|
1548
1569
|
businessId: config.businessId,
|
|
1549
|
-
storageUrl,
|
|
1550
1570
|
baseUrl: config.baseUrl,
|
|
1551
1571
|
market: config.market,
|
|
1552
1572
|
locale,
|
|
@@ -1566,6 +1586,7 @@ function createArkySDK(config) {
|
|
|
1566
1586
|
cms: createCmsApi(apiConfig),
|
|
1567
1587
|
eshop: createEshopApi(apiConfig),
|
|
1568
1588
|
reservation: createReservationApi(apiConfig),
|
|
1589
|
+
database: createDatabaseApi(apiConfig),
|
|
1569
1590
|
setBusinessId: (businessId) => {
|
|
1570
1591
|
apiConfig.businessId = businessId;
|
|
1571
1592
|
},
|
|
@@ -1583,7 +1604,7 @@ function createArkySDK(config) {
|
|
|
1583
1604
|
setToken: config.setToken,
|
|
1584
1605
|
utils: {
|
|
1585
1606
|
// Block utilities
|
|
1586
|
-
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock
|
|
1607
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
1587
1608
|
getBlockValue,
|
|
1588
1609
|
getBlockValues,
|
|
1589
1610
|
getBlockLabel,
|