@configura/web-api 3.0.0-alpha.0 → 3.0.0-alpha.1

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.
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { assertDefined, compareArrays, convertLength, count, Observable, someMatch, toLengthUnit, } from "@configura/web-utilities";
10
+ import { Observable, assertDefined, compareArrays, convertLength, count, someMatch, toLengthUnit, } from "@configura/web-utilities";
11
11
  import { CfgProduct } from "../CfgProduct.js";
12
12
  import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
13
13
  import { CfgMtrlApplicationSource } from "../material/CfgMtrlApplicationSource.js";
@@ -216,7 +216,7 @@ export class _CfgFeatureInternal {
216
216
  if (this.ancestorsSelected) {
217
217
  const selectionCount = this._selectedOptions.length;
218
218
  if (isSelectOne && selectionCount !== 1) {
219
- const wrongCountWarning = `A select-one Feature (i.e. neither optional nor multiple) should have exactly one Option selected. Feature key: "${this.key}". Actual: ${selectionCount}`;
219
+ const wrongCountWarning = `A select-one Feature (i.e. neither optional nor multiple) should have exactly one Option selected. Feature code: "${this.code}". Actual: ${selectionCount}`;
220
220
  if (this.rootProduct.settings.strictSelectOneSelectionCount) {
221
221
  throw new Error(wrongCountWarning);
222
222
  }
@@ -91,6 +91,24 @@ export declare class _CfgOptionInternal {
91
91
  private _calculateUpcharge;
92
92
  get upcharge(): number;
93
93
  get priceChangeAtSelectChange(): number;
94
+ /**
95
+ * Get the child features that are contained within this option.
96
+ *
97
+ * Safe to call outside of the sync process, but may not contain any
98
+ * children until the sync process is complete.
99
+ */
100
+ getFeaturesOutsideSync(): CfgFeature[];
101
+ /**
102
+ * Get the child features that are contained within this option.
103
+ *
104
+ * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS:
105
+ * 1. The product is undergoing the sync group sync process.
106
+ * 2. AND you are operating on the new "target" product.
107
+ *
108
+ * Explanation: This method will generate all children if they have not been
109
+ * generated yet, which breaks sync group syncing, due to the presence of
110
+ * these children being used to determine if the sync should happen at all.
111
+ */
94
112
  get features(): CfgFeature[];
95
113
  /** Called by child to tell its parent that it has changed. */
96
114
  _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
@@ -154,6 +172,24 @@ export declare class CfgOption {
154
172
  get thumbnail(): string | undefined;
155
173
  get upcharge(): number;
156
174
  get priceChangeAtSelectChange(): number;
175
+ /**
176
+ * Get the child features that are contained within this option.
177
+ *
178
+ * Safe to call outside of the sync process, but may not contain any
179
+ * children until the sync process is complete.
180
+ */
181
+ getFeaturesOutsideSync(): CfgFeature[];
182
+ /**
183
+ * Get the child features that are contained within this option.
184
+ *
185
+ * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS:
186
+ * 1. The product is undergoing the sync group sync process.
187
+ * 2. AND you are operating on the new "target" product.
188
+ *
189
+ * Explanation: This method will generate all children if they have not been
190
+ * generated yet, which breaks sync group syncing, due to the presence of
191
+ * these children being used to determine if the sync should happen at all.
192
+ */
157
193
  get features(): CfgFeature[];
158
194
  listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
159
195
  stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { compareArrays, count, Observable, } from "@configura/web-utilities";
10
+ import { Observable, compareArrays, count, } from "@configura/web-utilities";
11
11
  import { CfgProduct } from "../CfgProduct.js";
12
12
  import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
13
13
  import { CfgMtrlApplicationSource } from "../material/CfgMtrlApplicationSource.js";
@@ -345,6 +345,27 @@ export class _CfgOptionInternal {
345
345
  }
346
346
  return 0;
347
347
  }
348
+ /**
349
+ * Get the child features that are contained within this option.
350
+ *
351
+ * Safe to call outside of the sync process, but may not contain any
352
+ * children until the sync process is complete.
353
+ */
354
+ getFeaturesOutsideSync() {
355
+ var _a;
356
+ return (_a = this._features) !== null && _a !== void 0 ? _a : [];
357
+ }
358
+ /**
359
+ * Get the child features that are contained within this option.
360
+ *
361
+ * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS:
362
+ * 1. The product is undergoing the sync group sync process.
363
+ * 2. AND you are operating on the new "target" product.
364
+ *
365
+ * Explanation: This method will generate all children if they have not been
366
+ * generated yet, which breaks sync group syncing, due to the presence of
367
+ * these children being used to determine if the sync should happen at all.
368
+ */
348
369
  get features() {
349
370
  if (this._features === undefined) {
350
371
  const allRefs = this.rawOption.featureRefs || [];
@@ -458,6 +479,26 @@ export class CfgOption {
458
479
  get priceChangeAtSelectChange() {
459
480
  return this._internal.priceChangeAtSelectChange;
460
481
  }
482
+ /**
483
+ * Get the child features that are contained within this option.
484
+ *
485
+ * Safe to call outside of the sync process, but may not contain any
486
+ * children until the sync process is complete.
487
+ */
488
+ getFeaturesOutsideSync() {
489
+ return this._internal.getFeaturesOutsideSync();
490
+ }
491
+ /**
492
+ * Get the child features that are contained within this option.
493
+ *
494
+ * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS:
495
+ * 1. The product is undergoing the sync group sync process.
496
+ * 2. AND you are operating on the new "target" product.
497
+ *
498
+ * Explanation: This method will generate all children if they have not been
499
+ * generated yet, which breaks sync group syncing, due to the presence of
500
+ * these children being used to determine if the sync should happen at all.
501
+ */
461
502
  get features() {
462
503
  return this._internal.features;
463
504
  }
@@ -585,5 +585,5 @@ function getFeaturesFromProduct(product) {
585
585
  }
586
586
  function getFeaturesFromOption(option) {
587
587
  var _a;
588
- return pairFeatures(option.target.features, (_a = option.initial) === null || _a === void 0 ? void 0 : _a.features);
588
+ return pairFeatures(option.target.features, (_a = option.initial) === null || _a === void 0 ? void 0 : _a.getFeaturesOutsideSync());
589
589
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-api",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@configura/web-utilities": "3.0.0-alpha.0"
26
+ "@configura/web-utilities": "3.0.0-alpha.1"
27
27
  },
28
- "gitHead": "9fe91599222572a8625a70c03d745f1f2e5eb85b"
28
+ "gitHead": "0d18e1a05f913a1367cba0293ee61c5a3320a509"
29
29
  }