@covet-pics/covet-pics-widget 0.149.4 → 0.149.5
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/cjs/covet-pics-widget.cjs.entry.js +51 -33
- package/dist/cjs/covet-pics-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/covet-pics-widget.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/covet-pics-widget/covet-pics-widget.js +50 -34
- package/dist/collection/components/covet-pics-widget/covet-pics-widget.js.map +1 -1
- package/dist/collection/components/covet-pics-widget/test/covet-pics-widget.spec.js +10 -0
- package/dist/collection/components/covet-pics-widget/test/covet-pics-widget.spec.js.map +1 -1
- package/dist/collection/services/gallery-loader-service.js +3 -0
- package/dist/collection/services/gallery-loader-service.js.map +1 -1
- package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
- package/dist/covet-pics-widget/covet-pics-widget.esm.js.map +1 -1
- package/dist/covet-pics-widget/p-11974417.entry.js +5 -0
- package/dist/covet-pics-widget/p-11974417.entry.js.map +1 -0
- package/dist/covet-pics-widget/p-2a9a7916.system.js +1 -1
- package/dist/covet-pics-widget/p-2a9a7916.system.js.map +1 -1
- package/dist/covet-pics-widget/p-e3329b4d.system.entry.js +5 -0
- package/dist/covet-pics-widget/p-e3329b4d.system.entry.js.map +1 -0
- package/dist/esm/covet-pics-widget.entry.js +51 -33
- package/dist/esm/covet-pics-widget.entry.js.map +1 -1
- package/dist/esm/covet-pics-widget.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/covet-pics-widget.entry.js +1 -1
- package/dist/esm-es5/covet-pics-widget.entry.js.map +1 -1
- package/dist/esm-es5/covet-pics-widget.js +1 -1
- package/dist/esm-es5/covet-pics-widget.js.map +1 -1
- package/dist/esm-es5/loader.js +2 -2
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/types/components/covet-pics-widget/covet-pics-widget.d.ts +7 -5
- package/package.json +1 -1
- package/dist/covet-pics-widget/p-641546b1.entry.js +0 -5
- package/dist/covet-pics-widget/p-641546b1.entry.js.map +0 -1
- package/dist/covet-pics-widget/p-d4dde7d1.system.entry.js +0 -5
- package/dist/covet-pics-widget/p-d4dde7d1.system.entry.js.map +0 -1
|
@@ -98,6 +98,9 @@ class GalleryLoaderService {
|
|
|
98
98
|
url += `?${queryFragments.join("&")}`;
|
|
99
99
|
}
|
|
100
100
|
const response = await fetch(url, this.fetchOptions);
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
throw new Error(`${response.status}`);
|
|
103
|
+
}
|
|
101
104
|
const data = await response.json();
|
|
102
105
|
data.items = this.getItemsWithLocaleLinks(data.items);
|
|
103
106
|
this.data = Object.assign({}, data);
|
|
@@ -948,6 +951,7 @@ const CovetPicsWidget = class {
|
|
|
948
951
|
this.minNumberOfPhotos = undefined;
|
|
949
952
|
this.items = [];
|
|
950
953
|
this.appStore = undefined;
|
|
954
|
+
this.fetchingError = null;
|
|
951
955
|
}
|
|
952
956
|
async sortUpdatedHandler(event) {
|
|
953
957
|
this.loader.resetPagination();
|
|
@@ -1077,41 +1081,50 @@ const CovetPicsWidget = class {
|
|
|
1077
1081
|
}
|
|
1078
1082
|
async loadData() {
|
|
1079
1083
|
this.isLoading = true;
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
this.
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1084
|
+
try {
|
|
1085
|
+
const json = await this.loader.fetchItems();
|
|
1086
|
+
//TODO test set settings after call endpoint use loader
|
|
1087
|
+
this.appStore.dispatch(widgetGalleryIdUpdated(this.loader.galleryId));
|
|
1088
|
+
this.appStore.dispatch(widgetShopIdUpdated(this.loader.shopId));
|
|
1089
|
+
if (this.loader.data.analytics) {
|
|
1090
|
+
this.appStore.dispatch(setAnalytics(this.loader.data.analytics));
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
this.appStore.dispatch(setAnalytics(false));
|
|
1094
|
+
}
|
|
1095
|
+
//TODO test set settings after call endpoint use loader END
|
|
1096
|
+
if (typeof json === "undefined")
|
|
1097
|
+
return false;
|
|
1098
|
+
this.appStore.dispatch(setSettings(json.settings));
|
|
1099
|
+
this.minNumberOfPhotos = json.settings.min_number_of_photos;
|
|
1100
|
+
this.loader.data.settings.display_type === "highlight"
|
|
1101
|
+
? this.items = [...json.items]
|
|
1102
|
+
: this.items = [...this.getItemsWithUpload(json.items)];
|
|
1103
|
+
this.hideElementsIfEmpty();
|
|
1104
|
+
if (!this.fontsLoaded) {
|
|
1105
|
+
this.loadFont();
|
|
1106
|
+
}
|
|
1107
|
+
if (this.hasEnoughPhotos && getters.getUseAnalytics(this.appState)) {
|
|
1108
|
+
const category = "Covet.pics Gallery";
|
|
1109
|
+
const action = "Covet.pics Gallery View";
|
|
1110
|
+
const label = "Covet.pics Gallery View - " + this.galleryEmbedId;
|
|
1111
|
+
utils.sendToGoogleAnalytics(action, category, label);
|
|
1112
|
+
}
|
|
1113
|
+
if (this.hasEnoughPhotos) {
|
|
1114
|
+
storeUtils.sendBeacon(this.appState, "gallery_view");
|
|
1115
|
+
}
|
|
1116
|
+
this.sharedItemId = await this.findAndLoadSharedItemId(); // TODO test ver
|
|
1117
|
+
this.initFilters();
|
|
1118
|
+
this.isLoading = false;
|
|
1119
|
+
return true;
|
|
1107
1120
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1121
|
+
catch (err) {
|
|
1122
|
+
if (err.message === "404") {
|
|
1123
|
+
this.fetchingError = "The Covet.pics gallery embed is missing. Please verify that the correct embed ID is being used.";
|
|
1124
|
+
}
|
|
1125
|
+
this.isLoading = false;
|
|
1126
|
+
return this.fetchingError;
|
|
1110
1127
|
}
|
|
1111
|
-
this.sharedItemId = await this.findAndLoadSharedItemId(); // TODO test ver
|
|
1112
|
-
this.initFilters();
|
|
1113
|
-
this.isLoading = false;
|
|
1114
|
-
return true;
|
|
1115
1128
|
}
|
|
1116
1129
|
async findAndLoadSharedItemId() {
|
|
1117
1130
|
return new Promise(async (resolve) => {
|
|
@@ -1214,7 +1227,12 @@ const CovetPicsWidget = class {
|
|
|
1214
1227
|
renderUploadStandalone() {
|
|
1215
1228
|
return (index.h("covet-pics-upload", { standalone: true, appStore: this.appStore }));
|
|
1216
1229
|
}
|
|
1230
|
+
renderError() {
|
|
1231
|
+
return (index.h(index.Host, null, index.h("p", null, this.fetchingError)));
|
|
1232
|
+
}
|
|
1217
1233
|
render() {
|
|
1234
|
+
if (!this.isLoading && this.fetchingError !== null)
|
|
1235
|
+
return this.renderError();
|
|
1218
1236
|
if (!this.isLoading && this.hasEnoughPhotos) {
|
|
1219
1237
|
const displayType = this.loader.data.settings.display_type;
|
|
1220
1238
|
if (displayType === "upload-standalone")
|