@builder.io/sdk 6.1.3 → 6.2.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/dist/index.umd.js CHANGED
@@ -1052,7 +1052,7 @@
1052
1052
 
1053
1053
  var DEFAULT_API_VERSION = 'v3';
1054
1054
 
1055
- var SDK_VERSION = '6.1.3';
1055
+ var SDK_VERSION = '6.2.0';
1056
1056
 
1057
1057
  function datePlusMinutes(minutes) {
1058
1058
  if (minutes === void 0) { minutes = 30; }
@@ -2608,6 +2608,14 @@
2608
2608
  if (this.apiEndpoint === 'content') {
2609
2609
  queryParams.includeRefs = true;
2610
2610
  }
2611
+ if (this.apiEndpoint === 'query') {
2612
+ if ('enrich' in options && options.enrich !== undefined) {
2613
+ queryParams.enrich = options.enrich;
2614
+ }
2615
+ if (options.enrichOptions) {
2616
+ this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
2617
+ }
2618
+ }
2611
2619
  var properties = [
2612
2620
  'prerender',
2613
2621
  'extractCss',
@@ -2635,6 +2643,15 @@
2635
2643
  }
2636
2644
  }
2637
2645
  }
2646
+ // Handle enrich and enrichOptions for content endpoint
2647
+ if (this.apiEndpoint === 'content') {
2648
+ if ('enrich' in options && options.enrich !== undefined) {
2649
+ queryParams.enrich = options.enrich;
2650
+ }
2651
+ if (options.enrichOptions) {
2652
+ this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
2653
+ }
2654
+ }
2638
2655
  }
2639
2656
  if (this.preview && this.previewingModel === ((_b = queue === null || queue === void 0 ? void 0 : queue[0]) === null || _b === void 0 ? void 0 : _b.model)) {
2640
2657
  queryParams.preview = 'true';
@@ -2793,6 +2810,22 @@
2793
2810
  }
2794
2811
  return Builder.isBrowser && setCookie(name, value, expires);
2795
2812
  };
2813
+ /**
2814
+ * Recursively flattens enrichOptions object into dot-notation query parameters
2815
+ * @private
2816
+ */
2817
+ Builder.prototype.flattenEnrichOptions = function (obj, prefix, result) {
2818
+ for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
2819
+ var _b = _a[_i], key = _b[0], value = _b[1];
2820
+ var newKey = "".concat(prefix, ".").concat(key);
2821
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
2822
+ this.flattenEnrichOptions(value, newKey, result);
2823
+ }
2824
+ else {
2825
+ result[newKey] = value;
2826
+ }
2827
+ }
2828
+ };
2796
2829
  Builder.prototype.getContent = function (modelName, options) {
2797
2830
  if (options === void 0) { options = {}; }
2798
2831
  if (!this.apiKey) {