@esolve/ng-esolve-connect 0.144.0 → 0.145.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.
@@ -2298,12 +2298,7 @@ class EsolveStockService {
2298
2298
  if (options.is_active) {
2299
2299
  params = params.set('is_active', options.is_active);
2300
2300
  }
2301
- if (options.override_fields_set) {
2302
- params = params.set('override_fields_set', options.override_fields_set);
2303
- }
2304
- if (options.custom_field_config_names) {
2305
- params = params.set('custom_field_config_names', options.custom_field_config_names.join(','));
2306
- }
2301
+ params = this.applyFieldSetOptions(params, options);
2307
2302
  if (options.category_id) {
2308
2303
  params = params.set('category_id', options.category_id);
2309
2304
  }
@@ -2376,10 +2371,14 @@ class EsolveStockService {
2376
2371
  *
2377
2372
  * @param code Stock item code
2378
2373
  */
2379
- getLinkedItems(code) {
2374
+ getLinkedItems(code, options) {
2375
+ let params = new HttpParams().set('code', code);
2376
+ if (options) {
2377
+ params = this.applyFieldSetOptions(params, options);
2378
+ }
2380
2379
  return this.http
2381
2380
  .get(`${this.config.api_url}/get-linked-items.php`, {
2382
- params: { code },
2381
+ params,
2383
2382
  })
2384
2383
  .pipe(map((response) => {
2385
2384
  if (response.records === undefined ||
@@ -2412,6 +2411,7 @@ class EsolveStockService {
2412
2411
  params = params.set('order', sort.order);
2413
2412
  }
2414
2413
  }
2414
+ params = this.applyFieldSetOptions(params, options);
2415
2415
  }
2416
2416
  return this.http
2417
2417
  .get(`${this.config.api_url}/get-recipe-items.php`, {
@@ -2456,6 +2456,7 @@ class EsolveStockService {
2456
2456
  if (options.media_id) {
2457
2457
  params = params.append('media_id', options.media_id);
2458
2458
  }
2459
+ params = this.applyFieldSetOptions(params, options);
2459
2460
  return this.http
2460
2461
  .get(`${this.config.api_url}/get-media-linked-items.php`, {
2461
2462
  params,
@@ -2474,10 +2475,14 @@ class EsolveStockService {
2474
2475
  *
2475
2476
  * @param code Stock item code
2476
2477
  */
2477
- getSuggestedItems(code) {
2478
+ getSuggestedItems(code, options) {
2479
+ let params = new HttpParams().set('code', code);
2480
+ if (options) {
2481
+ params = this.applyFieldSetOptions(params, options);
2482
+ }
2478
2483
  return this.http
2479
2484
  .get(`${this.config.api_url}/get-suggested-items.php`, {
2480
- params: { code },
2485
+ params,
2481
2486
  })
2482
2487
  .pipe(map((response) => {
2483
2488
  if (response.records === undefined ||
@@ -2602,6 +2607,22 @@ class EsolveStockService {
2602
2607
  }
2603
2608
  return params;
2604
2609
  }
2610
+ /**
2611
+ * Applies the shared field-set options (`override_fields_set` and
2612
+ * `custom_field_config_names`) to the given HTTP params.
2613
+ *
2614
+ * @param params HTTP client parameters
2615
+ * @param options Field set options
2616
+ */
2617
+ applyFieldSetOptions(params, options) {
2618
+ if (options.override_fields_set) {
2619
+ params = params.set('override_fields_set', options.override_fields_set);
2620
+ }
2621
+ if (options.custom_field_config_names) {
2622
+ params = params.set('custom_field_config_names', options.custom_field_config_names.join(','));
2623
+ }
2624
+ return params;
2625
+ }
2605
2626
  /**
2606
2627
  * Processes the eSolve stock item record and converts it to an object.
2607
2628
  *
@@ -8969,6 +8990,7 @@ class EsolveEnquiryFormField {
8969
8990
  this.options = [];
8970
8991
  this.accept = '';
8971
8992
  this.layout_row = 0;
8993
+ this.presentational = false;
8972
8994
  if (record) {
8973
8995
  this.id = +(record.id ?? 0);
8974
8996
  this.identifier = record.identifier ?? '';
@@ -8977,6 +8999,7 @@ class EsolveEnquiryFormField {
8977
8999
  this.description = record.description ?? '';
8978
9000
  this.required = !!record.required;
8979
9001
  this.layout_row = +(record.layout_row ?? 0);
9002
+ this.presentational = !!record.presentational;
8980
9003
  if ('placeholder' in record) {
8981
9004
  this.placeholder = record.placeholder ?? '';
8982
9005
  }
@@ -8991,6 +9014,13 @@ class EsolveEnquiryFormField {
8991
9014
  }
8992
9015
  }
8993
9016
  }
9017
+ /**
9018
+ * Presentational fields (e.g. section headings) carry no answer and should
9019
+ * be rendered as layout/grouping markers rather than inputs.
9020
+ */
9021
+ isPresentational() {
9022
+ return this.presentational || this.type === 'heading';
9023
+ }
8994
9024
  }
8995
9025
 
8996
9026
  class EsolveEnquiryFormSubmissionResult {
@@ -9168,10 +9198,22 @@ class EsolveWishlistService {
9168
9198
  /**
9169
9199
  * Retrieves the current wishlist
9170
9200
  *
9201
+ * @param options Optional field-set options controlling which stock
9202
+ * fields are returned for each wishlist item
9203
+ *
9171
9204
  * @returns An `Observable` with an array of cart items
9172
9205
  */
9173
- getWishlist() {
9174
- return this.getWishlistRecords().pipe(map((response) => {
9206
+ getWishlist(options) {
9207
+ let params = new HttpParams();
9208
+ if (options) {
9209
+ if (options.override_fields_set) {
9210
+ params = params.set('override_fields_set', options.override_fields_set);
9211
+ }
9212
+ if (options.custom_field_config_names) {
9213
+ params = params.set('custom_field_config_names', options.custom_field_config_names.join(','));
9214
+ }
9215
+ }
9216
+ return this.getWishlistRecords(params).pipe(map((response) => {
9175
9217
  if (response.records === undefined) {
9176
9218
  throw response;
9177
9219
  }