arky-sdk 0.3.31 → 0.3.33
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 +221 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +221 -181
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +34 -1
- package/dist/types.d.ts +34 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -375,7 +375,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
375
375
|
return {
|
|
376
376
|
async uploadBusinessMedia(params, options) {
|
|
377
377
|
const { files = [], urls = [] } = params;
|
|
378
|
-
const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/
|
|
378
|
+
const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
|
|
379
379
|
const formData = new FormData();
|
|
380
380
|
files.forEach((file) => formData.append("files", file));
|
|
381
381
|
urls.forEach((url2) => formData.append("files", url2));
|
|
@@ -395,11 +395,8 @@ var createMediaApi = (apiConfig) => {
|
|
|
395
395
|
async deleteBusinessMedia(params, options) {
|
|
396
396
|
const { id, mediaId } = params;
|
|
397
397
|
return apiConfig.httpClient.delete(
|
|
398
|
-
`/v1/businesses/${id}/
|
|
399
|
-
|
|
400
|
-
...options,
|
|
401
|
-
params: { mediaId }
|
|
402
|
-
}
|
|
398
|
+
`/v1/businesses/${id}/media/${mediaId}`,
|
|
399
|
+
options
|
|
403
400
|
);
|
|
404
401
|
},
|
|
405
402
|
async getBusinessMedia(params, options) {
|
|
@@ -414,6 +411,14 @@ var createMediaApi = (apiConfig) => {
|
|
|
414
411
|
throw new Error(errorData?.message || "Failed to fetch media");
|
|
415
412
|
}
|
|
416
413
|
return await response.json();
|
|
414
|
+
},
|
|
415
|
+
async updateMedia(params, options) {
|
|
416
|
+
const { mediaId, ...updateData } = params;
|
|
417
|
+
return apiConfig.httpClient.put(
|
|
418
|
+
`/v1/businesses/${apiConfig.businessId}/media/${mediaId}`,
|
|
419
|
+
updateData,
|
|
420
|
+
options
|
|
421
|
+
);
|
|
417
422
|
}
|
|
418
423
|
};
|
|
419
424
|
};
|
|
@@ -532,6 +537,178 @@ var formatIdOrSlug = (id, apiConfig) => {
|
|
|
532
537
|
return `${apiConfig.businessId}:${apiConfig.locale}:${id}`;
|
|
533
538
|
};
|
|
534
539
|
|
|
540
|
+
// src/utils/blocks.ts
|
|
541
|
+
function getBlockLabel(block, locale = "en") {
|
|
542
|
+
if (!block) return "";
|
|
543
|
+
if (block.properties?.label) {
|
|
544
|
+
if (typeof block.properties.label === "object") {
|
|
545
|
+
return block.properties.label[locale] || block.properties.label.en || Object.values(block.properties.label)[0] || "";
|
|
546
|
+
}
|
|
547
|
+
if (typeof block.properties.label === "string") {
|
|
548
|
+
return block.properties.label;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) || "";
|
|
552
|
+
}
|
|
553
|
+
function formatBlockValue(block) {
|
|
554
|
+
if (!block || block.value === null || block.value === void 0) {
|
|
555
|
+
return "";
|
|
556
|
+
}
|
|
557
|
+
switch (block.type) {
|
|
558
|
+
case "BOOLEAN":
|
|
559
|
+
return block.value ? "Yes" : "No";
|
|
560
|
+
case "NUMBER":
|
|
561
|
+
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
562
|
+
try {
|
|
563
|
+
return new Date(block.value).toLocaleDateString();
|
|
564
|
+
} catch (e) {
|
|
565
|
+
return String(block.value);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return String(block.value);
|
|
569
|
+
case "RELATIONSHIP":
|
|
570
|
+
if (Array.isArray(block.value) && block.value.length > 0) {
|
|
571
|
+
const firstValue = block.value[0];
|
|
572
|
+
if (firstValue && firstValue.mimeType) {
|
|
573
|
+
return firstValue.name || firstValue.id || "Media";
|
|
574
|
+
}
|
|
575
|
+
return firstValue.title || firstValue.name || firstValue.id || "Entry";
|
|
576
|
+
}
|
|
577
|
+
return String(block.value);
|
|
578
|
+
default:
|
|
579
|
+
return String(block.value);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function prepareBlocksForSubmission(formData) {
|
|
583
|
+
const preparedBlocks = [];
|
|
584
|
+
Object.keys(formData).forEach((key) => {
|
|
585
|
+
if (formData[key] !== null && formData[key] !== void 0) {
|
|
586
|
+
preparedBlocks.push({
|
|
587
|
+
key,
|
|
588
|
+
value: [formData[key]]
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
return preparedBlocks;
|
|
593
|
+
}
|
|
594
|
+
function extractBlockValues(blocks) {
|
|
595
|
+
const values = {};
|
|
596
|
+
blocks.forEach((block) => {
|
|
597
|
+
if (block.value && block.value.length > 0) {
|
|
598
|
+
values[block.key] = block.value[0];
|
|
599
|
+
} else {
|
|
600
|
+
values[block.key] = null;
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
return values;
|
|
604
|
+
}
|
|
605
|
+
function getBlockTextValue(block, locale = "en") {
|
|
606
|
+
if (!block || !block.value || block.value.length === 0) return "";
|
|
607
|
+
const firstValue = block.value[0];
|
|
608
|
+
if (typeof firstValue === "object" && firstValue !== null) {
|
|
609
|
+
if (firstValue[locale]) return firstValue[locale];
|
|
610
|
+
if (firstValue.en) return firstValue.en;
|
|
611
|
+
const values = Object.values(firstValue);
|
|
612
|
+
return String(values[0] || "");
|
|
613
|
+
}
|
|
614
|
+
return String(firstValue);
|
|
615
|
+
}
|
|
616
|
+
var getBlockValue = (entry, blockKey) => {
|
|
617
|
+
if (!entry || !entry.blocks) return null;
|
|
618
|
+
const block = entry.blocks.find((f) => f.key === blockKey);
|
|
619
|
+
if (!block || !block.value || block.value.length === 0) return null;
|
|
620
|
+
return block.value[0];
|
|
621
|
+
};
|
|
622
|
+
var getBlockValues = (entry, blockKey) => {
|
|
623
|
+
if (!entry || !entry.blocks) return null;
|
|
624
|
+
const block = entry.blocks.find((f) => f.key === blockKey);
|
|
625
|
+
if (!block || !block.value || block.value.length === 0) return null;
|
|
626
|
+
return block.value;
|
|
627
|
+
};
|
|
628
|
+
function unwrapBlock(block, locale) {
|
|
629
|
+
if (!block?.type || block.value === void 0) return block;
|
|
630
|
+
if (block.type === "BLOCK") {
|
|
631
|
+
return block.value.map((obj) => {
|
|
632
|
+
const parsed = {};
|
|
633
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
634
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
635
|
+
}
|
|
636
|
+
return parsed;
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
const isLocalized = block.type === "TEXT";
|
|
640
|
+
const isList = block.properties?.ui === "list" || (block.properties?.maxValues ?? 1) > 1 || block.value.length > 1;
|
|
641
|
+
if (isList) {
|
|
642
|
+
return isLocalized ? block.value.map((v) => v[locale] || v["en"]) : [...block.value];
|
|
643
|
+
}
|
|
644
|
+
return isLocalized ? block.value[0][locale] || block.value[0]["en"] : block.value[0];
|
|
645
|
+
}
|
|
646
|
+
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
647
|
+
if (!entry) {
|
|
648
|
+
return [];
|
|
649
|
+
}
|
|
650
|
+
const values = getBlockValues(entry, blockKey);
|
|
651
|
+
const parsed = values.map((obj) => {
|
|
652
|
+
const res = obj.value.reduce((acc, current) => {
|
|
653
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
654
|
+
return acc;
|
|
655
|
+
}, {});
|
|
656
|
+
return res;
|
|
657
|
+
});
|
|
658
|
+
return parsed;
|
|
659
|
+
};
|
|
660
|
+
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
661
|
+
if (!entry) {
|
|
662
|
+
return [];
|
|
663
|
+
}
|
|
664
|
+
const values = getBlockValues(entry, blockKey);
|
|
665
|
+
return values.reduce((acc, current) => {
|
|
666
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
667
|
+
return acc;
|
|
668
|
+
});
|
|
669
|
+
};
|
|
670
|
+
var getImageUrl = (imageBlock, isBlock = true, storageUrl = "https://storage.arky.io/dev") => {
|
|
671
|
+
if (!imageBlock) return null;
|
|
672
|
+
const isExternalUrl = (url) => {
|
|
673
|
+
return url.startsWith("http://") || url.startsWith("https://");
|
|
674
|
+
};
|
|
675
|
+
if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
|
|
676
|
+
const mediaValue = imageBlock.value[0];
|
|
677
|
+
if (mediaValue && mediaValue.mimeType) {
|
|
678
|
+
if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
|
|
679
|
+
const url = mediaValue.resolutions.original.url;
|
|
680
|
+
return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
|
|
681
|
+
}
|
|
682
|
+
if (mediaValue.url) {
|
|
683
|
+
return isExternalUrl(mediaValue.url) ? mediaValue.url : `${storageUrl}/${mediaValue.url}`;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
if (isBlock) {
|
|
689
|
+
if (typeof imageBlock === "string") {
|
|
690
|
+
if (isExternalUrl(imageBlock)) {
|
|
691
|
+
return imageBlock;
|
|
692
|
+
}
|
|
693
|
+
return `${storageUrl}/${imageBlock}`;
|
|
694
|
+
}
|
|
695
|
+
if (imageBlock.url) {
|
|
696
|
+
if (isExternalUrl(imageBlock.url)) {
|
|
697
|
+
return imageBlock.url;
|
|
698
|
+
}
|
|
699
|
+
return `${storageUrl}/${imageBlock.url}`;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
|
|
703
|
+
const url = imageBlock.resolutions.original.url;
|
|
704
|
+
if (isExternalUrl(url)) {
|
|
705
|
+
return url;
|
|
706
|
+
}
|
|
707
|
+
return `${storageUrl}/${url}`;
|
|
708
|
+
}
|
|
709
|
+
return null;
|
|
710
|
+
};
|
|
711
|
+
|
|
535
712
|
// src/api/cms.ts
|
|
536
713
|
var createCmsApi = (apiConfig) => {
|
|
537
714
|
return {
|
|
@@ -558,10 +735,23 @@ var createCmsApi = (apiConfig) => {
|
|
|
558
735
|
},
|
|
559
736
|
async getCollection(params, options) {
|
|
560
737
|
const formattedId = formatIdOrSlug(params.id, apiConfig);
|
|
561
|
-
|
|
738
|
+
const response = await apiConfig.httpClient.get(
|
|
562
739
|
`/v1/businesses/${apiConfig.businessId}/collections/${formattedId}`,
|
|
563
740
|
options
|
|
564
741
|
);
|
|
742
|
+
return {
|
|
743
|
+
...response,
|
|
744
|
+
getBlock(key) {
|
|
745
|
+
return getBlockFromArray(response, key, apiConfig.locale);
|
|
746
|
+
},
|
|
747
|
+
getBlockValues(key) {
|
|
748
|
+
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
749
|
+
},
|
|
750
|
+
getImage(key) {
|
|
751
|
+
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
752
|
+
return getImageUrl(block, true, apiConfig.storageUrl);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
565
755
|
},
|
|
566
756
|
async getCollections(params, options) {
|
|
567
757
|
return apiConfig.httpClient.get(
|
|
@@ -705,10 +895,21 @@ var createEshopApi = (apiConfig) => {
|
|
|
705
895
|
},
|
|
706
896
|
async getProduct(params, options) {
|
|
707
897
|
const formattedId = formatIdOrSlug(params.id, apiConfig);
|
|
708
|
-
|
|
898
|
+
const response = await apiConfig.httpClient.get(
|
|
709
899
|
`/v1/businesses/${apiConfig.businessId}/products/${formattedId}`,
|
|
710
900
|
options
|
|
711
901
|
);
|
|
902
|
+
return {
|
|
903
|
+
...response,
|
|
904
|
+
getName() {
|
|
905
|
+
const locale = apiConfig.locale;
|
|
906
|
+
return response.name?.[locale] || response.name?.en || response.name || "";
|
|
907
|
+
},
|
|
908
|
+
getDescription() {
|
|
909
|
+
const locale = apiConfig.locale;
|
|
910
|
+
return response.description?.[locale] || response.description?.en || response.description || "";
|
|
911
|
+
}
|
|
912
|
+
};
|
|
712
913
|
},
|
|
713
914
|
async getProducts(params, options) {
|
|
714
915
|
return apiConfig.httpClient.get(
|
|
@@ -905,10 +1106,21 @@ var createReservationApi = (apiConfig) => {
|
|
|
905
1106
|
},
|
|
906
1107
|
async getService(params, options) {
|
|
907
1108
|
const formattedId = formatIdOrSlug(params.id, apiConfig);
|
|
908
|
-
|
|
1109
|
+
const response = await apiConfig.httpClient.get(
|
|
909
1110
|
`/v1/businesses/${apiConfig.businessId}/services/${formattedId}`,
|
|
910
1111
|
options
|
|
911
1112
|
);
|
|
1113
|
+
return {
|
|
1114
|
+
...response,
|
|
1115
|
+
getName() {
|
|
1116
|
+
const locale = apiConfig.locale;
|
|
1117
|
+
return response.name?.[locale] || response.name?.en || response.name || "";
|
|
1118
|
+
},
|
|
1119
|
+
getDescription() {
|
|
1120
|
+
const locale = apiConfig.locale;
|
|
1121
|
+
return response.description?.[locale] || response.description?.en || response.description || "";
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
912
1124
|
},
|
|
913
1125
|
async getServices(params, options) {
|
|
914
1126
|
return apiConfig.httpClient.get(
|
|
@@ -1002,178 +1214,6 @@ var createPaymentApi = (apiConfig) => {
|
|
|
1002
1214
|
};
|
|
1003
1215
|
};
|
|
1004
1216
|
|
|
1005
|
-
// src/utils/blocks.ts
|
|
1006
|
-
function getBlockLabel(block, locale = "en") {
|
|
1007
|
-
if (!block) return "";
|
|
1008
|
-
if (block.properties?.label) {
|
|
1009
|
-
if (typeof block.properties.label === "object") {
|
|
1010
|
-
return block.properties.label[locale] || block.properties.label.en || Object.values(block.properties.label)[0] || "";
|
|
1011
|
-
}
|
|
1012
|
-
if (typeof block.properties.label === "string") {
|
|
1013
|
-
return block.properties.label;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) || "";
|
|
1017
|
-
}
|
|
1018
|
-
function formatBlockValue(block) {
|
|
1019
|
-
if (!block || block.value === null || block.value === void 0) {
|
|
1020
|
-
return "";
|
|
1021
|
-
}
|
|
1022
|
-
switch (block.type) {
|
|
1023
|
-
case "BOOLEAN":
|
|
1024
|
-
return block.value ? "Yes" : "No";
|
|
1025
|
-
case "NUMBER":
|
|
1026
|
-
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
1027
|
-
try {
|
|
1028
|
-
return new Date(block.value).toLocaleDateString();
|
|
1029
|
-
} catch (e) {
|
|
1030
|
-
return String(block.value);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
return String(block.value);
|
|
1034
|
-
case "RELATIONSHIP":
|
|
1035
|
-
if (Array.isArray(block.value) && block.value.length > 0) {
|
|
1036
|
-
const firstValue = block.value[0];
|
|
1037
|
-
if (firstValue && firstValue.mimeType) {
|
|
1038
|
-
return firstValue.name || firstValue.id || "Media";
|
|
1039
|
-
}
|
|
1040
|
-
return firstValue.title || firstValue.name || firstValue.id || "Entry";
|
|
1041
|
-
}
|
|
1042
|
-
return String(block.value);
|
|
1043
|
-
default:
|
|
1044
|
-
return String(block.value);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
function prepareBlocksForSubmission(formData) {
|
|
1048
|
-
const preparedBlocks = [];
|
|
1049
|
-
Object.keys(formData).forEach((key) => {
|
|
1050
|
-
if (formData[key] !== null && formData[key] !== void 0) {
|
|
1051
|
-
preparedBlocks.push({
|
|
1052
|
-
key,
|
|
1053
|
-
value: [formData[key]]
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
return preparedBlocks;
|
|
1058
|
-
}
|
|
1059
|
-
function extractBlockValues(blocks) {
|
|
1060
|
-
const values = {};
|
|
1061
|
-
blocks.forEach((block) => {
|
|
1062
|
-
if (block.value && block.value.length > 0) {
|
|
1063
|
-
values[block.key] = block.value[0];
|
|
1064
|
-
} else {
|
|
1065
|
-
values[block.key] = null;
|
|
1066
|
-
}
|
|
1067
|
-
});
|
|
1068
|
-
return values;
|
|
1069
|
-
}
|
|
1070
|
-
function getBlockTextValue(block, locale = "en") {
|
|
1071
|
-
if (!block || !block.value || block.value.length === 0) return "";
|
|
1072
|
-
const firstValue = block.value[0];
|
|
1073
|
-
if (typeof firstValue === "object" && firstValue !== null) {
|
|
1074
|
-
if (firstValue[locale]) return firstValue[locale];
|
|
1075
|
-
if (firstValue.en) return firstValue.en;
|
|
1076
|
-
const values = Object.values(firstValue);
|
|
1077
|
-
return String(values[0] || "");
|
|
1078
|
-
}
|
|
1079
|
-
return String(firstValue);
|
|
1080
|
-
}
|
|
1081
|
-
var getBlockValue = (entry, blockKey) => {
|
|
1082
|
-
if (!entry || !entry.blocks) return null;
|
|
1083
|
-
const block = entry.blocks.find((f) => f.key === blockKey);
|
|
1084
|
-
if (!block || !block.value || block.value.length === 0) return null;
|
|
1085
|
-
return block.value[0];
|
|
1086
|
-
};
|
|
1087
|
-
var getBlockValues = (entry, blockKey) => {
|
|
1088
|
-
if (!entry || !entry.blocks) return null;
|
|
1089
|
-
const block = entry.blocks.find((f) => f.key === blockKey);
|
|
1090
|
-
if (!block || !block.value || block.value.length === 0) return null;
|
|
1091
|
-
return block.value;
|
|
1092
|
-
};
|
|
1093
|
-
function unwrapBlock(block, locale) {
|
|
1094
|
-
if (!block?.type || block.value === void 0) return block;
|
|
1095
|
-
if (block.type === "BLOCK") {
|
|
1096
|
-
return block.value.map((obj) => {
|
|
1097
|
-
const parsed = {};
|
|
1098
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
1099
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
1100
|
-
}
|
|
1101
|
-
return parsed;
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
const isLocalized = block.type === "TEXT";
|
|
1105
|
-
const isList = block.properties?.ui === "list" || (block.properties?.maxValues ?? 1) > 1 || block.value.length > 1;
|
|
1106
|
-
if (isList) {
|
|
1107
|
-
return isLocalized ? block.value.map((v) => v[locale] || v["en"]) : [...block.value];
|
|
1108
|
-
}
|
|
1109
|
-
return isLocalized ? block.value[0][locale] || block.value[0]["en"] : block.value[0];
|
|
1110
|
-
}
|
|
1111
|
-
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
1112
|
-
if (!entry) {
|
|
1113
|
-
return [];
|
|
1114
|
-
}
|
|
1115
|
-
const values = getBlockValues(entry, blockKey);
|
|
1116
|
-
const parsed = values.map((obj) => {
|
|
1117
|
-
const res = obj.value.reduce((acc, current) => {
|
|
1118
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
1119
|
-
return acc;
|
|
1120
|
-
}, {});
|
|
1121
|
-
return res;
|
|
1122
|
-
});
|
|
1123
|
-
return parsed;
|
|
1124
|
-
};
|
|
1125
|
-
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
1126
|
-
if (!entry) {
|
|
1127
|
-
return [];
|
|
1128
|
-
}
|
|
1129
|
-
const values = getBlockValues(entry, blockKey);
|
|
1130
|
-
return values.reduce((acc, current) => {
|
|
1131
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
1132
|
-
return acc;
|
|
1133
|
-
});
|
|
1134
|
-
};
|
|
1135
|
-
var getImageUrl = (imageBlock, isBlock = true, storageUrl = "https://storage.arky.io/dev") => {
|
|
1136
|
-
if (!imageBlock) return null;
|
|
1137
|
-
const isExternalUrl = (url) => {
|
|
1138
|
-
return url.startsWith("http://") || url.startsWith("https://");
|
|
1139
|
-
};
|
|
1140
|
-
if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
|
|
1141
|
-
const mediaValue = imageBlock.value[0];
|
|
1142
|
-
if (mediaValue && mediaValue.mimeType) {
|
|
1143
|
-
if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
|
|
1144
|
-
const url = mediaValue.resolutions.original.url;
|
|
1145
|
-
return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
|
|
1146
|
-
}
|
|
1147
|
-
if (mediaValue.url) {
|
|
1148
|
-
return isExternalUrl(mediaValue.url) ? mediaValue.url : `${storageUrl}/${mediaValue.url}`;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return null;
|
|
1152
|
-
}
|
|
1153
|
-
if (isBlock) {
|
|
1154
|
-
if (typeof imageBlock === "string") {
|
|
1155
|
-
if (isExternalUrl(imageBlock)) {
|
|
1156
|
-
return imageBlock;
|
|
1157
|
-
}
|
|
1158
|
-
return `${storageUrl}/${imageBlock}`;
|
|
1159
|
-
}
|
|
1160
|
-
if (imageBlock.url) {
|
|
1161
|
-
if (isExternalUrl(imageBlock.url)) {
|
|
1162
|
-
return imageBlock.url;
|
|
1163
|
-
}
|
|
1164
|
-
return `${storageUrl}/${imageBlock.url}`;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
|
|
1168
|
-
const url = imageBlock.resolutions.original.url;
|
|
1169
|
-
if (isExternalUrl(url)) {
|
|
1170
|
-
return url;
|
|
1171
|
-
}
|
|
1172
|
-
return `${storageUrl}/${url}`;
|
|
1173
|
-
}
|
|
1174
|
-
return null;
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
1217
|
// src/utils/currency.ts
|
|
1178
1218
|
function getCurrencySymbol(currency) {
|
|
1179
1219
|
const currencySymbols = {
|