@esolve/ng-esolve-connect 0.15.1 → 0.15.2
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/esm2020/lib/stock/esolve-additional-stock-image-record.interface.mjs +2 -0
- package/esm2020/lib/stock/esolve-additional-stock-image.model.mjs +21 -0
- package/esm2020/lib/stock/esolve-media-stock-item-list.type.mjs +2 -0
- package/esm2020/lib/stock/esolve-media-stock-item-options.interface.mjs +2 -0
- package/esm2020/lib/stock/esolve-media-stock-item-record.interface.mjs +2 -0
- package/esm2020/lib/stock/esolve-media-stock-item.model.mjs +7 -0
- package/esm2020/lib/stock/esolve-stock-image-collection-record.interface.mjs +3 -0
- package/esm2020/lib/stock/esolve-stock-image-collection.model.mjs +26 -0
- package/esm2020/lib/stock/esolve-stock-image-size.type.mjs +2 -0
- package/esm2020/lib/stock/esolve-stock-image.model.mjs +45 -0
- package/esm2020/lib/stock/esolve-stock-item-base.model.mjs +1 -1
- package/esm2020/lib/stock/esolve-stock-item-list.model.mjs +1 -1
- package/esm2020/lib/stock/esolve-stock.service.mjs +77 -6
- package/esm2020/lib/stock/index.mjs +12 -1
- package/fesm2015/esolve-ng-esolve-connect.mjs +176 -7
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +173 -7
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/stock/esolve-additional-stock-image-record.interface.d.ts +8 -0
- package/lib/stock/esolve-additional-stock-image.model.d.ts +10 -0
- package/lib/stock/esolve-media-stock-item-list.type.d.ts +7 -0
- package/lib/stock/esolve-media-stock-item-options.interface.d.ts +10 -0
- package/lib/stock/esolve-media-stock-item-record.interface.d.ts +4 -0
- package/lib/stock/esolve-media-stock-item.model.d.ts +6 -0
- package/lib/stock/esolve-stock-image-collection-record.interface.d.ts +6 -0
- package/lib/stock/esolve-stock-image-collection.model.d.ts +9 -0
- package/lib/stock/esolve-stock-image-size.type.d.ts +1 -0
- package/lib/stock/esolve-stock-image.model.d.ts +26 -0
- package/lib/stock/esolve-stock-item-base.model.d.ts +2 -1
- package/lib/stock/esolve-stock.service.d.ts +21 -0
- package/lib/stock/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -2808,6 +2808,106 @@ class EsolveLinkedStockItem extends EsolveStockItemBase {
|
|
|
2808
2808
|
}
|
|
2809
2809
|
}
|
|
2810
2810
|
|
|
2811
|
+
class EsolveMediaStockItem extends EsolveStockItemBase {
|
|
2812
|
+
constructor(record) {
|
|
2813
|
+
super(record);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
class EsolveStockImage {
|
|
2818
|
+
constructor(image_name) {
|
|
2819
|
+
this.image_name = image_name;
|
|
2820
|
+
if (this.image_name === 'no_image.jpg') {
|
|
2821
|
+
this.image_name = '';
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
/**
|
|
2825
|
+
* Path to tiny stock image
|
|
2826
|
+
*/
|
|
2827
|
+
get tiny_src() {
|
|
2828
|
+
return this.getImagePath('tiny');
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Path to thumbnail stock image
|
|
2832
|
+
*/
|
|
2833
|
+
get thumbnail_src() {
|
|
2834
|
+
return this.getImagePath('thumb');
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* Path to small stock image
|
|
2838
|
+
*/
|
|
2839
|
+
get small_src() {
|
|
2840
|
+
return this.getImagePath('small');
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Path to big stock image
|
|
2844
|
+
*/
|
|
2845
|
+
get big_src() {
|
|
2846
|
+
return this.getImagePath('big');
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Path to original stock image
|
|
2850
|
+
*/
|
|
2851
|
+
get original_src() {
|
|
2852
|
+
return this.getImagePath('original');
|
|
2853
|
+
}
|
|
2854
|
+
getImagePath(image_size) {
|
|
2855
|
+
if (this.image_name !== '') {
|
|
2856
|
+
return `/images/stock/${image_size}/${this.image_name}`;
|
|
2857
|
+
}
|
|
2858
|
+
return '';
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
class EsolveAdditionalStockImage {
|
|
2863
|
+
constructor(record) {
|
|
2864
|
+
var _a, _b, _c, _d;
|
|
2865
|
+
this.id = 0;
|
|
2866
|
+
this.type = '';
|
|
2867
|
+
this.url = '';
|
|
2868
|
+
this.name = '';
|
|
2869
|
+
if (record) {
|
|
2870
|
+
this.id = (_a = record.id) !== null && _a !== void 0 ? _a : 0;
|
|
2871
|
+
this.type = (_b = record.type) !== null && _b !== void 0 ? _b : '';
|
|
2872
|
+
this.url = (_c = record.url) !== null && _c !== void 0 ? _c : '';
|
|
2873
|
+
this.name = (_d = record.name) !== null && _d !== void 0 ? _d : '';
|
|
2874
|
+
if (record.etag) {
|
|
2875
|
+
this.etag = record.etag;
|
|
2876
|
+
}
|
|
2877
|
+
if (record.key) {
|
|
2878
|
+
this.key = record.key;
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
class EsolveStockImageCollection {
|
|
2885
|
+
constructor(record) {
|
|
2886
|
+
var _a;
|
|
2887
|
+
this.alt_images = [];
|
|
2888
|
+
this.additional_images = [];
|
|
2889
|
+
this.default_image = new EsolveStockImage((_a = record === null || record === void 0 ? void 0 : record.default_image) !== null && _a !== void 0 ? _a : '');
|
|
2890
|
+
if (!record) {
|
|
2891
|
+
return;
|
|
2892
|
+
}
|
|
2893
|
+
if (record.alt_images && record.alt_images.length > 0) {
|
|
2894
|
+
for (const alt_image_name of record.alt_images) {
|
|
2895
|
+
const alt_image = new EsolveStockImage(alt_image_name);
|
|
2896
|
+
this.alt_images.push(alt_image);
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
if (record.additional_images && record.additional_images.length > 0) {
|
|
2900
|
+
for (const additional_image_record of record.additional_images) {
|
|
2901
|
+
const additional_image = new EsolveAdditionalStockImage(additional_image_record);
|
|
2902
|
+
this.additional_images.push(additional_image);
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
;
|
|
2908
|
+
|
|
2909
|
+
;
|
|
2910
|
+
|
|
2811
2911
|
class EsolveStockService {
|
|
2812
2912
|
constructor(config, http) {
|
|
2813
2913
|
this.config = config;
|
|
@@ -2825,7 +2925,8 @@ class EsolveStockService {
|
|
|
2825
2925
|
}
|
|
2826
2926
|
});
|
|
2827
2927
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2828
|
-
if ((response.records === undefined) ||
|
|
2928
|
+
if ((response.records === undefined) ||
|
|
2929
|
+
(response.records.length <= 0)) {
|
|
2829
2930
|
throw response;
|
|
2830
2931
|
}
|
|
2831
2932
|
const stockRecord = response.records[0];
|
|
@@ -2844,7 +2945,8 @@ class EsolveStockService {
|
|
|
2844
2945
|
}
|
|
2845
2946
|
});
|
|
2846
2947
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2847
|
-
if ((response.records === undefined) ||
|
|
2948
|
+
if ((response.records === undefined) ||
|
|
2949
|
+
(response.records.length <= 0)) {
|
|
2848
2950
|
throw response;
|
|
2849
2951
|
}
|
|
2850
2952
|
const stockRecord = response.records[0];
|
|
@@ -2900,7 +3002,8 @@ class EsolveStockService {
|
|
|
2900
3002
|
}
|
|
2901
3003
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2902
3004
|
var _a;
|
|
2903
|
-
if ((response.records === undefined) ||
|
|
3005
|
+
if ((response.records === undefined) ||
|
|
3006
|
+
(response.records.length <= 0)) {
|
|
2904
3007
|
throw response;
|
|
2905
3008
|
}
|
|
2906
3009
|
const stockItems = [];
|
|
@@ -2919,7 +3022,8 @@ class EsolveStockService {
|
|
|
2919
3022
|
return this.http
|
|
2920
3023
|
.get(`${this.config.api_url}/get-linked-items.php`, { params: { code } })
|
|
2921
3024
|
.pipe(map((response) => {
|
|
2922
|
-
if ((response.records === undefined) ||
|
|
3025
|
+
if ((response.records === undefined) ||
|
|
3026
|
+
(response.records.length <= 0)) {
|
|
2923
3027
|
throw response;
|
|
2924
3028
|
}
|
|
2925
3029
|
return this.processLinkedItems(response.records);
|
|
@@ -2934,12 +3038,63 @@ class EsolveStockService {
|
|
|
2934
3038
|
return this.http
|
|
2935
3039
|
.get(`${this.config.api_url}/get-recipe-items.php`, { params: { code } })
|
|
2936
3040
|
.pipe(map((response) => {
|
|
2937
|
-
if ((response.records === undefined) ||
|
|
3041
|
+
if ((response.records === undefined) ||
|
|
3042
|
+
(response.records.length <= 0)) {
|
|
2938
3043
|
throw response;
|
|
2939
3044
|
}
|
|
2940
3045
|
return this.processRecipeItems(response.records);
|
|
2941
3046
|
}));
|
|
2942
3047
|
}
|
|
3048
|
+
/**
|
|
3049
|
+
* Retrieve list of stock items linked to a stock item from the eSolve API
|
|
3050
|
+
*
|
|
3051
|
+
* @param options Filter options
|
|
3052
|
+
*/
|
|
3053
|
+
getMediaLinkedItems(options) {
|
|
3054
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3055
|
+
let params = new HttpParams({
|
|
3056
|
+
fromObject: {
|
|
3057
|
+
rows: (_a = options.rows) !== null && _a !== void 0 ? _a : 0,
|
|
3058
|
+
page: (_b = options.page) !== null && _b !== void 0 ? _b : 0,
|
|
3059
|
+
ranges_id: (_c = options.ranges_id) !== null && _c !== void 0 ? _c : 0,
|
|
3060
|
+
manufacturers_id: (_d = options.manufacturers_id) !== null && _d !== void 0 ? _d : 0,
|
|
3061
|
+
display_only: (_e = options.display_only) !== null && _e !== void 0 ? _e : false,
|
|
3062
|
+
is_active: (_f = options.is_active) !== null && _f !== void 0 ? _f : true,
|
|
3063
|
+
},
|
|
3064
|
+
});
|
|
3065
|
+
if (options.media_identifier) {
|
|
3066
|
+
params = params.append('media_identifier', options.media_identifier);
|
|
3067
|
+
}
|
|
3068
|
+
if (options.media_id) {
|
|
3069
|
+
params = params.append('media_id', options.media_id);
|
|
3070
|
+
}
|
|
3071
|
+
return this.http
|
|
3072
|
+
.get(`${this.config.api_url}/get-media-linked-items.php`, { params })
|
|
3073
|
+
.pipe(map((response) => {
|
|
3074
|
+
if ((response.records === undefined) ||
|
|
3075
|
+
(response.records.length <= 0)) {
|
|
3076
|
+
throw response;
|
|
3077
|
+
}
|
|
3078
|
+
const items = this.processMediaStockItems(response.records);
|
|
3079
|
+
return new EsolveList(items, options.page, options.rows, +response.additional_data.total_records);
|
|
3080
|
+
}));
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Retrieves the full image collection of a stock item
|
|
3084
|
+
*
|
|
3085
|
+
* @param code Stock item code
|
|
3086
|
+
*/
|
|
3087
|
+
getStockImageCollection(code) {
|
|
3088
|
+
return this.http
|
|
3089
|
+
.get(`${this.config.api_url}/get-item-image-collection.php`, { params: { code } })
|
|
3090
|
+
.pipe(map((response) => {
|
|
3091
|
+
if (response.records === undefined) {
|
|
3092
|
+
throw response;
|
|
3093
|
+
}
|
|
3094
|
+
const collection = new EsolveStockImageCollection(response.records);
|
|
3095
|
+
return collection;
|
|
3096
|
+
}));
|
|
3097
|
+
}
|
|
2943
3098
|
/**
|
|
2944
3099
|
* Processes the eSolve stock item record and converts it to an object.
|
|
2945
3100
|
*
|
|
@@ -2976,6 +3131,20 @@ class EsolveStockService {
|
|
|
2976
3131
|
}
|
|
2977
3132
|
return items;
|
|
2978
3133
|
}
|
|
3134
|
+
/**
|
|
3135
|
+
* Processes the linked eSolve stock item records and converts them to objects.
|
|
3136
|
+
*
|
|
3137
|
+
* @param records Linked eSolve stock item records
|
|
3138
|
+
*/
|
|
3139
|
+
processMediaStockItems(records) {
|
|
3140
|
+
const items = [];
|
|
3141
|
+
if (records.length > 0) {
|
|
3142
|
+
for (const record of records) {
|
|
3143
|
+
items.push(new EsolveMediaStockItem(record));
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
return items;
|
|
3147
|
+
}
|
|
2979
3148
|
/**
|
|
2980
3149
|
* Retrieves stock records from HTTP params.
|
|
2981
3150
|
* @param params HTTP client parameters
|
|
@@ -2998,7 +3167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2998
3167
|
}] }, { type: i1$2.HttpClient }];
|
|
2999
3168
|
} });
|
|
3000
3169
|
|
|
3001
|
-
//
|
|
3170
|
+
// Types
|
|
3002
3171
|
|
|
3003
3172
|
class EsolveSpecialImage {
|
|
3004
3173
|
constructor(record) {
|
|
@@ -3925,5 +4094,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3925
4094
|
* Generated bundle index. Do not edit.
|
|
3926
4095
|
*/
|
|
3927
4096
|
|
|
3928
|
-
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHeading, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSpecial, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
4097
|
+
export { EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHeading, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaArticle, EsolveMediaService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSpecial, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
3929
4098
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|