@esolve/ng-esolve-connect 0.14.1 → 0.15.0
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/account/esolve-account.service.mjs +3 -3
- package/esm2020/lib/category-tree/esolve-category-record.interface.mjs +1 -1
- package/esm2020/lib/category-tree/esolve-category-tree-item-record.interface.mjs +1 -1
- package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +2 -2
- package/esm2020/lib/category-tree/esolve-subcategory-record.interface.mjs +1 -1
- package/esm2020/lib/enquiry/esolve-enquiry-response.interface.mjs +2 -0
- package/esm2020/lib/enquiry/esolve-enquiry-result.model.mjs +9 -0
- package/esm2020/lib/enquiry/esolve-enquiry.service.mjs +41 -0
- package/esm2020/lib/enquiry/index.mjs +4 -0
- package/esm2020/lib/shared/errors/esolve-error-handler.service.mjs +5 -2
- package/esm2020/lib/shared/errors/index.mjs +3 -0
- package/esm2020/lib/stock/esolve-colour-record.interface.mjs +2 -0
- package/esm2020/lib/stock/esolve-colour.model.mjs +8 -0
- package/esm2020/lib/stock/esolve-stock-base-record.interface.mjs +1 -1
- package/esm2020/lib/stock/esolve-stock-item-base.model.mjs +40 -1
- package/esm2020/lib/stock/index.mjs +14 -9
- package/esm2020/public-api.mjs +4 -3
- package/fesm2015/esolve-ng-esolve-connect.mjs +765 -673
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +765 -676
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +1 -1
- package/lib/category-tree/esolve-category-record.interface.d.ts +1 -1
- package/lib/category-tree/esolve-category-tree-item-record.interface.d.ts +1 -0
- package/lib/category-tree/esolve-subcategory-record.interface.d.ts +1 -1
- package/lib/enquiry/esolve-enquiry-response.interface.d.ts +3 -0
- package/lib/enquiry/esolve-enquiry-result.model.d.ts +6 -0
- package/lib/enquiry/esolve-enquiry.service.d.ts +17 -0
- package/lib/enquiry/index.d.ts +3 -0
- package/lib/shared/errors/esolve-error-handler.service.d.ts +2 -1
- package/lib/shared/errors/index.d.ts +2 -0
- package/lib/stock/esolve-colour-record.interface.d.ts +5 -0
- package/lib/stock/esolve-colour.model.d.ts +7 -0
- package/lib/stock/esolve-stock-base-record.interface.d.ts +9 -0
- package/lib/stock/esolve-stock-item-base.model.d.ts +41 -0
- package/lib/stock/index.d.ts +10 -8
- package/package.json +1 -1
- package/public-api.d.ts +2 -2
|
@@ -381,9 +381,12 @@ class EsolveHttpError {
|
|
|
381
381
|
|
|
382
382
|
class EsolveErrorHandlerService {
|
|
383
383
|
constructor() { }
|
|
384
|
-
|
|
384
|
+
throwError(code, message) {
|
|
385
385
|
throw new EsolveHttpError('error', message, code);
|
|
386
386
|
}
|
|
387
|
+
emitError(code, message) {
|
|
388
|
+
return throwError(new EsolveHttpError('error', message, code));
|
|
389
|
+
}
|
|
387
390
|
handleHttpPostError(service_type, errorRes) {
|
|
388
391
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
389
392
|
!('service_type' in errorRes) &&
|
|
@@ -1538,7 +1541,7 @@ class EsolveAccountService {
|
|
|
1538
1541
|
}
|
|
1539
1542
|
loginGuard() {
|
|
1540
1543
|
if (this.user_id <= 0) {
|
|
1541
|
-
this.errorHandler.
|
|
1544
|
+
this.errorHandler.throwError('login_required', 'Login is required');
|
|
1542
1545
|
}
|
|
1543
1546
|
}
|
|
1544
1547
|
}
|
|
@@ -2102,451 +2105,283 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2102
2105
|
}] }, { type: i1$2.HttpClient }];
|
|
2103
2106
|
} });
|
|
2104
2107
|
|
|
2105
|
-
class
|
|
2106
|
-
constructor(
|
|
2107
|
-
|
|
2108
|
-
this.
|
|
2109
|
-
this.
|
|
2110
|
-
this.
|
|
2111
|
-
this.badge_colour = badge_colour;
|
|
2112
|
-
this.sort_priority = sort_priority;
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
/**
|
|
2117
|
-
* Price of eSolve stock item
|
|
2118
|
-
*/
|
|
2119
|
-
class EsolveStockPrice {
|
|
2120
|
-
/**
|
|
2121
|
-
* Create stock price instance
|
|
2122
|
-
* @param base_price Price without tax
|
|
2123
|
-
* @param base_price_with_tax Price with tax
|
|
2124
|
-
* @param sell_price Price without tax and with discounts applied if applicable
|
|
2125
|
-
* @param sell_price_with_tax Price with tax and with discounts applied if applicable
|
|
2126
|
-
*/
|
|
2127
|
-
constructor(
|
|
2128
|
-
/**
|
|
2129
|
-
* Price without tax
|
|
2130
|
-
*/
|
|
2131
|
-
base_price = 0,
|
|
2132
|
-
/**
|
|
2133
|
-
* Price with tax
|
|
2134
|
-
*/
|
|
2135
|
-
base_price_with_tax = 0,
|
|
2136
|
-
/**
|
|
2137
|
-
* Price without tax and with discounts applied if applicable
|
|
2138
|
-
*/
|
|
2139
|
-
sell_price = 0,
|
|
2140
|
-
/**
|
|
2141
|
-
* Price with tax and with discounts applied if applicable
|
|
2142
|
-
*/
|
|
2143
|
-
sell_price_with_tax = 0) {
|
|
2144
|
-
this.base_price = base_price;
|
|
2145
|
-
this.base_price_with_tax = base_price_with_tax;
|
|
2146
|
-
this.sell_price = sell_price;
|
|
2147
|
-
this.sell_price_with_tax = sell_price_with_tax;
|
|
2148
|
-
if ((this.base_price === 0) && (this.sell_price > 0)) {
|
|
2149
|
-
this.base_price = this.sell_price;
|
|
2150
|
-
this.base_price_with_tax = this.sell_price_with_tax;
|
|
2151
|
-
}
|
|
2152
|
-
else if ((this.base_price > 0) && (this.sell_price === 0)) {
|
|
2153
|
-
this.sell_price = this.base_price;
|
|
2154
|
-
this.sell_price_with_tax = this.base_price_with_tax;
|
|
2155
|
-
}
|
|
2108
|
+
class EsolveColour {
|
|
2109
|
+
constructor(record) {
|
|
2110
|
+
var _a, _b, _c;
|
|
2111
|
+
this.id = (_a = record.id) !== null && _a !== void 0 ? _a : 0;
|
|
2112
|
+
this.colour = (_b = record.colour) !== null && _b !== void 0 ? _b : '';
|
|
2113
|
+
this.description = (_c = record.description) !== null && _c !== void 0 ? _c : '';
|
|
2156
2114
|
}
|
|
2157
2115
|
}
|
|
2158
2116
|
|
|
2159
|
-
class
|
|
2160
|
-
constructor(
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
this.
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
this.
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
this.
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
this.sef_name = '';
|
|
2178
|
-
/**
|
|
2179
|
-
* Short description of stock item
|
|
2180
|
-
*/
|
|
2181
|
-
this.description = '';
|
|
2182
|
-
/**
|
|
2183
|
-
* Full description of stock item
|
|
2184
|
-
*/
|
|
2185
|
-
this.extended_description = '';
|
|
2186
|
-
/**
|
|
2187
|
-
* Active state
|
|
2188
|
-
*/
|
|
2189
|
-
this.active = false;
|
|
2190
|
-
/**
|
|
2191
|
-
* Featured state
|
|
2192
|
-
*/
|
|
2193
|
-
this.featured = false;
|
|
2194
|
-
/**
|
|
2195
|
-
* ID of default category linked to the stock item
|
|
2196
|
-
*/
|
|
2197
|
-
this.category_id = '';
|
|
2198
|
-
/**
|
|
2199
|
-
* ID of default subcategory linked to the stock item
|
|
2200
|
-
*/
|
|
2201
|
-
this.subcategory_id = 0;
|
|
2202
|
-
this.manufacturers_id = 0;
|
|
2203
|
-
this.ranges_id = 0;
|
|
2204
|
-
/**
|
|
2205
|
-
* Linked tags
|
|
2206
|
-
*/
|
|
2207
|
-
this.tags = [];
|
|
2208
|
-
/**
|
|
2209
|
-
* Linked topics
|
|
2210
|
-
*/
|
|
2211
|
-
this.topics = [];
|
|
2212
|
-
/**
|
|
2213
|
-
* Stock badges
|
|
2214
|
-
*/
|
|
2215
|
-
this.badges = [];
|
|
2216
|
-
/**
|
|
2217
|
-
* Image filename
|
|
2218
|
-
*/
|
|
2219
|
-
this.image_name = '';
|
|
2220
|
-
let seo_title = '';
|
|
2221
|
-
let seo_keywords = '';
|
|
2222
|
-
let base_price = 0;
|
|
2223
|
-
let base_price_with_tax = 0;
|
|
2224
|
-
let sell_price = 0;
|
|
2225
|
-
let sell_price_with_tax = 0;
|
|
2226
|
-
if (record) {
|
|
2227
|
-
this.id = +((_a = record.id) !== null && _a !== void 0 ? _a : 0);
|
|
2228
|
-
this.code = (_b = record.code) !== null && _b !== void 0 ? _b : '';
|
|
2229
|
-
this.name = (_c = record.name) !== null && _c !== void 0 ? _c : '';
|
|
2230
|
-
this.sef_name = (_d = record.sef_name) !== null && _d !== void 0 ? _d : '';
|
|
2231
|
-
this.description = (_e = record.description) !== null && _e !== void 0 ? _e : '';
|
|
2232
|
-
this.extended_description = (_f = record.extended_description) !== null && _f !== void 0 ? _f : '';
|
|
2233
|
-
this.image_name = (_g = record.image_name) !== null && _g !== void 0 ? _g : '';
|
|
2234
|
-
this.category_id = (_h = record.category_id) !== null && _h !== void 0 ? _h : '';
|
|
2235
|
-
this.subcategory_id = +((_j = record.subcategory_id) !== null && _j !== void 0 ? _j : 0);
|
|
2236
|
-
this.manufacturers_id = +((_k = record.manufacturers_id) !== null && _k !== void 0 ? _k : 0);
|
|
2237
|
-
this.ranges_id = +((_l = record.ranges_id) !== null && _l !== void 0 ? _l : 0);
|
|
2238
|
-
this.active = !!+((_m = record.is_active) !== null && _m !== void 0 ? _m : false);
|
|
2239
|
-
this.featured = !!+((_o = record.is_featured) !== null && _o !== void 0 ? _o : false);
|
|
2240
|
-
base_price = +((_p = record.regular_sellprice) !== null && _p !== void 0 ? _p : 0);
|
|
2241
|
-
base_price_with_tax = +((_q = record.regular_sellprice_inclusive) !== null && _q !== void 0 ? _q : 0);
|
|
2242
|
-
sell_price = +((_r = record.sellprice) !== null && _r !== void 0 ? _r : 0);
|
|
2243
|
-
sell_price_with_tax = +((_s = record.sellprice_inclusive) !== null && _s !== void 0 ? _s : 0);
|
|
2244
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
2245
|
-
for (const tag of record.tags) {
|
|
2246
|
-
this.tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
2250
|
-
for (const topic of record.topics) {
|
|
2251
|
-
this.topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
if ((record.badges) && (record.badges.length > 0)) {
|
|
2255
|
-
for (const badge of record.badges) {
|
|
2256
|
-
this.badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
if (record.custom_fields) {
|
|
2260
|
-
this.custom_fields = record.custom_fields;
|
|
2117
|
+
class EsolveCategoryTreeItem {
|
|
2118
|
+
constructor(type, esolve_id, parent_id, description, sef_description, short_description, sort_priority, active, display_only, image_name, seo_title, seo_keywords, seo_description, children) {
|
|
2119
|
+
this.type = type;
|
|
2120
|
+
this.esolve_id = esolve_id;
|
|
2121
|
+
this.parent_id = parent_id;
|
|
2122
|
+
this.description = description;
|
|
2123
|
+
this.sef_description = sef_description;
|
|
2124
|
+
this.short_description = short_description;
|
|
2125
|
+
this.sort_priority = sort_priority;
|
|
2126
|
+
this.active = active;
|
|
2127
|
+
this.display_only = display_only;
|
|
2128
|
+
this.image_name = image_name;
|
|
2129
|
+
this.id = '';
|
|
2130
|
+
this.image_path = '';
|
|
2131
|
+
if (this.type === 'category') {
|
|
2132
|
+
this.id = `<<CAT>>${this.esolve_id}`;
|
|
2133
|
+
if (children != null) {
|
|
2134
|
+
this.children = children;
|
|
2261
2135
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2136
|
+
this.image_path = '/images/categories/';
|
|
2137
|
+
}
|
|
2138
|
+
else {
|
|
2139
|
+
this.id = `<<SUB>>${this.esolve_id}`;
|
|
2140
|
+
this.image_path = '/images/subcategories/';
|
|
2264
2141
|
}
|
|
2265
|
-
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax);
|
|
2266
2142
|
if (seo_title.trim() === '') {
|
|
2267
|
-
seo_title = this.
|
|
2143
|
+
seo_title = this.description;
|
|
2268
2144
|
}
|
|
2269
|
-
this.seo_details = new EsolveSeoInfo(seo_title,
|
|
2270
|
-
}
|
|
2271
|
-
/**
|
|
2272
|
-
* Path to tiny stock image
|
|
2273
|
-
*/
|
|
2274
|
-
get tiny_image_src() {
|
|
2275
|
-
return this.getImagePath('tiny');
|
|
2276
|
-
}
|
|
2277
|
-
/**
|
|
2278
|
-
* Path to thumbnail stock image
|
|
2279
|
-
*/
|
|
2280
|
-
get thumbnail_image_src() {
|
|
2281
|
-
return this.getImagePath('thumb');
|
|
2145
|
+
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2282
2146
|
}
|
|
2283
|
-
/**
|
|
2284
|
-
* Path to small stock image
|
|
2285
|
-
*/
|
|
2286
2147
|
get small_image_src() {
|
|
2287
2148
|
return this.getImagePath('small');
|
|
2288
2149
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
*/
|
|
2292
|
-
get big_image_src() {
|
|
2293
|
-
return this.getImagePath('big');
|
|
2150
|
+
get thumbnail_image_src() {
|
|
2151
|
+
return this.getImagePath('thumb');
|
|
2294
2152
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
*/
|
|
2298
|
-
get original_image_src() {
|
|
2299
|
-
return this.getImagePath('original');
|
|
2153
|
+
get tiny_image_src() {
|
|
2154
|
+
return this.getImagePath('tiny');
|
|
2300
2155
|
}
|
|
2301
2156
|
getImagePath(image_size) {
|
|
2302
2157
|
if (this.image_name !== '') {
|
|
2303
|
-
return
|
|
2158
|
+
return `${this.image_path}${image_size}/${this.image_name}`;
|
|
2304
2159
|
}
|
|
2305
2160
|
return '';
|
|
2306
2161
|
}
|
|
2307
2162
|
}
|
|
2308
2163
|
|
|
2309
|
-
class
|
|
2310
|
-
constructor(
|
|
2311
|
-
|
|
2164
|
+
class EsolveCategoryTreeService {
|
|
2165
|
+
constructor(config, http) {
|
|
2166
|
+
this.config = config;
|
|
2167
|
+
this.http = http;
|
|
2312
2168
|
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
this.
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2169
|
+
/**
|
|
2170
|
+
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
2171
|
+
*/
|
|
2172
|
+
getCategoryTree() {
|
|
2173
|
+
return this.http
|
|
2174
|
+
.get(`${this.config.api_url}/get-tree.php`)
|
|
2175
|
+
.pipe(map((response) => {
|
|
2176
|
+
if (response.records === undefined) {
|
|
2177
|
+
throw response;
|
|
2322
2178
|
}
|
|
2323
|
-
|
|
2179
|
+
return this.processTree(response.records);
|
|
2180
|
+
}));
|
|
2324
2181
|
}
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
/**
|
|
2328
|
-
* Stock Item object. It can be a service or a product (physical and/or digital).
|
|
2329
|
-
*/
|
|
2330
|
-
class EsolveStockItem extends EsolveStockItemBase {
|
|
2331
2182
|
/**
|
|
2332
|
-
*
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2183
|
+
* Retrieve the details of a category tree item from the eSolve instance and
|
|
2184
|
+
* converts it to the correct format.
|
|
2185
|
+
*
|
|
2186
|
+
* @param options Filter options
|
|
2187
|
+
*/
|
|
2188
|
+
getCategoryTreeItem(options) {
|
|
2189
|
+
let type;
|
|
2190
|
+
let esolve_id;
|
|
2191
|
+
let sef_description;
|
|
2192
|
+
if (options.id) {
|
|
2193
|
+
const categoryIdentifier = this.processID(options.id);
|
|
2194
|
+
if (categoryIdentifier) {
|
|
2195
|
+
type = categoryIdentifier.type;
|
|
2196
|
+
esolve_id = categoryIdentifier.esolve_id;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
else if (options.type) {
|
|
2200
|
+
type = options.type;
|
|
2201
|
+
if (options.esolve_id) {
|
|
2202
|
+
esolve_id = options.esolve_id;
|
|
2203
|
+
}
|
|
2204
|
+
else if (options.sef_description) {
|
|
2205
|
+
sef_description = options.sef_description;
|
|
2206
|
+
}
|
|
2338
2207
|
}
|
|
2208
|
+
if (type && (esolve_id || sef_description)) {
|
|
2209
|
+
let params = new HttpParams();
|
|
2210
|
+
params = params.set('type', type);
|
|
2211
|
+
if (esolve_id) {
|
|
2212
|
+
params = params.set('id', esolve_id);
|
|
2213
|
+
}
|
|
2214
|
+
if (sef_description) {
|
|
2215
|
+
params = params.set('sef_description', sef_description);
|
|
2216
|
+
}
|
|
2217
|
+
return this.http
|
|
2218
|
+
.get(`${this.config.api_url}/get-tree-item.php`, { params })
|
|
2219
|
+
.pipe(map((response) => {
|
|
2220
|
+
if ((response.records === undefined) ||
|
|
2221
|
+
(response.records.length <= 0)) {
|
|
2222
|
+
throw response;
|
|
2223
|
+
}
|
|
2224
|
+
return this.processTreeItem(response.records[0]);
|
|
2225
|
+
}));
|
|
2226
|
+
}
|
|
2227
|
+
return throwError('Invalid options');
|
|
2339
2228
|
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2229
|
+
/**
|
|
2230
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2231
|
+
*
|
|
2232
|
+
* @param tree_records Records to process
|
|
2233
|
+
*/
|
|
2234
|
+
processTree(tree_records) {
|
|
2235
|
+
const tree_items = [];
|
|
2236
|
+
if (tree_records) {
|
|
2237
|
+
for (const tree_record of tree_records) {
|
|
2238
|
+
let esolve_id = '';
|
|
2239
|
+
let parent_id = '';
|
|
2240
|
+
let children = [];
|
|
2241
|
+
if (tree_record.type === 'category') {
|
|
2242
|
+
children = this.processTree(tree_record.children);
|
|
2243
|
+
esolve_id = tree_record.menu_id;
|
|
2244
|
+
parent_id = tree_record.owner_menu_id;
|
|
2245
|
+
}
|
|
2246
|
+
else {
|
|
2247
|
+
esolve_id = tree_record.id;
|
|
2248
|
+
parent_id = tree_record.menu_id;
|
|
2249
|
+
}
|
|
2250
|
+
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
return tree_items;
|
|
2350
2254
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
class EsolveRecipeStockItem extends EsolveStockItemBase {
|
|
2354
|
-
constructor(record) {
|
|
2355
|
-
var _a;
|
|
2356
|
-
super(record);
|
|
2357
|
-
this.qty = 0;
|
|
2358
|
-
this.qty = +((_a = record === null || record === void 0 ? void 0 : record.qty) !== null && _a !== void 0 ? _a : 0);
|
|
2255
|
+
processTreeItem(record) {
|
|
2256
|
+
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, record.image, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2359
2257
|
}
|
|
2360
|
-
|
|
2258
|
+
processID(id) {
|
|
2259
|
+
let type;
|
|
2260
|
+
let esolve_id;
|
|
2261
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2262
|
+
const match_results = id.match(type_code_regex);
|
|
2263
|
+
if (match_results) {
|
|
2264
|
+
const type_code = match_results[0];
|
|
2265
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2266
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2267
|
+
return {
|
|
2268
|
+
type,
|
|
2269
|
+
esolve_id
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
return null;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2276
|
+
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
2277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
2278
|
+
type: Injectable,
|
|
2279
|
+
args: [{
|
|
2280
|
+
providedIn: 'root',
|
|
2281
|
+
}]
|
|
2282
|
+
}], ctorParameters: function () {
|
|
2283
|
+
return [{ type: undefined, decorators: [{
|
|
2284
|
+
type: Inject,
|
|
2285
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2286
|
+
}] }, { type: i1$2.HttpClient }];
|
|
2287
|
+
} });
|
|
2361
2288
|
|
|
2362
|
-
class
|
|
2363
|
-
constructor(
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
this.
|
|
2367
|
-
this.
|
|
2289
|
+
class EsolveManufacturer {
|
|
2290
|
+
constructor(id, manufacturer, sef_manufacturer, title, article, sort_priority, is_active, featured, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
|
|
2291
|
+
this.id = id;
|
|
2292
|
+
this.manufacturer = manufacturer;
|
|
2293
|
+
this.sef_manufacturer = sef_manufacturer;
|
|
2294
|
+
this.title = title;
|
|
2295
|
+
this.article = article;
|
|
2296
|
+
this.sort_priority = sort_priority;
|
|
2297
|
+
this.is_active = is_active;
|
|
2298
|
+
this.featured = featured;
|
|
2299
|
+
this.image_name = image_name;
|
|
2300
|
+
this.image_path = '/images/manufacturers/';
|
|
2301
|
+
if (this.title.trim() === '') {
|
|
2302
|
+
this.title = this.manufacturer;
|
|
2303
|
+
}
|
|
2304
|
+
if (seo_title.trim() === '') {
|
|
2305
|
+
seo_title = this.title;
|
|
2306
|
+
}
|
|
2307
|
+
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2308
|
+
}
|
|
2309
|
+
get original_image_src() {
|
|
2310
|
+
return this.getImagePath('original');
|
|
2311
|
+
}
|
|
2312
|
+
get small_image_src() {
|
|
2313
|
+
return this.getImagePath('small');
|
|
2314
|
+
}
|
|
2315
|
+
get thumbnail_image_src() {
|
|
2316
|
+
return this.getImagePath('thumb');
|
|
2317
|
+
}
|
|
2318
|
+
get tiny_image_src() {
|
|
2319
|
+
return this.getImagePath('tiny');
|
|
2320
|
+
}
|
|
2321
|
+
getImagePath(image_size) {
|
|
2322
|
+
if (this.image_name !== '') {
|
|
2323
|
+
return `${this.image_path}${image_size}/${this.image_name}`;
|
|
2324
|
+
}
|
|
2325
|
+
return '';
|
|
2368
2326
|
}
|
|
2369
2327
|
}
|
|
2370
2328
|
|
|
2371
|
-
class
|
|
2329
|
+
class EsolveManufacturersService {
|
|
2372
2330
|
constructor(config, http) {
|
|
2373
2331
|
this.config = config;
|
|
2374
2332
|
this.http = http;
|
|
2375
2333
|
}
|
|
2376
|
-
|
|
2377
|
-
* Retrieves the stock record from the eSolve instance using the code.
|
|
2378
|
-
*
|
|
2379
|
-
* @param code eSolve stock code
|
|
2380
|
-
*/
|
|
2381
|
-
getStockItem(code) {
|
|
2334
|
+
getManufacturer(id) {
|
|
2382
2335
|
const params = new HttpParams({
|
|
2383
|
-
fromObject: {
|
|
2384
|
-
code
|
|
2385
|
-
}
|
|
2336
|
+
fromObject: { manufacturers_id: id }
|
|
2386
2337
|
});
|
|
2387
|
-
return this.
|
|
2388
|
-
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2389
|
-
throw response;
|
|
2390
|
-
}
|
|
2391
|
-
const stockRecord = response.records[0];
|
|
2392
|
-
return this.processStockItem(stockRecord);
|
|
2393
|
-
}));
|
|
2338
|
+
return this.getManufacturerSingle(params);
|
|
2394
2339
|
}
|
|
2395
|
-
|
|
2396
|
-
* Retrieves the stock record from the eSolve instance using the SEF name.
|
|
2397
|
-
*
|
|
2398
|
-
* @param sef_name SEF name of the stock item
|
|
2399
|
-
*/
|
|
2400
|
-
getStockItemFromSEF(sef_name) {
|
|
2340
|
+
getManufacturerFromSEF(sef_manufacturer) {
|
|
2401
2341
|
const params = new HttpParams({
|
|
2402
|
-
fromObject: {
|
|
2403
|
-
sef_name
|
|
2404
|
-
}
|
|
2342
|
+
fromObject: { sef_manufacturer }
|
|
2405
2343
|
});
|
|
2406
|
-
return this.
|
|
2407
|
-
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2408
|
-
throw response;
|
|
2409
|
-
}
|
|
2410
|
-
const stockRecord = response.records[0];
|
|
2411
|
-
return this.processStockItem(stockRecord);
|
|
2412
|
-
}));
|
|
2344
|
+
return this.getManufacturerSingle(params);
|
|
2413
2345
|
}
|
|
2414
|
-
|
|
2415
|
-
* Retrieves list of stock from the eSolve instance using info provided
|
|
2416
|
-
*
|
|
2417
|
-
* @param options Stock filter options
|
|
2418
|
-
*/
|
|
2419
|
-
getStockItems(options) {
|
|
2346
|
+
getManufacturers(options) {
|
|
2420
2347
|
let params = new HttpParams();
|
|
2421
|
-
if (options.
|
|
2422
|
-
params = params.set('
|
|
2423
|
-
}
|
|
2424
|
-
if (options.rows) {
|
|
2425
|
-
params = params.set('rows', options.rows);
|
|
2426
|
-
}
|
|
2427
|
-
if (options.search_phrase) {
|
|
2428
|
-
params = params.set('search_phrase', options.search_phrase);
|
|
2429
|
-
}
|
|
2430
|
-
if (options.display_only) {
|
|
2431
|
-
params = params.set('display_only', options.display_only);
|
|
2432
|
-
}
|
|
2433
|
-
if (options.is_active) {
|
|
2434
|
-
params = params.set('is_active', options.is_active);
|
|
2435
|
-
}
|
|
2436
|
-
if (options.category_id) {
|
|
2437
|
-
params = params.set('category_id', options.category_id);
|
|
2438
|
-
}
|
|
2439
|
-
if (options.subcategory_id) {
|
|
2440
|
-
params = params.set('subcategory_id', options.subcategory_id);
|
|
2441
|
-
}
|
|
2442
|
-
if (options.manufacturers_id) {
|
|
2443
|
-
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
2444
|
-
}
|
|
2445
|
-
if (options.ranges_id) {
|
|
2446
|
-
params = params.set('ranges_id', options.ranges_id);
|
|
2447
|
-
}
|
|
2448
|
-
if (options.specials_id) {
|
|
2449
|
-
params = params.set('specials_id', options.specials_id);
|
|
2450
|
-
}
|
|
2451
|
-
if (options.tag_id_list) {
|
|
2452
|
-
if (options.tag_id_list.length > 0) {
|
|
2453
|
-
params = params.set('tag_id', options.tag_id_list.join(','));
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
if (options.topic_id_list) {
|
|
2457
|
-
if (options.topic_id_list.length > 0) {
|
|
2458
|
-
params = params.set('topic_id', options.topic_id_list.join(','));
|
|
2459
|
-
}
|
|
2348
|
+
if (options === null || options === void 0 ? void 0 : options.featured_only) {
|
|
2349
|
+
params = params.set('featured_only', options.featured_only);
|
|
2460
2350
|
}
|
|
2461
|
-
return this.
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2351
|
+
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
2352
|
+
const manufacturers = [];
|
|
2353
|
+
for (const record of records) {
|
|
2354
|
+
manufacturers.push(this.processManufacturer(record));
|
|
2465
2355
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
});
|
|
2470
|
-
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
|
|
2356
|
+
return manufacturers;
|
|
2357
|
+
}), catchError(() => {
|
|
2358
|
+
return of([]);
|
|
2471
2359
|
}));
|
|
2472
2360
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
*/
|
|
2478
|
-
getLinkedItems(code) {
|
|
2479
|
-
return this.http
|
|
2480
|
-
.get(`${this.config.api_url}/get-linked-items.php`, { params: { code } })
|
|
2481
|
-
.pipe(map((response) => {
|
|
2482
|
-
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2483
|
-
throw response;
|
|
2484
|
-
}
|
|
2485
|
-
return this.processLinkedItems(response.records);
|
|
2361
|
+
getManufacturerSingle(params) {
|
|
2362
|
+
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
2363
|
+
const record = records[0];
|
|
2364
|
+
return this.processManufacturer(record);
|
|
2486
2365
|
}));
|
|
2487
2366
|
}
|
|
2488
|
-
|
|
2489
|
-
* Retrieve list of stock items on a recipe from the eSolve API
|
|
2490
|
-
*
|
|
2491
|
-
* @param code Stock item code
|
|
2492
|
-
*/
|
|
2493
|
-
getRecipeItems(code) {
|
|
2367
|
+
getManufacturerRecords(params) {
|
|
2494
2368
|
return this.http
|
|
2495
|
-
.get(`${this.config.api_url}/get-
|
|
2369
|
+
.get(`${this.config.api_url}/get-manufacturers.php`, { params })
|
|
2496
2370
|
.pipe(map((response) => {
|
|
2497
|
-
if ((response.records === undefined) ||
|
|
2371
|
+
if ((response.records === undefined) ||
|
|
2372
|
+
(response.records.length <= 0)) {
|
|
2498
2373
|
throw response;
|
|
2499
2374
|
}
|
|
2500
|
-
return
|
|
2375
|
+
return response.records;
|
|
2501
2376
|
}));
|
|
2502
2377
|
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
*
|
|
2506
|
-
* @param record eSolve stock item record
|
|
2507
|
-
*/
|
|
2508
|
-
processStockItem(record) {
|
|
2509
|
-
return new EsolveStockItem(record);
|
|
2510
|
-
}
|
|
2511
|
-
/**
|
|
2512
|
-
* Processes the linked eSolve stock item records and converts them to objects.
|
|
2513
|
-
*
|
|
2514
|
-
* @param records Linked eSolve stock item records
|
|
2515
|
-
*/
|
|
2516
|
-
processLinkedItems(records) {
|
|
2517
|
-
const items = [];
|
|
2518
|
-
if (records.length > 0) {
|
|
2519
|
-
for (const record of records) {
|
|
2520
|
-
items.push(new EsolveLinkedStockItem(record));
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
return items;
|
|
2524
|
-
}
|
|
2525
|
-
/**
|
|
2526
|
-
* Processes the recipe eSolve stock item records and converts them to objects.
|
|
2527
|
-
*
|
|
2528
|
-
* @param records Recipe eSolve stock item records
|
|
2529
|
-
*/
|
|
2530
|
-
processRecipeItems(records) {
|
|
2531
|
-
const items = [];
|
|
2532
|
-
if (records.length > 0) {
|
|
2533
|
-
for (const record of records) {
|
|
2534
|
-
items.push(new EsolveRecipeStockItem(record));
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
return items;
|
|
2538
|
-
}
|
|
2539
|
-
/**
|
|
2540
|
-
* Retrieves stock records from HTTP params.
|
|
2541
|
-
* @param params HTTP client parameters
|
|
2542
|
-
*/
|
|
2543
|
-
getStockRecords(params) {
|
|
2544
|
-
return this.http.get(`${this.config.api_url}/get-items.php`, { params });
|
|
2378
|
+
processManufacturer(record) {
|
|
2379
|
+
return new EsolveManufacturer(+record.id, record.manufacturer, record.sef_manufacturer, record.title, record.article, +record.sort_priority, !!+record.is_active, !!+record.featured, record.image_name, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2545
2380
|
}
|
|
2546
2381
|
}
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2382
|
+
EsolveManufacturersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2383
|
+
EsolveManufacturersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, providedIn: 'root' });
|
|
2384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, decorators: [{
|
|
2550
2385
|
type: Injectable,
|
|
2551
2386
|
args: [{
|
|
2552
2387
|
providedIn: 'root',
|
|
@@ -2558,376 +2393,588 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2558
2393
|
}] }, { type: i1$2.HttpClient }];
|
|
2559
2394
|
} });
|
|
2560
2395
|
|
|
2561
|
-
class
|
|
2562
|
-
constructor(
|
|
2563
|
-
this.
|
|
2564
|
-
this.
|
|
2565
|
-
this.
|
|
2566
|
-
this.
|
|
2567
|
-
this.
|
|
2568
|
-
this.
|
|
2396
|
+
class EsolveRange {
|
|
2397
|
+
constructor(id, range, sef_range, manufacturers_id, title, article, is_active, featured, sort_priority, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
|
|
2398
|
+
this.id = id;
|
|
2399
|
+
this.range = range;
|
|
2400
|
+
this.sef_range = sef_range;
|
|
2401
|
+
this.manufacturers_id = manufacturers_id;
|
|
2402
|
+
this.title = title;
|
|
2403
|
+
this.article = article;
|
|
2404
|
+
this.is_active = is_active;
|
|
2405
|
+
this.featured = featured;
|
|
2569
2406
|
this.sort_priority = sort_priority;
|
|
2570
|
-
this.active = active;
|
|
2571
|
-
this.display_only = display_only;
|
|
2572
2407
|
this.image_name = image_name;
|
|
2573
|
-
this.
|
|
2574
|
-
this.
|
|
2575
|
-
|
|
2576
|
-
this.id = `<<CAT>>${this.esolve_id}`;
|
|
2577
|
-
if (children != null) {
|
|
2578
|
-
this.children = children;
|
|
2579
|
-
}
|
|
2580
|
-
this.image_path = '/images/categories/';
|
|
2581
|
-
}
|
|
2582
|
-
else {
|
|
2583
|
-
this.id = `<<SUB>>${this.esolve_id}`;
|
|
2584
|
-
this.image_path = '/images/subcategories/';
|
|
2408
|
+
this.image_path = '/images/ranges/';
|
|
2409
|
+
if (this.title.trim() === '') {
|
|
2410
|
+
this.title = this.range;
|
|
2585
2411
|
}
|
|
2586
2412
|
if (seo_title.trim() === '') {
|
|
2587
|
-
seo_title = this.
|
|
2413
|
+
seo_title = this.title;
|
|
2588
2414
|
}
|
|
2589
2415
|
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2590
2416
|
}
|
|
2591
|
-
get
|
|
2592
|
-
return this.getImagePath(
|
|
2593
|
-
}
|
|
2594
|
-
get thumbnail_image_src() {
|
|
2595
|
-
return this.getImagePath('thumb');
|
|
2596
|
-
}
|
|
2597
|
-
get tiny_image_src() {
|
|
2598
|
-
return this.getImagePath('tiny');
|
|
2417
|
+
get image_src() {
|
|
2418
|
+
return this.getImagePath();
|
|
2599
2419
|
}
|
|
2600
|
-
getImagePath(
|
|
2420
|
+
getImagePath() {
|
|
2601
2421
|
if (this.image_name !== '') {
|
|
2602
|
-
return `${this.image_path}${
|
|
2422
|
+
return `${this.image_path}${this.image_name}`;
|
|
2603
2423
|
}
|
|
2604
2424
|
return '';
|
|
2605
2425
|
}
|
|
2606
2426
|
}
|
|
2607
2427
|
|
|
2608
|
-
class
|
|
2428
|
+
class EsolveRangesService {
|
|
2609
2429
|
constructor(config, http) {
|
|
2610
2430
|
this.config = config;
|
|
2611
2431
|
this.http = http;
|
|
2612
2432
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2433
|
+
getRange(id) {
|
|
2434
|
+
const params = new HttpParams({
|
|
2435
|
+
fromObject: { ranges_id: id }
|
|
2436
|
+
});
|
|
2437
|
+
return this.getRangeSingle(params);
|
|
2438
|
+
}
|
|
2439
|
+
getRangeFromSEF(sef_range) {
|
|
2440
|
+
const params = new HttpParams({
|
|
2441
|
+
fromObject: { sef_range }
|
|
2442
|
+
});
|
|
2443
|
+
return this.getRangeSingle(params);
|
|
2444
|
+
}
|
|
2445
|
+
getRanges(options) {
|
|
2446
|
+
let params = new HttpParams();
|
|
2447
|
+
if (options === null || options === void 0 ? void 0 : options.featured_only) {
|
|
2448
|
+
params = params.set('featured_only', options.featured_only);
|
|
2449
|
+
}
|
|
2450
|
+
if (options === null || options === void 0 ? void 0 : options.manufacturers_id) {
|
|
2451
|
+
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
2452
|
+
}
|
|
2453
|
+
return this.getRangeRecords(params).pipe(map((records) => {
|
|
2454
|
+
const ranges = [];
|
|
2455
|
+
for (const record of records) {
|
|
2456
|
+
ranges.push(this.processRange(record));
|
|
2457
|
+
}
|
|
2458
|
+
return ranges;
|
|
2459
|
+
}), catchError(() => {
|
|
2460
|
+
return of([]);
|
|
2461
|
+
}));
|
|
2462
|
+
}
|
|
2463
|
+
getRangeSingle(params) {
|
|
2464
|
+
return this.getRangeRecords(params).pipe(map((records) => {
|
|
2465
|
+
const record = records[0];
|
|
2466
|
+
return this.processRange(record);
|
|
2467
|
+
}));
|
|
2468
|
+
}
|
|
2469
|
+
getRangeRecords(params) {
|
|
2617
2470
|
return this.http
|
|
2618
|
-
.get(`${this.config.api_url}/get-
|
|
2471
|
+
.get(`${this.config.api_url}/get-ranges.php`, { params })
|
|
2619
2472
|
.pipe(map((response) => {
|
|
2620
|
-
if (response.records === undefined)
|
|
2473
|
+
if ((response.records === undefined) ||
|
|
2474
|
+
(response.records.length <= 0)) {
|
|
2621
2475
|
throw response;
|
|
2622
2476
|
}
|
|
2623
|
-
return
|
|
2477
|
+
return response.records;
|
|
2624
2478
|
}));
|
|
2625
2479
|
}
|
|
2480
|
+
processRange(record) {
|
|
2481
|
+
return new EsolveRange(+record.id, record.range, record.sef_range, record.manufacturers_id, record.title, record.article, !!+record.is_active, !!+record.featured, +record.sort_priority, record.image_name, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
EsolveRangesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2485
|
+
EsolveRangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, providedIn: 'root' });
|
|
2486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveRangesService, decorators: [{
|
|
2487
|
+
type: Injectable,
|
|
2488
|
+
args: [{
|
|
2489
|
+
providedIn: 'root',
|
|
2490
|
+
}]
|
|
2491
|
+
}], ctorParameters: function () {
|
|
2492
|
+
return [{ type: undefined, decorators: [{
|
|
2493
|
+
type: Inject,
|
|
2494
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2495
|
+
}] }, { type: i1$2.HttpClient }];
|
|
2496
|
+
} });
|
|
2497
|
+
|
|
2498
|
+
class EsolveStockBadge {
|
|
2499
|
+
constructor(id, text, identifier, font_colour, badge_colour, sort_priority) {
|
|
2500
|
+
this.id = id;
|
|
2501
|
+
this.text = text;
|
|
2502
|
+
this.identifier = identifier;
|
|
2503
|
+
this.font_colour = font_colour;
|
|
2504
|
+
this.badge_colour = badge_colour;
|
|
2505
|
+
this.sort_priority = sort_priority;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* Price of eSolve stock item
|
|
2511
|
+
*/
|
|
2512
|
+
class EsolveStockPrice {
|
|
2626
2513
|
/**
|
|
2627
|
-
*
|
|
2628
|
-
*
|
|
2629
|
-
*
|
|
2630
|
-
* @param
|
|
2514
|
+
* Create stock price instance
|
|
2515
|
+
* @param base_price Price without tax
|
|
2516
|
+
* @param base_price_with_tax Price with tax
|
|
2517
|
+
* @param sell_price Price without tax and with discounts applied if applicable
|
|
2518
|
+
* @param sell_price_with_tax Price with tax and with discounts applied if applicable
|
|
2631
2519
|
*/
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2520
|
+
constructor(
|
|
2521
|
+
/**
|
|
2522
|
+
* Price without tax
|
|
2523
|
+
*/
|
|
2524
|
+
base_price = 0,
|
|
2525
|
+
/**
|
|
2526
|
+
* Price with tax
|
|
2527
|
+
*/
|
|
2528
|
+
base_price_with_tax = 0,
|
|
2529
|
+
/**
|
|
2530
|
+
* Price without tax and with discounts applied if applicable
|
|
2531
|
+
*/
|
|
2532
|
+
sell_price = 0,
|
|
2533
|
+
/**
|
|
2534
|
+
* Price with tax and with discounts applied if applicable
|
|
2535
|
+
*/
|
|
2536
|
+
sell_price_with_tax = 0) {
|
|
2537
|
+
this.base_price = base_price;
|
|
2538
|
+
this.base_price_with_tax = base_price_with_tax;
|
|
2539
|
+
this.sell_price = sell_price;
|
|
2540
|
+
this.sell_price_with_tax = sell_price_with_tax;
|
|
2541
|
+
if ((this.base_price === 0) && (this.sell_price > 0)) {
|
|
2542
|
+
this.base_price = this.sell_price;
|
|
2543
|
+
this.base_price_with_tax = this.sell_price_with_tax;
|
|
2544
|
+
}
|
|
2545
|
+
else if ((this.base_price > 0) && (this.sell_price === 0)) {
|
|
2546
|
+
this.sell_price = this.base_price;
|
|
2547
|
+
this.sell_price_with_tax = this.base_price_with_tax;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
class EsolveStockItemBase {
|
|
2553
|
+
constructor(record = {}) {
|
|
2554
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
2555
|
+
/**
|
|
2556
|
+
* eSolve Generated ID
|
|
2557
|
+
*/
|
|
2558
|
+
this.id = 0;
|
|
2559
|
+
/**
|
|
2560
|
+
* Code identifying the stock item
|
|
2561
|
+
*/
|
|
2562
|
+
this.code = '';
|
|
2563
|
+
/**
|
|
2564
|
+
* Name of the stock item
|
|
2565
|
+
*/
|
|
2566
|
+
this.name = '';
|
|
2567
|
+
/**
|
|
2568
|
+
* Search engine friendly name
|
|
2569
|
+
*/
|
|
2570
|
+
this.sef_name = '';
|
|
2571
|
+
/**
|
|
2572
|
+
* Short description of stock item
|
|
2573
|
+
*/
|
|
2574
|
+
this.description = '';
|
|
2575
|
+
/**
|
|
2576
|
+
* Full description of stock item
|
|
2577
|
+
*/
|
|
2578
|
+
this.extended_description = '';
|
|
2579
|
+
/**
|
|
2580
|
+
* Active state
|
|
2581
|
+
*/
|
|
2582
|
+
this.active = false;
|
|
2583
|
+
/**
|
|
2584
|
+
* Featured state
|
|
2585
|
+
*/
|
|
2586
|
+
this.featured = false;
|
|
2587
|
+
/**
|
|
2588
|
+
* ID of default category linked to the stock item
|
|
2589
|
+
*
|
|
2590
|
+
* @deprecated Use `category.esolve_id` field instead
|
|
2591
|
+
*/
|
|
2592
|
+
this.category_id = '';
|
|
2593
|
+
/**
|
|
2594
|
+
* ID of default subcategory linked to the stock item
|
|
2595
|
+
*
|
|
2596
|
+
* @deprecated Use `subcategory.esolve_id` field instead
|
|
2597
|
+
*/
|
|
2598
|
+
this.subcategory_id = 0;
|
|
2599
|
+
/**
|
|
2600
|
+
* ID of linked manufacturer
|
|
2601
|
+
*
|
|
2602
|
+
* @deprecated Use `manufacturer.id` field instead
|
|
2603
|
+
*/
|
|
2604
|
+
this.manufacturers_id = 0;
|
|
2605
|
+
/**
|
|
2606
|
+
* ID of linked range
|
|
2607
|
+
*
|
|
2608
|
+
* @deprecated Use `range.id` field instead
|
|
2609
|
+
*/
|
|
2610
|
+
this.ranges_id = 0;
|
|
2611
|
+
/**
|
|
2612
|
+
* Linked tags
|
|
2613
|
+
*/
|
|
2614
|
+
this.tags = [];
|
|
2615
|
+
/**
|
|
2616
|
+
* Linked topics
|
|
2617
|
+
*/
|
|
2618
|
+
this.topics = [];
|
|
2619
|
+
/**
|
|
2620
|
+
* Stock badges
|
|
2621
|
+
*/
|
|
2622
|
+
this.badges = [];
|
|
2623
|
+
/**
|
|
2624
|
+
* Colours
|
|
2625
|
+
*/
|
|
2626
|
+
this.colours = [];
|
|
2627
|
+
/**
|
|
2628
|
+
* Image filename
|
|
2629
|
+
*/
|
|
2630
|
+
this.image_name = '';
|
|
2631
|
+
let seo_title = '';
|
|
2632
|
+
let seo_keywords = '';
|
|
2633
|
+
let base_price = 0;
|
|
2634
|
+
let base_price_with_tax = 0;
|
|
2635
|
+
let sell_price = 0;
|
|
2636
|
+
let sell_price_with_tax = 0;
|
|
2637
|
+
if (record) {
|
|
2638
|
+
this.id = +((_a = record.id) !== null && _a !== void 0 ? _a : 0);
|
|
2639
|
+
this.code = (_b = record.code) !== null && _b !== void 0 ? _b : '';
|
|
2640
|
+
this.name = (_c = record.name) !== null && _c !== void 0 ? _c : '';
|
|
2641
|
+
this.sef_name = (_d = record.sef_name) !== null && _d !== void 0 ? _d : '';
|
|
2642
|
+
this.description = (_e = record.description) !== null && _e !== void 0 ? _e : '';
|
|
2643
|
+
this.extended_description = (_f = record.extended_description) !== null && _f !== void 0 ? _f : '';
|
|
2644
|
+
this.image_name = (_g = record.image_name) !== null && _g !== void 0 ? _g : '';
|
|
2645
|
+
this.category_id = (_h = record.category_id) !== null && _h !== void 0 ? _h : '';
|
|
2646
|
+
this.subcategory_id = +((_j = record.subcategory_id) !== null && _j !== void 0 ? _j : 0);
|
|
2647
|
+
this.manufacturers_id = +((_k = record.manufacturers_id) !== null && _k !== void 0 ? _k : 0);
|
|
2648
|
+
this.ranges_id = +((_l = record.ranges_id) !== null && _l !== void 0 ? _l : 0);
|
|
2649
|
+
this.active = !!+((_m = record.is_active) !== null && _m !== void 0 ? _m : false);
|
|
2650
|
+
this.featured = !!+((_o = record.is_featured) !== null && _o !== void 0 ? _o : false);
|
|
2651
|
+
base_price = +((_p = record.regular_sellprice) !== null && _p !== void 0 ? _p : 0);
|
|
2652
|
+
base_price_with_tax = +((_q = record.regular_sellprice_inclusive) !== null && _q !== void 0 ? _q : 0);
|
|
2653
|
+
sell_price = +((_r = record.sellprice) !== null && _r !== void 0 ? _r : 0);
|
|
2654
|
+
sell_price_with_tax = +((_s = record.sellprice_inclusive) !== null && _s !== void 0 ? _s : 0);
|
|
2655
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
2656
|
+
for (const tag of record.tags) {
|
|
2657
|
+
this.tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
2658
|
+
}
|
|
2641
2659
|
}
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
esolve_id = options.esolve_id;
|
|
2660
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
2661
|
+
for (const topic of record.topics) {
|
|
2662
|
+
this.topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
2663
|
+
}
|
|
2647
2664
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2665
|
+
if ((record.badges) && (record.badges.length > 0)) {
|
|
2666
|
+
for (const badge of record.badges) {
|
|
2667
|
+
this.badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
|
|
2668
|
+
}
|
|
2650
2669
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
let params = new HttpParams();
|
|
2654
|
-
params = params.set('type', type);
|
|
2655
|
-
if (esolve_id) {
|
|
2656
|
-
params = params.set('id', esolve_id);
|
|
2670
|
+
if (record.category) {
|
|
2671
|
+
this.category = new EsolveCategoryTreeItem(record.category.type, record.category.id, record.category.parent_id, record.category.description, record.category.sef_description, record.category.short_description, record.category.sort_priority, record.category.active, record.category.display_only, record.category.image, record.category.seo_page_title, record.category.seo_keywords, record.category.seo_description);
|
|
2657
2672
|
}
|
|
2658
|
-
if (
|
|
2659
|
-
|
|
2673
|
+
if (record.subcategory) {
|
|
2674
|
+
this.subcategory = new EsolveCategoryTreeItem(record.subcategory.type, record.subcategory.id, record.subcategory.parent_id, record.subcategory.description, record.subcategory.sef_description, record.subcategory.short_description, record.subcategory.sort_priority, record.subcategory.active, record.subcategory.display_only, record.subcategory.image, record.subcategory.seo_page_title, record.subcategory.seo_keywords, record.subcategory.seo_description);
|
|
2660
2675
|
}
|
|
2661
|
-
|
|
2662
|
-
.
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
}
|
|
2671
|
-
return throwError('Invalid options');
|
|
2672
|
-
}
|
|
2673
|
-
/**
|
|
2674
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
2675
|
-
*
|
|
2676
|
-
* @param tree_records Records to process
|
|
2677
|
-
*/
|
|
2678
|
-
processTree(tree_records) {
|
|
2679
|
-
const tree_items = [];
|
|
2680
|
-
if (tree_records) {
|
|
2681
|
-
for (const tree_record of tree_records) {
|
|
2682
|
-
let esolve_id = '';
|
|
2683
|
-
let parent_id = '';
|
|
2684
|
-
let children = [];
|
|
2685
|
-
if (tree_record.type === 'category') {
|
|
2686
|
-
children = this.processTree(tree_record.children);
|
|
2687
|
-
esolve_id = tree_record.menu_id;
|
|
2688
|
-
parent_id = tree_record.owner_menu_id;
|
|
2689
|
-
}
|
|
2690
|
-
else {
|
|
2691
|
-
esolve_id = tree_record.id;
|
|
2692
|
-
parent_id = tree_record.menu_id;
|
|
2676
|
+
if (record.manufacturer) {
|
|
2677
|
+
this.manufacturer = new EsolveManufacturer(record.manufacturer.id, record.manufacturer.manufacturer, record.manufacturer.sef_manufacturer, record.manufacturer.title, record.manufacturer.article, record.manufacturer.sort_priority, record.manufacturer.is_active, record.manufacturer.featured, record.manufacturer.image_name, record.manufacturer.seo_page_title, record.manufacturer.seo_keywords, record.manufacturer.seo_description);
|
|
2678
|
+
}
|
|
2679
|
+
if (record.range) {
|
|
2680
|
+
this.range = new EsolveRange(record.range.id, record.range.range, record.range.sef_range, record.range.manufacturers_id, record.range.title, record.range.article, record.range.is_active, record.range.featured, record.range.sort_priority, record.range.image_name, record.range.seo_page_title, record.range.seo_keywords, record.range.seo_description);
|
|
2681
|
+
}
|
|
2682
|
+
if (record.colours && record.colours.length > 0) {
|
|
2683
|
+
for (const colour of record.colours) {
|
|
2684
|
+
this.colours.push(new EsolveColour(colour));
|
|
2693
2685
|
}
|
|
2694
|
-
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
2695
2686
|
}
|
|
2687
|
+
if (record.custom_fields) {
|
|
2688
|
+
this.custom_fields = record.custom_fields;
|
|
2689
|
+
}
|
|
2690
|
+
seo_title = (_t = record.seo_page_title) !== null && _t !== void 0 ? _t : '';
|
|
2691
|
+
seo_keywords = (_u = record.seo_keywords) !== null && _u !== void 0 ? _u : '';
|
|
2696
2692
|
}
|
|
2697
|
-
|
|
2698
|
-
}
|
|
2699
|
-
processTreeItem(record) {
|
|
2700
|
-
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2701
|
-
}
|
|
2702
|
-
processID(id) {
|
|
2703
|
-
let type;
|
|
2704
|
-
let esolve_id;
|
|
2705
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2706
|
-
const match_results = id.match(type_code_regex);
|
|
2707
|
-
if (match_results) {
|
|
2708
|
-
const type_code = match_results[0];
|
|
2709
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2710
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
2711
|
-
return {
|
|
2712
|
-
type,
|
|
2713
|
-
esolve_id
|
|
2714
|
-
};
|
|
2715
|
-
}
|
|
2716
|
-
return null;
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2720
|
-
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
2721
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveCategoryTreeService, decorators: [{
|
|
2722
|
-
type: Injectable,
|
|
2723
|
-
args: [{
|
|
2724
|
-
providedIn: 'root',
|
|
2725
|
-
}]
|
|
2726
|
-
}], ctorParameters: function () {
|
|
2727
|
-
return [{ type: undefined, decorators: [{
|
|
2728
|
-
type: Inject,
|
|
2729
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
2730
|
-
}] }, { type: i1$2.HttpClient }];
|
|
2731
|
-
} });
|
|
2732
|
-
|
|
2733
|
-
class EsolveManufacturer {
|
|
2734
|
-
constructor(id, manufacturer, sef_manufacturer, title, article, sort_priority, is_active, featured, image_name, seo_title = '', seo_keywords = '', seo_description = '') {
|
|
2735
|
-
this.id = id;
|
|
2736
|
-
this.manufacturer = manufacturer;
|
|
2737
|
-
this.sef_manufacturer = sef_manufacturer;
|
|
2738
|
-
this.title = title;
|
|
2739
|
-
this.article = article;
|
|
2740
|
-
this.sort_priority = sort_priority;
|
|
2741
|
-
this.is_active = is_active;
|
|
2742
|
-
this.featured = featured;
|
|
2743
|
-
this.image_name = image_name;
|
|
2744
|
-
this.image_path = '/images/manufacturers/';
|
|
2745
|
-
if (this.title.trim() === '') {
|
|
2746
|
-
this.title = this.manufacturer;
|
|
2747
|
-
}
|
|
2693
|
+
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax);
|
|
2748
2694
|
if (seo_title.trim() === '') {
|
|
2749
|
-
seo_title = this.
|
|
2695
|
+
seo_title = this.name;
|
|
2750
2696
|
}
|
|
2751
|
-
this.seo_details = new EsolveSeoInfo(seo_title,
|
|
2697
|
+
this.seo_details = new EsolveSeoInfo(seo_title, this.description, seo_keywords);
|
|
2752
2698
|
}
|
|
2753
|
-
|
|
2754
|
-
|
|
2699
|
+
/**
|
|
2700
|
+
* Path to tiny stock image
|
|
2701
|
+
*/
|
|
2702
|
+
get tiny_image_src() {
|
|
2703
|
+
return this.getImagePath('tiny');
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Path to thumbnail stock image
|
|
2707
|
+
*/
|
|
2708
|
+
get thumbnail_image_src() {
|
|
2709
|
+
return this.getImagePath('thumb');
|
|
2755
2710
|
}
|
|
2711
|
+
/**
|
|
2712
|
+
* Path to small stock image
|
|
2713
|
+
*/
|
|
2756
2714
|
get small_image_src() {
|
|
2757
2715
|
return this.getImagePath('small');
|
|
2758
2716
|
}
|
|
2759
|
-
|
|
2760
|
-
|
|
2717
|
+
/**
|
|
2718
|
+
* Path to big stock image
|
|
2719
|
+
*/
|
|
2720
|
+
get big_image_src() {
|
|
2721
|
+
return this.getImagePath('big');
|
|
2761
2722
|
}
|
|
2762
|
-
|
|
2763
|
-
|
|
2723
|
+
/**
|
|
2724
|
+
* Path to original stock image
|
|
2725
|
+
*/
|
|
2726
|
+
get original_image_src() {
|
|
2727
|
+
return this.getImagePath('original');
|
|
2764
2728
|
}
|
|
2765
2729
|
getImagePath(image_size) {
|
|
2766
2730
|
if (this.image_name !== '') {
|
|
2767
|
-
return
|
|
2731
|
+
return `/images/stock/${image_size}/${this.image_name}`;
|
|
2768
2732
|
}
|
|
2769
2733
|
return '';
|
|
2770
2734
|
}
|
|
2771
2735
|
}
|
|
2772
2736
|
|
|
2773
|
-
class
|
|
2774
|
-
constructor(
|
|
2775
|
-
|
|
2776
|
-
this.http = http;
|
|
2777
|
-
}
|
|
2778
|
-
getManufacturer(id) {
|
|
2779
|
-
const params = new HttpParams({
|
|
2780
|
-
fromObject: { manufacturers_id: id }
|
|
2781
|
-
});
|
|
2782
|
-
return this.getManufacturerSingle(params);
|
|
2783
|
-
}
|
|
2784
|
-
getManufacturerFromSEF(sef_manufacturer) {
|
|
2785
|
-
const params = new HttpParams({
|
|
2786
|
-
fromObject: { sef_manufacturer }
|
|
2787
|
-
});
|
|
2788
|
-
return this.getManufacturerSingle(params);
|
|
2737
|
+
class EsolveStockGroupItem extends EsolveStockItemBase {
|
|
2738
|
+
constructor(record) {
|
|
2739
|
+
super(record);
|
|
2789
2740
|
}
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
class EsolveStockGroup {
|
|
2744
|
+
constructor(group, records = []) {
|
|
2745
|
+
this.group = group;
|
|
2746
|
+
this.items = [];
|
|
2747
|
+
if (records.length > 0) {
|
|
2797
2748
|
for (const record of records) {
|
|
2798
|
-
|
|
2799
|
-
}
|
|
2800
|
-
return manufacturers;
|
|
2801
|
-
}), catchError(() => {
|
|
2802
|
-
return of([]);
|
|
2803
|
-
}));
|
|
2804
|
-
}
|
|
2805
|
-
getManufacturerSingle(params) {
|
|
2806
|
-
return this.getManufacturerRecords(params).pipe(map((records) => {
|
|
2807
|
-
const record = records[0];
|
|
2808
|
-
return this.processManufacturer(record);
|
|
2809
|
-
}));
|
|
2810
|
-
}
|
|
2811
|
-
getManufacturerRecords(params) {
|
|
2812
|
-
return this.http
|
|
2813
|
-
.get(`${this.config.api_url}/get-manufacturers.php`, { params })
|
|
2814
|
-
.pipe(map((response) => {
|
|
2815
|
-
if ((response.records === undefined) ||
|
|
2816
|
-
(response.records.length <= 0)) {
|
|
2817
|
-
throw response;
|
|
2749
|
+
this.items.push(new EsolveStockGroupItem(record));
|
|
2818
2750
|
}
|
|
2819
|
-
|
|
2820
|
-
}));
|
|
2821
|
-
}
|
|
2822
|
-
processManufacturer(record) {
|
|
2823
|
-
return new EsolveManufacturer(+record.id, record.manufacturer, record.sef_manufacturer, record.title, record.article, +record.sort_priority, !!+record.is_active, !!+record.featured, record.image_name, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2751
|
+
}
|
|
2824
2752
|
}
|
|
2825
|
-
}
|
|
2826
|
-
EsolveManufacturersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2827
|
-
EsolveManufacturersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, providedIn: 'root' });
|
|
2828
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveManufacturersService, decorators: [{
|
|
2829
|
-
type: Injectable,
|
|
2830
|
-
args: [{
|
|
2831
|
-
providedIn: 'root',
|
|
2832
|
-
}]
|
|
2833
|
-
}], ctorParameters: function () {
|
|
2834
|
-
return [{ type: undefined, decorators: [{
|
|
2835
|
-
type: Inject,
|
|
2836
|
-
args: [ESOLVE_CONNECT_CONFIG]
|
|
2837
|
-
}] }, { type: i1$2.HttpClient }];
|
|
2838
|
-
} });
|
|
2753
|
+
}
|
|
2839
2754
|
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
this.image_name = image_name;
|
|
2852
|
-
this.image_path = '/images/ranges/';
|
|
2853
|
-
if (this.title.trim() === '') {
|
|
2854
|
-
this.title = this.range;
|
|
2855
|
-
}
|
|
2856
|
-
if (seo_title.trim() === '') {
|
|
2857
|
-
seo_title = this.title;
|
|
2755
|
+
/**
|
|
2756
|
+
* Stock Item object. It can be a service or a product (physical and/or digital).
|
|
2757
|
+
*/
|
|
2758
|
+
class EsolveStockItem extends EsolveStockItemBase {
|
|
2759
|
+
/**
|
|
2760
|
+
* Constructs an instance of EsolveStockItem
|
|
2761
|
+
*/
|
|
2762
|
+
constructor(record) {
|
|
2763
|
+
super(record);
|
|
2764
|
+
if ((record === null || record === void 0 ? void 0 : record.group) && record.grouped_items) {
|
|
2765
|
+
this.group = new EsolveStockGroup(record.group, record.grouped_items);
|
|
2858
2766
|
}
|
|
2859
|
-
this.seo_details = new EsolveSeoInfo(seo_title, seo_description, seo_keywords);
|
|
2860
2767
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
/**
|
|
2771
|
+
* Stock item object list
|
|
2772
|
+
*/
|
|
2773
|
+
class EsolveStockItemList {
|
|
2774
|
+
constructor(stock_items, total, page) {
|
|
2775
|
+
this.stock_items = stock_items;
|
|
2776
|
+
this.total = total;
|
|
2777
|
+
this.page = page;
|
|
2863
2778
|
}
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
class EsolveRecipeStockItem extends EsolveStockItemBase {
|
|
2782
|
+
constructor(record) {
|
|
2783
|
+
var _a;
|
|
2784
|
+
super(record);
|
|
2785
|
+
this.qty = 0;
|
|
2786
|
+
this.qty = +((_a = record === null || record === void 0 ? void 0 : record.qty) !== null && _a !== void 0 ? _a : 0);
|
|
2869
2787
|
}
|
|
2870
2788
|
}
|
|
2871
2789
|
|
|
2872
|
-
class
|
|
2790
|
+
class EsolveLinkedStockItem extends EsolveStockItemBase {
|
|
2791
|
+
constructor(record) {
|
|
2792
|
+
var _a;
|
|
2793
|
+
super(record);
|
|
2794
|
+
this.qty = 0;
|
|
2795
|
+
this.qty = +((_a = record === null || record === void 0 ? void 0 : record.qty) !== null && _a !== void 0 ? _a : 0);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
class EsolveStockService {
|
|
2873
2800
|
constructor(config, http) {
|
|
2874
2801
|
this.config = config;
|
|
2875
2802
|
this.http = http;
|
|
2876
2803
|
}
|
|
2877
|
-
|
|
2804
|
+
/**
|
|
2805
|
+
* Retrieves the stock record from the eSolve instance using the code.
|
|
2806
|
+
*
|
|
2807
|
+
* @param code eSolve stock code
|
|
2808
|
+
*/
|
|
2809
|
+
getStockItem(code) {
|
|
2878
2810
|
const params = new HttpParams({
|
|
2879
|
-
fromObject: {
|
|
2811
|
+
fromObject: {
|
|
2812
|
+
code
|
|
2813
|
+
}
|
|
2880
2814
|
});
|
|
2881
|
-
return this.
|
|
2815
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
2816
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2817
|
+
throw response;
|
|
2818
|
+
}
|
|
2819
|
+
const stockRecord = response.records[0];
|
|
2820
|
+
return this.processStockItem(stockRecord);
|
|
2821
|
+
}));
|
|
2882
2822
|
}
|
|
2883
|
-
|
|
2823
|
+
/**
|
|
2824
|
+
* Retrieves the stock record from the eSolve instance using the SEF name.
|
|
2825
|
+
*
|
|
2826
|
+
* @param sef_name SEF name of the stock item
|
|
2827
|
+
*/
|
|
2828
|
+
getStockItemFromSEF(sef_name) {
|
|
2884
2829
|
const params = new HttpParams({
|
|
2885
|
-
fromObject: {
|
|
2830
|
+
fromObject: {
|
|
2831
|
+
sef_name
|
|
2832
|
+
}
|
|
2886
2833
|
});
|
|
2887
|
-
return this.
|
|
2834
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
2835
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2836
|
+
throw response;
|
|
2837
|
+
}
|
|
2838
|
+
const stockRecord = response.records[0];
|
|
2839
|
+
return this.processStockItem(stockRecord);
|
|
2840
|
+
}));
|
|
2888
2841
|
}
|
|
2889
|
-
|
|
2842
|
+
/**
|
|
2843
|
+
* Retrieves list of stock from the eSolve instance using info provided
|
|
2844
|
+
*
|
|
2845
|
+
* @param options Stock filter options
|
|
2846
|
+
*/
|
|
2847
|
+
getStockItems(options) {
|
|
2890
2848
|
let params = new HttpParams();
|
|
2891
|
-
if (options
|
|
2892
|
-
params = params.set('
|
|
2849
|
+
if (options.page) {
|
|
2850
|
+
params = params.set('page', options.page);
|
|
2893
2851
|
}
|
|
2894
|
-
if (options
|
|
2852
|
+
if (options.rows) {
|
|
2853
|
+
params = params.set('rows', options.rows);
|
|
2854
|
+
}
|
|
2855
|
+
if (options.search_phrase) {
|
|
2856
|
+
params = params.set('search_phrase', options.search_phrase);
|
|
2857
|
+
}
|
|
2858
|
+
if (options.display_only) {
|
|
2859
|
+
params = params.set('display_only', options.display_only);
|
|
2860
|
+
}
|
|
2861
|
+
if (options.is_active) {
|
|
2862
|
+
params = params.set('is_active', options.is_active);
|
|
2863
|
+
}
|
|
2864
|
+
if (options.category_id) {
|
|
2865
|
+
params = params.set('category_id', options.category_id);
|
|
2866
|
+
}
|
|
2867
|
+
if (options.subcategory_id) {
|
|
2868
|
+
params = params.set('subcategory_id', options.subcategory_id);
|
|
2869
|
+
}
|
|
2870
|
+
if (options.manufacturers_id) {
|
|
2895
2871
|
params = params.set('manufacturers_id', options.manufacturers_id);
|
|
2896
2872
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2873
|
+
if (options.ranges_id) {
|
|
2874
|
+
params = params.set('ranges_id', options.ranges_id);
|
|
2875
|
+
}
|
|
2876
|
+
if (options.specials_id) {
|
|
2877
|
+
params = params.set('specials_id', options.specials_id);
|
|
2878
|
+
}
|
|
2879
|
+
if (options.tag_id_list) {
|
|
2880
|
+
if (options.tag_id_list.length > 0) {
|
|
2881
|
+
params = params.set('tag_id', options.tag_id_list.join(','));
|
|
2901
2882
|
}
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2883
|
+
}
|
|
2884
|
+
if (options.topic_id_list) {
|
|
2885
|
+
if (options.topic_id_list.length > 0) {
|
|
2886
|
+
params = params.set('topic_id', options.topic_id_list.join(','));
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
return this.getStockRecords(params).pipe(map(response => {
|
|
2890
|
+
var _a;
|
|
2891
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2892
|
+
throw response;
|
|
2893
|
+
}
|
|
2894
|
+
const stockItems = [];
|
|
2895
|
+
response.records.forEach(stockRecord => {
|
|
2896
|
+
stockItems.push(this.processStockItem(stockRecord));
|
|
2897
|
+
});
|
|
2898
|
+
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
|
|
2905
2899
|
}));
|
|
2906
2900
|
}
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2901
|
+
/**
|
|
2902
|
+
* Retrieve list of stock items linked to a stock item from the eSolve API
|
|
2903
|
+
*
|
|
2904
|
+
* @param code Stock item code
|
|
2905
|
+
*/
|
|
2906
|
+
getLinkedItems(code) {
|
|
2907
|
+
return this.http
|
|
2908
|
+
.get(`${this.config.api_url}/get-linked-items.php`, { params: { code } })
|
|
2909
|
+
.pipe(map((response) => {
|
|
2910
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2911
|
+
throw response;
|
|
2912
|
+
}
|
|
2913
|
+
return this.processLinkedItems(response.records);
|
|
2911
2914
|
}));
|
|
2912
2915
|
}
|
|
2913
|
-
|
|
2916
|
+
/**
|
|
2917
|
+
* Retrieve list of stock items on a recipe from the eSolve API
|
|
2918
|
+
*
|
|
2919
|
+
* @param code Stock item code
|
|
2920
|
+
*/
|
|
2921
|
+
getRecipeItems(code) {
|
|
2914
2922
|
return this.http
|
|
2915
|
-
.get(`${this.config.api_url}/get-
|
|
2923
|
+
.get(`${this.config.api_url}/get-recipe-items.php`, { params: { code } })
|
|
2916
2924
|
.pipe(map((response) => {
|
|
2917
|
-
if ((response.records === undefined) ||
|
|
2918
|
-
(response.records.length <= 0)) {
|
|
2925
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2919
2926
|
throw response;
|
|
2920
2927
|
}
|
|
2921
|
-
return response.records;
|
|
2928
|
+
return this.processRecipeItems(response.records);
|
|
2922
2929
|
}));
|
|
2923
2930
|
}
|
|
2924
|
-
|
|
2925
|
-
|
|
2931
|
+
/**
|
|
2932
|
+
* Processes the eSolve stock item record and converts it to an object.
|
|
2933
|
+
*
|
|
2934
|
+
* @param record eSolve stock item record
|
|
2935
|
+
*/
|
|
2936
|
+
processStockItem(record) {
|
|
2937
|
+
return new EsolveStockItem(record);
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Processes the linked eSolve stock item records and converts them to objects.
|
|
2941
|
+
*
|
|
2942
|
+
* @param records Linked eSolve stock item records
|
|
2943
|
+
*/
|
|
2944
|
+
processLinkedItems(records) {
|
|
2945
|
+
const items = [];
|
|
2946
|
+
if (records.length > 0) {
|
|
2947
|
+
for (const record of records) {
|
|
2948
|
+
items.push(new EsolveLinkedStockItem(record));
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
return items;
|
|
2952
|
+
}
|
|
2953
|
+
/**
|
|
2954
|
+
* Processes the recipe eSolve stock item records and converts them to objects.
|
|
2955
|
+
*
|
|
2956
|
+
* @param records Recipe eSolve stock item records
|
|
2957
|
+
*/
|
|
2958
|
+
processRecipeItems(records) {
|
|
2959
|
+
const items = [];
|
|
2960
|
+
if (records.length > 0) {
|
|
2961
|
+
for (const record of records) {
|
|
2962
|
+
items.push(new EsolveRecipeStockItem(record));
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
return items;
|
|
2966
|
+
}
|
|
2967
|
+
/**
|
|
2968
|
+
* Retrieves stock records from HTTP params.
|
|
2969
|
+
* @param params HTTP client parameters
|
|
2970
|
+
*/
|
|
2971
|
+
getStockRecords(params) {
|
|
2972
|
+
return this.http.get(`${this.config.api_url}/get-items.php`, { params });
|
|
2926
2973
|
}
|
|
2927
2974
|
}
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type:
|
|
2975
|
+
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2976
|
+
EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
|
|
2977
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveStockService, decorators: [{
|
|
2931
2978
|
type: Injectable,
|
|
2932
2979
|
args: [{
|
|
2933
2980
|
providedIn: 'root',
|
|
@@ -2939,6 +2986,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2939
2986
|
}] }, { type: i1$2.HttpClient }];
|
|
2940
2987
|
} });
|
|
2941
2988
|
|
|
2989
|
+
// Models
|
|
2990
|
+
|
|
2942
2991
|
class EsolveSpecialImage {
|
|
2943
2992
|
constructor(record) {
|
|
2944
2993
|
this.id = +record.id;
|
|
@@ -3813,6 +3862,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3813
3862
|
}] }, { type: i1$2.HttpClient }];
|
|
3814
3863
|
} });
|
|
3815
3864
|
|
|
3865
|
+
class EsolveEnquiryResult extends EsolveResponseResult {
|
|
3866
|
+
constructor(response) {
|
|
3867
|
+
super(response);
|
|
3868
|
+
this.id = 0;
|
|
3869
|
+
this.id = +response.esolve_id;
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
class EsolveEnquiryService {
|
|
3874
|
+
constructor(config, http, errorHandler, responseHandler) {
|
|
3875
|
+
this.config = config;
|
|
3876
|
+
this.http = http;
|
|
3877
|
+
this.errorHandler = errorHandler;
|
|
3878
|
+
this.responseHandler = responseHandler;
|
|
3879
|
+
}
|
|
3880
|
+
send(form_data) {
|
|
3881
|
+
if (!form_data.has('email')) {
|
|
3882
|
+
return this.errorHandler.emitError('email_required', 'Email is required');
|
|
3883
|
+
}
|
|
3884
|
+
return this.http
|
|
3885
|
+
.post(`${this.config.api_url}/set-enquiry.php`, form_data, {
|
|
3886
|
+
responseType: 'json',
|
|
3887
|
+
observe: 'body',
|
|
3888
|
+
})
|
|
3889
|
+
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => new EsolveEnquiryResult(response))), catchError((errorRes) => {
|
|
3890
|
+
return this.errorHandler.handleHttpPostError('set-enquiry', errorRes);
|
|
3891
|
+
}));
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
EsolveEnquiryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveEnquiryService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3895
|
+
EsolveEnquiryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveEnquiryService, providedIn: 'root' });
|
|
3896
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: EsolveEnquiryService, decorators: [{
|
|
3897
|
+
type: Injectable,
|
|
3898
|
+
args: [{
|
|
3899
|
+
providedIn: 'root',
|
|
3900
|
+
}]
|
|
3901
|
+
}], ctorParameters: function () {
|
|
3902
|
+
return [{ type: undefined, decorators: [{
|
|
3903
|
+
type: Inject,
|
|
3904
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
3905
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
3906
|
+
} });
|
|
3907
|
+
|
|
3816
3908
|
/*
|
|
3817
3909
|
* Public API Surface of ng-esolve-connect
|
|
3818
3910
|
*/
|
|
@@ -3821,5 +3913,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3821
3913
|
* Generated bundle index. Do not edit.
|
|
3822
3914
|
*/
|
|
3823
3915
|
|
|
3824
|
-
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveCookieService, 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, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
3916
|
+
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, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
3825
3917
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|