@spiffcommerce/core 17.5.0-alpha.1 → 17.5.0-alpha.3

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.d.ts CHANGED
@@ -1434,7 +1434,7 @@ interface WorkflowExperience {
1434
1434
  * @param experience The experience to take selections from.
1435
1435
  * @param filter A list of steps to apply the selections to. If undefined all steps will be updated.
1436
1436
  */
1437
- copySelections(experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): any;
1437
+ copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1438
1438
  /**
1439
1439
  * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
1440
1440
  * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
@@ -1511,7 +1511,7 @@ declare class WorkflowExperienceImpl implements WorkflowExperience {
1511
1511
  getSelectionPriceSubunits(): number;
1512
1512
  getBasePriceSubunits(): number;
1513
1513
  getTotalPriceSubunits(): number;
1514
- copySelections(experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): void;
1514
+ copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1515
1515
  getStepByName(name: string): TextStepHandle | FrameStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
1516
1516
  getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1517
1517
  getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
package/dist/index.js CHANGED
@@ -6519,22 +6519,22 @@ class dA {
6519
6519
  getTotalPriceSubunits() {
6520
6520
  return this.getBasePriceSubunits() + this.getSelectionPriceSubunits();
6521
6521
  }
6522
- copySelections(A, e) {
6523
- const t = e == null ? void 0 : e.map((s) => s.getId()), a = this.getSteps().filter((s) => t === void 0 || t.includes(s.getId())), n = A.getSteps();
6524
- a.forEach((s) => {
6525
- const i = /* @__PURE__ */ new Set(), o = s.getRaw().globalPropertyAspectConfigurations;
6526
- o !== void 0 && (o.forEach((r) => i.add(JSON.stringify(r))), console.log(o), n.forEach((r) => {
6527
- const g = r.getRaw().globalPropertyAspectConfigurations;
6528
- g !== void 0 && g.forEach((B) => {
6529
- const l = i.has(JSON.stringify(B));
6530
- if (l && B.aspectName === "Option") {
6531
- const w = r.getCurrentVariant();
6532
- if (!w)
6522
+ async copySelectionsViaGlobalConfiguration(A, e, t) {
6523
+ const a = await A.getGlobalProperties(), n = t == null ? void 0 : t.map((r) => r.getId()), s = this.getSteps().filter((r) => n === void 0 || n.includes(r.getId())), i = e.getSteps(), o = (r) => a.find((g) => g.getRawProperty().name === r.aspectName);
6524
+ s.forEach((r) => {
6525
+ const g = /* @__PURE__ */ new Set(), B = r.getRaw().globalPropertyAspectConfigurations;
6526
+ B !== void 0 && (B.forEach((l) => g.add(JSON.stringify(l))), console.log(B), i.forEach((l) => {
6527
+ const w = l.getRaw().globalPropertyAspectConfigurations;
6528
+ w !== void 0 && w.forEach((d) => {
6529
+ const C = o(d), E = g.has(JSON.stringify(d));
6530
+ if (E && (C == null ? void 0 : C.getType()) === "Option") {
6531
+ const Q = l.getCurrentVariant();
6532
+ if (!Q)
6533
6533
  return;
6534
- s.selectVariant(w), i.delete(JSON.stringify(B));
6535
- } else if (l && B.aspectName === "Text") {
6536
- const w = r.getText();
6537
- s.setText(w), i.delete(JSON.stringify(B));
6534
+ r.selectVariant(Q), g.delete(JSON.stringify(d));
6535
+ } else if (E && (C == null ? void 0 : C.getType()) === "Text") {
6536
+ const Q = l.getText();
6537
+ r.setText(Q), g.delete(JSON.stringify(d));
6538
6538
  }
6539
6539
  });
6540
6540
  }));