@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
|
@@ -2772,6 +2772,104 @@ class EsolveLinkedStockItem extends EsolveStockItemBase {
|
|
|
2772
2772
|
}
|
|
2773
2773
|
}
|
|
2774
2774
|
|
|
2775
|
+
class EsolveMediaStockItem extends EsolveStockItemBase {
|
|
2776
|
+
constructor(record) {
|
|
2777
|
+
super(record);
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
class EsolveStockImage {
|
|
2782
|
+
constructor(image_name) {
|
|
2783
|
+
this.image_name = image_name;
|
|
2784
|
+
if (this.image_name === 'no_image.jpg') {
|
|
2785
|
+
this.image_name = '';
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Path to tiny stock image
|
|
2790
|
+
*/
|
|
2791
|
+
get tiny_src() {
|
|
2792
|
+
return this.getImagePath('tiny');
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Path to thumbnail stock image
|
|
2796
|
+
*/
|
|
2797
|
+
get thumbnail_src() {
|
|
2798
|
+
return this.getImagePath('thumb');
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Path to small stock image
|
|
2802
|
+
*/
|
|
2803
|
+
get small_src() {
|
|
2804
|
+
return this.getImagePath('small');
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Path to big stock image
|
|
2808
|
+
*/
|
|
2809
|
+
get big_src() {
|
|
2810
|
+
return this.getImagePath('big');
|
|
2811
|
+
}
|
|
2812
|
+
/**
|
|
2813
|
+
* Path to original stock image
|
|
2814
|
+
*/
|
|
2815
|
+
get original_src() {
|
|
2816
|
+
return this.getImagePath('original');
|
|
2817
|
+
}
|
|
2818
|
+
getImagePath(image_size) {
|
|
2819
|
+
if (this.image_name !== '') {
|
|
2820
|
+
return `/images/stock/${image_size}/${this.image_name}`;
|
|
2821
|
+
}
|
|
2822
|
+
return '';
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
class EsolveAdditionalStockImage {
|
|
2827
|
+
constructor(record) {
|
|
2828
|
+
this.id = 0;
|
|
2829
|
+
this.type = '';
|
|
2830
|
+
this.url = '';
|
|
2831
|
+
this.name = '';
|
|
2832
|
+
if (record) {
|
|
2833
|
+
this.id = record.id ?? 0;
|
|
2834
|
+
this.type = record.type ?? '';
|
|
2835
|
+
this.url = record.url ?? '';
|
|
2836
|
+
this.name = record.name ?? '';
|
|
2837
|
+
if (record.etag) {
|
|
2838
|
+
this.etag = record.etag;
|
|
2839
|
+
}
|
|
2840
|
+
if (record.key) {
|
|
2841
|
+
this.key = record.key;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
class EsolveStockImageCollection {
|
|
2848
|
+
constructor(record) {
|
|
2849
|
+
this.alt_images = [];
|
|
2850
|
+
this.additional_images = [];
|
|
2851
|
+
this.default_image = new EsolveStockImage(record?.default_image ?? '');
|
|
2852
|
+
if (!record) {
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2855
|
+
if (record.alt_images && record.alt_images.length > 0) {
|
|
2856
|
+
for (const alt_image_name of record.alt_images) {
|
|
2857
|
+
const alt_image = new EsolveStockImage(alt_image_name);
|
|
2858
|
+
this.alt_images.push(alt_image);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
if (record.additional_images && record.additional_images.length > 0) {
|
|
2862
|
+
for (const additional_image_record of record.additional_images) {
|
|
2863
|
+
const additional_image = new EsolveAdditionalStockImage(additional_image_record);
|
|
2864
|
+
this.additional_images.push(additional_image);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
;
|
|
2870
|
+
|
|
2871
|
+
;
|
|
2872
|
+
|
|
2775
2873
|
class EsolveStockService {
|
|
2776
2874
|
constructor(config, http) {
|
|
2777
2875
|
this.config = config;
|
|
@@ -2789,7 +2887,8 @@ class EsolveStockService {
|
|
|
2789
2887
|
}
|
|
2790
2888
|
});
|
|
2791
2889
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2792
|
-
if ((response.records === undefined) ||
|
|
2890
|
+
if ((response.records === undefined) ||
|
|
2891
|
+
(response.records.length <= 0)) {
|
|
2793
2892
|
throw response;
|
|
2794
2893
|
}
|
|
2795
2894
|
const stockRecord = response.records[0];
|
|
@@ -2808,7 +2907,8 @@ class EsolveStockService {
|
|
|
2808
2907
|
}
|
|
2809
2908
|
});
|
|
2810
2909
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2811
|
-
if ((response.records === undefined) ||
|
|
2910
|
+
if ((response.records === undefined) ||
|
|
2911
|
+
(response.records.length <= 0)) {
|
|
2812
2912
|
throw response;
|
|
2813
2913
|
}
|
|
2814
2914
|
const stockRecord = response.records[0];
|
|
@@ -2863,7 +2963,8 @@ class EsolveStockService {
|
|
|
2863
2963
|
}
|
|
2864
2964
|
}
|
|
2865
2965
|
return this.getStockRecords(params).pipe(map(response => {
|
|
2866
|
-
if ((response.records === undefined) ||
|
|
2966
|
+
if ((response.records === undefined) ||
|
|
2967
|
+
(response.records.length <= 0)) {
|
|
2867
2968
|
throw response;
|
|
2868
2969
|
}
|
|
2869
2970
|
const stockItems = [];
|
|
@@ -2882,7 +2983,8 @@ class EsolveStockService {
|
|
|
2882
2983
|
return this.http
|
|
2883
2984
|
.get(`${this.config.api_url}/get-linked-items.php`, { params: { code } })
|
|
2884
2985
|
.pipe(map((response) => {
|
|
2885
|
-
if ((response.records === undefined) ||
|
|
2986
|
+
if ((response.records === undefined) ||
|
|
2987
|
+
(response.records.length <= 0)) {
|
|
2886
2988
|
throw response;
|
|
2887
2989
|
}
|
|
2888
2990
|
return this.processLinkedItems(response.records);
|
|
@@ -2897,12 +2999,62 @@ class EsolveStockService {
|
|
|
2897
2999
|
return this.http
|
|
2898
3000
|
.get(`${this.config.api_url}/get-recipe-items.php`, { params: { code } })
|
|
2899
3001
|
.pipe(map((response) => {
|
|
2900
|
-
if ((response.records === undefined) ||
|
|
3002
|
+
if ((response.records === undefined) ||
|
|
3003
|
+
(response.records.length <= 0)) {
|
|
2901
3004
|
throw response;
|
|
2902
3005
|
}
|
|
2903
3006
|
return this.processRecipeItems(response.records);
|
|
2904
3007
|
}));
|
|
2905
3008
|
}
|
|
3009
|
+
/**
|
|
3010
|
+
* Retrieve list of stock items linked to a stock item from the eSolve API
|
|
3011
|
+
*
|
|
3012
|
+
* @param options Filter options
|
|
3013
|
+
*/
|
|
3014
|
+
getMediaLinkedItems(options) {
|
|
3015
|
+
let params = new HttpParams({
|
|
3016
|
+
fromObject: {
|
|
3017
|
+
rows: options.rows ?? 0,
|
|
3018
|
+
page: options.page ?? 0,
|
|
3019
|
+
ranges_id: options.ranges_id ?? 0,
|
|
3020
|
+
manufacturers_id: options.manufacturers_id ?? 0,
|
|
3021
|
+
display_only: options.display_only ?? false,
|
|
3022
|
+
is_active: options.is_active ?? true,
|
|
3023
|
+
},
|
|
3024
|
+
});
|
|
3025
|
+
if (options.media_identifier) {
|
|
3026
|
+
params = params.append('media_identifier', options.media_identifier);
|
|
3027
|
+
}
|
|
3028
|
+
if (options.media_id) {
|
|
3029
|
+
params = params.append('media_id', options.media_id);
|
|
3030
|
+
}
|
|
3031
|
+
return this.http
|
|
3032
|
+
.get(`${this.config.api_url}/get-media-linked-items.php`, { params })
|
|
3033
|
+
.pipe(map((response) => {
|
|
3034
|
+
if ((response.records === undefined) ||
|
|
3035
|
+
(response.records.length <= 0)) {
|
|
3036
|
+
throw response;
|
|
3037
|
+
}
|
|
3038
|
+
const items = this.processMediaStockItems(response.records);
|
|
3039
|
+
return new EsolveList(items, options.page, options.rows, +response.additional_data.total_records);
|
|
3040
|
+
}));
|
|
3041
|
+
}
|
|
3042
|
+
/**
|
|
3043
|
+
* Retrieves the full image collection of a stock item
|
|
3044
|
+
*
|
|
3045
|
+
* @param code Stock item code
|
|
3046
|
+
*/
|
|
3047
|
+
getStockImageCollection(code) {
|
|
3048
|
+
return this.http
|
|
3049
|
+
.get(`${this.config.api_url}/get-item-image-collection.php`, { params: { code } })
|
|
3050
|
+
.pipe(map((response) => {
|
|
3051
|
+
if (response.records === undefined) {
|
|
3052
|
+
throw response;
|
|
3053
|
+
}
|
|
3054
|
+
const collection = new EsolveStockImageCollection(response.records);
|
|
3055
|
+
return collection;
|
|
3056
|
+
}));
|
|
3057
|
+
}
|
|
2906
3058
|
/**
|
|
2907
3059
|
* Processes the eSolve stock item record and converts it to an object.
|
|
2908
3060
|
*
|
|
@@ -2939,6 +3091,20 @@ class EsolveStockService {
|
|
|
2939
3091
|
}
|
|
2940
3092
|
return items;
|
|
2941
3093
|
}
|
|
3094
|
+
/**
|
|
3095
|
+
* Processes the linked eSolve stock item records and converts them to objects.
|
|
3096
|
+
*
|
|
3097
|
+
* @param records Linked eSolve stock item records
|
|
3098
|
+
*/
|
|
3099
|
+
processMediaStockItems(records) {
|
|
3100
|
+
const items = [];
|
|
3101
|
+
if (records.length > 0) {
|
|
3102
|
+
for (const record of records) {
|
|
3103
|
+
items.push(new EsolveMediaStockItem(record));
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
return items;
|
|
3107
|
+
}
|
|
2942
3108
|
/**
|
|
2943
3109
|
* Retrieves stock records from HTTP params.
|
|
2944
3110
|
* @param params HTTP client parameters
|
|
@@ -2959,7 +3125,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2959
3125
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2960
3126
|
}] }, { type: i1$2.HttpClient }]; } });
|
|
2961
3127
|
|
|
2962
|
-
//
|
|
3128
|
+
// Types
|
|
2963
3129
|
|
|
2964
3130
|
class EsolveSpecialImage {
|
|
2965
3131
|
constructor(record) {
|
|
@@ -3876,5 +4042,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3876
4042
|
* Generated bundle index. Do not edit.
|
|
3877
4043
|
*/
|
|
3878
4044
|
|
|
3879
|
-
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 };
|
|
4045
|
+
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 };
|
|
3880
4046
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|