@spiffcommerce/core 22.5.0 → 22.5.2
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 +9 -2
- package/dist/index.js +59 -46
- package/dist/index.umd.cjs +17 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -789,9 +789,13 @@ interface WorkflowExperience {
|
|
|
789
789
|
*/
|
|
790
790
|
getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
|
|
791
791
|
/**
|
|
792
|
-
* Returns all steps in the workflow
|
|
792
|
+
* Returns all steps in the workflow. Ordered by scene and appearance within their respective scenes.
|
|
793
793
|
*/
|
|
794
794
|
getSteps(): StepHandle<AnyStepData>[];
|
|
795
|
+
/**
|
|
796
|
+
* Returns all steps in the workflow that are conditionally active. Ordered by scene and appearance within their respective scenes.
|
|
797
|
+
*/
|
|
798
|
+
getStepsConditionallyActive(): StepHandle<AnyStepData>[];
|
|
795
799
|
/**
|
|
796
800
|
* Returns a list of scenes that are configured in the workflow. Each scene
|
|
797
801
|
* contains a list of steps. See getStepsByScene to access these.
|
|
@@ -944,6 +948,7 @@ declare class WorkflowExperienceImpl implements WorkflowExperience {
|
|
|
944
948
|
createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
|
|
945
949
|
getStepById(id: string): StepHandle<any> | undefined;
|
|
946
950
|
getSteps(): StepHandle<AnyStepData>[];
|
|
951
|
+
getStepsConditionallyActive(): StepHandle<AnyStepData>[];
|
|
947
952
|
getScenes(): Scene[];
|
|
948
953
|
getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
|
|
949
954
|
getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
|
|
@@ -2068,6 +2073,7 @@ interface WorkflowManager {
|
|
|
2068
2073
|
}) => void;
|
|
2069
2074
|
getWorkflow: () => Workflow;
|
|
2070
2075
|
getWorkflowSelections: () => WorkflowSelections;
|
|
2076
|
+
getStepSelections: () => StepSelections;
|
|
2071
2077
|
getProduct: () => Product;
|
|
2072
2078
|
/**
|
|
2073
2079
|
* A promise resolving when the initial state of the workflow has completed loading.
|
|
@@ -3133,6 +3139,7 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
3133
3139
|
markUpdateCompleted(_update: string): void;
|
|
3134
3140
|
markUpdatePending(): string;
|
|
3135
3141
|
getWorkflowSelections(): {};
|
|
3142
|
+
getStepSelections(): {};
|
|
3136
3143
|
setCurrentAdjustingStepId(_stepId: string): void;
|
|
3137
3144
|
setEditedStatus(_stepName: string, _status: boolean): void;
|
|
3138
3145
|
setInformationResults(_results: InformationResult[]): void;
|
|
@@ -3537,4 +3544,4 @@ declare class ModuleStepHandle extends StepHandle<ModuleStepData> {
|
|
|
3537
3544
|
setText(value: string): void;
|
|
3538
3545
|
}
|
|
3539
3546
|
|
|
3540
|
-
export { AddonHandle, ArrayInput, AssetNotFoundError, Bundle$1 as Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CollectionProduct, ColorOption, ColorOptionGlobalPropertyHandle, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, DigitalContentStepHandle, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, ModuleStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, PmsSearchResult, Product, ProductCameraRig, ProductCollection, ProductWorkflow$1 as ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, ToastCallback, Transaction, TransactionShareAction, TransactionShareActionType, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, browserColorToHex, createDesign, designService, digitalContentStepService, findPmsColors, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, matchHexToPms, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, pmsToRgb, questionStepService, rgbToPms, setBearerAuthenticationToken, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
|
|
3547
|
+
export { AddonHandle, ArrayInput, AssetNotFoundError, Bundle$1 as Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CollectionProduct, ColorOption, ColorOptionGlobalPropertyHandle, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, DigitalContentStepHandle, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, Integration, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, ModuleStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, PmsSearchResult, Product, ProductCameraRig, ProductCollection, ProductWorkflow$1 as ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, ToastCallback, Transaction, TransactionShareAction, TransactionShareActionType, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, browserColorToHex, createDesign, designService, digitalContentStepService, findPmsColors, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, matchHexToPms, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, pmsToRgb, questionStepService, rgbToPms, setBearerAuthenticationToken, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHttpLink as vA, InMemoryCache as HA, ApolloClient as UA, from as kA, gql as f } from "@apollo/client/core";
|
|
2
|
-
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as U, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as TA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as ve, fetchAsString as _, DeleteElementCommand as
|
|
2
|
+
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as U, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as TA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as ve, fetchAsString as _, DeleteElementCommand as ae, generateDefaultRectangleFrameSvg as ft, GetSVGDimensions as OA, patternImageDataCache as Ft, fetchAsArrayBuffer as LA, findElement as He, modifySVGWithElementProperties as zA, IllustrationColorCommand as et, IllustrationCacheCommand as KA, getFontMetrics as jA, getPatternImageData as tt, FontAlignmentCommand as VA, FontColorCommand as WA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as Ne, FontSourceCommand as yt, loadFont as gt, TextChangeCommand as XA, FontSizeCommand as qA, createElementNS as ZA, createElement as fe, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as Mt, CommandContext as $A, createCanvas as Ue, getSvgElement as Lt, LayoutRenderingPurpose as zt, renderPapyrusComponentAsString as Kt, loadImage as jt, getDomParser as Vt, toBase64 as St, getVariant as _A, generateFrameSVG as ea, getDefaultVariant as Le, domParser as Wt, sanitizeSvgTree as Xt, traverse as ta, xmlSerializer as qt, CreateLayoutCommand as Aa, AspectType as $, rehydrateSerializedLayout as ie } from "@spiffcommerce/papyrus";
|
|
3
3
|
import { AspectType as ys, AssetType as Ms, BringForwardCommand as Ss, BringToBackCommand as Ys, BringToFrontCommand as Ps, CanvasCommand as xs, CommandContext as Ns, CreateElementCommand as Rs, CreateLayoutCommand as vs, DeleteElementCommand as Hs, FontAlignmentCommand as Us, FontColorCommand as ks, FontSizeCommand as Gs, FontSourceCommand as bs, GroupCommand as Js, LayoutElementFactory as Ts, LayoutElementType as Os, MoveCommand as Ls, ResizeCommand as zs, RotateCommand as Ks, SendBackwardsCommand as js, StepAspectType as Vs, StepType as Ws, TextChangeCommand as Xs, UnitOfMeasurement as qs, UpdateImageSourceCommand as Zs, dataUrlFromExternalUrl as $s, determineCorrectFontSizeAndLines as _s, findElement as eo, frameDataCache as to, generate as Ao, generateSVGWithUnknownColors as ao, getAttributesFromArrayBuffer as no, getAxisAlignedBoundingBox as io, getFrameData as so, getSvgElement as oo, loadFont as ro, patternImageDataCache as co, registerFetchImplementation as go, registerWindowImplementation as lo, rehydrateSerializedLayout as Bo, setCanvasModule as Co, svgToDataUrl as wo } from "@spiffcommerce/papyrus";
|
|
4
4
|
import { setContext as aa } from "@apollo/client/link/context";
|
|
5
5
|
import { onError as na } from "@apollo/client/link/error";
|
|
@@ -32,7 +32,7 @@ class z extends De {
|
|
|
32
32
|
super(`Panel not Found: ${e.panelId}`), this.panelId = (e == null ? void 0 : e.panelId) || "N/A";
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class ne extends De {
|
|
36
36
|
constructor(e) {
|
|
37
37
|
super(`Asset not found for variant: ${e.name}`), this.variant = e;
|
|
38
38
|
}
|
|
@@ -475,7 +475,7 @@ class Da {
|
|
|
475
475
|
g.lengthComputable && A(g.loaded * 100 / g.total);
|
|
476
476
|
}, r.onload = () => {
|
|
477
477
|
const g = i.assetResponse.asset;
|
|
478
|
-
|
|
478
|
+
se.add(i.assetResponse.asset), s(g);
|
|
479
479
|
}, r.onerror = o, r.send(e.blob);
|
|
480
480
|
}), this.cacheAsset(i.assetResponse.asset), i.assetResponse.asset;
|
|
481
481
|
}
|
|
@@ -516,7 +516,7 @@ class Da {
|
|
|
516
516
|
});
|
|
517
517
|
if (this.bgrmProcessCache.delete(t), !((s = (i = n.data) == null ? void 0 : i.assetRemoveBackground) != null && s.key))
|
|
518
518
|
throw new Error("Failed to remove background from image");
|
|
519
|
-
return
|
|
519
|
+
return se.add(n.data.assetRemoveBackground), K.add(t, n.data.assetRemoveBackground.key), this.cache.set(
|
|
520
520
|
n.data.assetRemoveBackground.key,
|
|
521
521
|
Promise.resolve(n.data.assetRemoveBackground)
|
|
522
522
|
), n.data.assetRemoveBackground;
|
|
@@ -524,16 +524,16 @@ class Da {
|
|
|
524
524
|
return this.bgrmProcessCache.set(t, a), a;
|
|
525
525
|
}
|
|
526
526
|
removePersistedAsset(e) {
|
|
527
|
-
|
|
527
|
+
se.remove(e), K.delete(e), K.deleteForBgRemovedKey(e);
|
|
528
528
|
}
|
|
529
529
|
getPersistedAssets() {
|
|
530
|
-
return
|
|
530
|
+
return se.list();
|
|
531
531
|
}
|
|
532
532
|
registerPersistedAssetListener(e) {
|
|
533
|
-
|
|
533
|
+
se.addCallback(e);
|
|
534
534
|
}
|
|
535
535
|
unRegisterPersistedAssetListener(e) {
|
|
536
|
-
|
|
536
|
+
se.removeCallback(e);
|
|
537
537
|
}
|
|
538
538
|
/**
|
|
539
539
|
* Handles mimeType resolution & asset creation request
|
|
@@ -614,7 +614,7 @@ const le = "persistentAssets", nA = class ee {
|
|
|
614
614
|
}
|
|
615
615
|
};
|
|
616
616
|
nA.callbacks = [];
|
|
617
|
-
let
|
|
617
|
+
let se = nA;
|
|
618
618
|
const Nt = "bgrmPersistentAssets";
|
|
619
619
|
class K {
|
|
620
620
|
static has(e) {
|
|
@@ -1486,7 +1486,7 @@ const Ja = f`
|
|
|
1486
1486
|
],
|
|
1487
1487
|
silentSteps: []
|
|
1488
1488
|
}), e;
|
|
1489
|
-
}, Ka = (c, e) => e.find((t) => t.stepNames.includes(c)),
|
|
1489
|
+
}, Ka = (c, e) => e.find((t) => t.stepNames.includes(c)), Ae = (c, e) => (c.conditions || []).every((t) => {
|
|
1490
1490
|
const A = e[t.targetStepName];
|
|
1491
1491
|
if (A && A.selectedVariants) {
|
|
1492
1492
|
const a = A.selectedVariants;
|
|
@@ -1499,13 +1499,13 @@ const Ja = f`
|
|
|
1499
1499
|
const t = {
|
|
1500
1500
|
name: c.name,
|
|
1501
1501
|
title: c.title,
|
|
1502
|
-
renderableSteps: c.renderableSteps.filter((A) =>
|
|
1503
|
-
silentSteps: c.silentSteps.filter((A) =>
|
|
1502
|
+
renderableSteps: c.renderableSteps.filter((A) => Ae(A, e)),
|
|
1503
|
+
silentSteps: c.silentSteps.filter((A) => Ae(A, e))
|
|
1504
1504
|
};
|
|
1505
1505
|
return t.silentSteps.length === 0 && t.renderableSteps.length === 0 ? null : t;
|
|
1506
|
-
},
|
|
1506
|
+
}, re = (c, e) => c.map((t) => ja(t, e)).filter((t) => t !== null), Va = async (c, e, t = !1) => {
|
|
1507
1507
|
var i;
|
|
1508
|
-
const A =
|
|
1508
|
+
const A = re(c, e), a = [];
|
|
1509
1509
|
for (const s of A)
|
|
1510
1510
|
for (const o of s.renderableSteps) {
|
|
1511
1511
|
const r = (((i = o.option) == null ? void 0 : i.variants) || []).length;
|
|
@@ -2006,7 +2006,7 @@ class Za {
|
|
|
2006
2006
|
40
|
|
2007
2007
|
);
|
|
2008
2008
|
});
|
|
2009
|
-
e.forEach((C) => A.getCommandDispatcher()(new
|
|
2009
|
+
e.forEach((C) => A.getCommandDispatcher()(new ae(C.id)));
|
|
2010
2010
|
const s = a.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", o = new URL(s + a.data.baseUrl);
|
|
2011
2011
|
o.searchParams.append("video", btoa(JSON.stringify([i]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
|
|
2012
2012
|
const r = o.toString();
|
|
@@ -4798,7 +4798,7 @@ class An {
|
|
|
4798
4798
|
return ft(t);
|
|
4799
4799
|
const A = e.asset;
|
|
4800
4800
|
if (!A)
|
|
4801
|
-
throw new
|
|
4801
|
+
throw new ne(e);
|
|
4802
4802
|
const a = A.fileLink;
|
|
4803
4803
|
if (a)
|
|
4804
4804
|
return _(a, !0);
|
|
@@ -5082,7 +5082,7 @@ class An {
|
|
|
5082
5082
|
n && n(!0);
|
|
5083
5083
|
const r = await Promise.all(
|
|
5084
5084
|
e.data.regions.map(async (C, d) => {
|
|
5085
|
-
const E = await rt(o[d]), w = s.getImageData(), u = A.map((p) => new
|
|
5085
|
+
const E = await rt(o[d]), w = s.getImageData(), u = A.map((p) => new ae(p.id)), h = w ? ct(w, E) : void 0, I = w ? {
|
|
5086
5086
|
id: J(),
|
|
5087
5087
|
src: w.src,
|
|
5088
5088
|
x: (h == null ? void 0 : h.x) || 0,
|
|
@@ -5334,11 +5334,11 @@ class an {
|
|
|
5334
5334
|
if (!e.data || !e.data.regions)
|
|
5335
5335
|
throw new Ge(e, "Missing regions.");
|
|
5336
5336
|
a(!0);
|
|
5337
|
-
const i = A.map((h) => new
|
|
5337
|
+
const i = A.map((h) => new ae(h.id));
|
|
5338
5338
|
e.mandatory && n.setMandatoryFulfilled(e.stepName, !1);
|
|
5339
5339
|
const s = t.asset;
|
|
5340
5340
|
if (!s)
|
|
5341
|
-
throw new
|
|
5341
|
+
throw new ne(t);
|
|
5342
5342
|
const o = s.fileLink;
|
|
5343
5343
|
if (!o)
|
|
5344
5344
|
throw new ue(s);
|
|
@@ -5446,7 +5446,7 @@ class nn {
|
|
|
5446
5446
|
a(!0);
|
|
5447
5447
|
const i = t.material;
|
|
5448
5448
|
if (!i)
|
|
5449
|
-
throw a(!1), new
|
|
5449
|
+
throw a(!1), new ne(t);
|
|
5450
5450
|
return {
|
|
5451
5451
|
command: void 0,
|
|
5452
5452
|
followup: async () => {
|
|
@@ -5501,7 +5501,7 @@ class sn {
|
|
|
5501
5501
|
if (C && e.option) {
|
|
5502
5502
|
const E = (d = B.asset) == null ? void 0 : d.fileLink;
|
|
5503
5503
|
if (!E)
|
|
5504
|
-
throw new
|
|
5504
|
+
throw new ne(B);
|
|
5505
5505
|
await C.applyModelVariant(
|
|
5506
5506
|
e.stepName || "",
|
|
5507
5507
|
{
|
|
@@ -5526,7 +5526,7 @@ class sn {
|
|
|
5526
5526
|
a(!0);
|
|
5527
5527
|
const n = (i = t.asset) == null ? void 0 : i.fileLink;
|
|
5528
5528
|
if (!n)
|
|
5529
|
-
throw new
|
|
5529
|
+
throw new ne(t);
|
|
5530
5530
|
return {
|
|
5531
5531
|
command: void 0,
|
|
5532
5532
|
followup: async () => {
|
|
@@ -5589,7 +5589,7 @@ class on {
|
|
|
5589
5589
|
if (!w)
|
|
5590
5590
|
return console.error(`Can not find layout for region: ${l.panelId}`), null;
|
|
5591
5591
|
const u = [];
|
|
5592
|
-
return C && u.push(new
|
|
5592
|
+
return C && u.push(new ae(d)), u.push(
|
|
5593
5593
|
new O(
|
|
5594
5594
|
{
|
|
5595
5595
|
stepRegion: l,
|
|
@@ -5706,12 +5706,12 @@ class rn {
|
|
|
5706
5706
|
async selectVariantCommand(e, t, A, a) {
|
|
5707
5707
|
const n = t.asset;
|
|
5708
5708
|
if (!n)
|
|
5709
|
-
throw new
|
|
5709
|
+
throw new ne(t);
|
|
5710
5710
|
const i = n == null ? void 0 : n.fileLink;
|
|
5711
5711
|
if (!i)
|
|
5712
5712
|
return console.error("No URL for picture!"), null;
|
|
5713
5713
|
a(!0), e.mandatory && A.setMandatoryFulfilled(e.stepName, !1);
|
|
5714
|
-
const o = A.getRegionElements(e.stepName).map((B) => new
|
|
5714
|
+
const o = A.getRegionElements(e.stepName).map((B) => new ae(B.id)), r = (B) => {
|
|
5715
5715
|
const C = A.getLayouts().find((E) => E.panelId === B.panelId);
|
|
5716
5716
|
if (!C)
|
|
5717
5717
|
throw new z(B);
|
|
@@ -6303,7 +6303,7 @@ class dn {
|
|
|
6303
6303
|
async fontDataFromVariant(e) {
|
|
6304
6304
|
const t = e.asset;
|
|
6305
6305
|
if (!t)
|
|
6306
|
-
throw new
|
|
6306
|
+
throw new ne(e);
|
|
6307
6307
|
const A = t.fileLink;
|
|
6308
6308
|
if (!A)
|
|
6309
6309
|
throw new ue(t);
|
|
@@ -8151,7 +8151,7 @@ class Mn {
|
|
|
8151
8151
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((s) => {
|
|
8152
8152
|
this.storage[s.stepName] = s.storage || {};
|
|
8153
8153
|
}), this.allScenes = await za(e);
|
|
8154
|
-
const a =
|
|
8154
|
+
const a = re(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: n, commands: i } = await this.stepElementsForIntroducedSilentSteps(a, !!this.reloadedState);
|
|
8155
8155
|
this.commandContext.apply(new U(i), !0), this.stepElements = { ...this.stepElements, ...n }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && t();
|
|
8156
8156
|
}
|
|
8157
8157
|
getWorkflowExperience() {
|
|
@@ -8286,6 +8286,9 @@ class Mn {
|
|
|
8286
8286
|
});
|
|
8287
8287
|
}), e;
|
|
8288
8288
|
}
|
|
8289
|
+
getStepSelections() {
|
|
8290
|
+
return this.stepSelections;
|
|
8291
|
+
}
|
|
8289
8292
|
markStepsAsInitialised(e) {
|
|
8290
8293
|
const t = { ...this.stepInitialised };
|
|
8291
8294
|
e.forEach((A) => {
|
|
@@ -8348,7 +8351,7 @@ class Mn {
|
|
|
8348
8351
|
},
|
|
8349
8352
|
{ refocusCamera: t }
|
|
8350
8353
|
);
|
|
8351
|
-
this.setModelContainer(A),
|
|
8354
|
+
this.setModelContainer(A), re(this.allScenes, this.stepSelections).filter((i) => i).map((i) => i.renderableSteps).flat().filter((i) => i.type === F.Model || i.type === F.Material).forEach((i) => {
|
|
8352
8355
|
var r, g, B;
|
|
8353
8356
|
if (!((r = i.option) != null && r.id)) {
|
|
8354
8357
|
console.error(`Failed to read option id from step: ${i.stepName}`);
|
|
@@ -8488,12 +8491,12 @@ class Mn {
|
|
|
8488
8491
|
this.stepElements = t(this.stepElements, e);
|
|
8489
8492
|
}
|
|
8490
8493
|
getInvalidCanvasRegions() {
|
|
8491
|
-
return this.workflow.steps.reduce((e, t) => (
|
|
8494
|
+
return this.workflow.steps.reduce((e, t) => (Ae(t, this.stepSelections) || this.stepElements[t.stepName] && this.stepElements[t.stepName].forEach(
|
|
8492
8495
|
(A) => e.push(A)
|
|
8493
8496
|
), e), []);
|
|
8494
8497
|
}
|
|
8495
8498
|
getInvalidModelVariants() {
|
|
8496
|
-
return this.workflow.steps.reduce((e, t) => (t.type === F.Model && !
|
|
8499
|
+
return this.workflow.steps.reduce((e, t) => (t.type === F.Model && !Ae(t, this.stepSelections) && e.push(t.stepName), e), []);
|
|
8497
8500
|
}
|
|
8498
8501
|
async stepElementsForIntroducedSilentSteps(e, t) {
|
|
8499
8502
|
const A = this.product;
|
|
@@ -8559,7 +8562,7 @@ class Mn {
|
|
|
8559
8562
|
async reset() {
|
|
8560
8563
|
this.commandContext.getAllLayouts().forEach(
|
|
8561
8564
|
(t) => t.layoutState.elements.forEach((A) => {
|
|
8562
|
-
this.getCommandDispatcher()(new
|
|
8565
|
+
this.getCommandDispatcher()(new ae(A.id));
|
|
8563
8566
|
})
|
|
8564
8567
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
|
8565
8568
|
}
|
|
@@ -8570,13 +8573,13 @@ class Mn {
|
|
|
8570
8573
|
...this.stepSelections,
|
|
8571
8574
|
[e]: { selectedVariants: t }
|
|
8572
8575
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((Q, p) => Q + p.selectedVariants.map((y) => y.priceModifier || 0).reduce((y, M) => y + M, 0), 0), this.workflow.steps.forEach((Q) => {
|
|
8573
|
-
|
|
8576
|
+
Ae(Q, this.stepSelections) || (this.stepInitialised[Q.stepName] = !1, delete this.stepMetadata[Q.stepName], delete this.stepSelections[Q.stepName], delete this.storage[Q.stepName]);
|
|
8574
8577
|
});
|
|
8575
|
-
const i = this.allScenes, s =
|
|
8578
|
+
const i = this.allScenes, s = re(i, n), o = re(i, this.stepSelections), r = s.map((Q) => Q.silentSteps).flat(), B = o.map((Q) => Q.silentSteps).flat().filter(
|
|
8576
8579
|
(Q) => !r.some((p) => p.stepName === Q.stepName)
|
|
8577
8580
|
);
|
|
8578
8581
|
r.forEach((Q) => {
|
|
8579
|
-
|
|
8582
|
+
Ae(Q, this.stepSelections) || (this.stepInitialised[Q.stepName] = !1);
|
|
8580
8583
|
});
|
|
8581
8584
|
const l = this.getInvalidCanvasRegions(), { stepElements: C, commands: d } = await this.stepElementsForIntroducedSilentSteps(B, !1);
|
|
8582
8585
|
this.stepElements = {
|
|
@@ -8589,7 +8592,7 @@ class Mn {
|
|
|
8589
8592
|
const Q = this.getStepSpecificServices(e);
|
|
8590
8593
|
(m = Q == null ? void 0 : Q.frameService) == null || m.setTargetElements(A.map((p) => p.id));
|
|
8591
8594
|
}
|
|
8592
|
-
const w = l.map((Q) => new
|
|
8595
|
+
const w = l.map((Q) => new ae(Q.id)), u = new Mt(this.constructSerializableWorkflow()), h = [...d, ...w, u];
|
|
8593
8596
|
h.length > 0 && this.commandContext.apply(new U(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
8594
8597
|
const I = this.getInvalidModelVariants(), D = this.modelContainer;
|
|
8595
8598
|
if (D) {
|
|
@@ -8607,7 +8610,7 @@ class Mn {
|
|
|
8607
8610
|
await this.onSelectionChange(), a && await a();
|
|
8608
8611
|
}
|
|
8609
8612
|
async ensureStepsAreLoaded() {
|
|
8610
|
-
const t =
|
|
8613
|
+
const t = re(this.allScenes, this.stepSelections).map((o) => o.renderableSteps), A = [], a = t.flat();
|
|
8611
8614
|
for (const o of a)
|
|
8612
8615
|
if (!this.stepInitialised[o.stepName])
|
|
8613
8616
|
switch (this.stepInitialised[o.stepName] = !0, o.type) {
|
|
@@ -9996,6 +9999,13 @@ class Se {
|
|
|
9996
9999
|
getSteps() {
|
|
9997
10000
|
return this.getScenes().flatMap((e) => this.getStepsByScene(e));
|
|
9998
10001
|
}
|
|
10002
|
+
getStepsConditionallyActive() {
|
|
10003
|
+
return this.getScenes().flatMap(
|
|
10004
|
+
(e) => this.getStepsByScene(e).filter(
|
|
10005
|
+
(t) => Ae(t.getRaw(), this.getWorkflowManager().getStepSelections())
|
|
10006
|
+
)
|
|
10007
|
+
);
|
|
10008
|
+
}
|
|
9999
10009
|
getScenes() {
|
|
10000
10010
|
return this.getWorkflowManager().getWorkflow().stepGroups.map((t) => ({
|
|
10001
10011
|
id: t.id,
|
|
@@ -11331,7 +11341,7 @@ class pt {
|
|
|
11331
11341
|
*/
|
|
11332
11342
|
getSharedSteps(e) {
|
|
11333
11343
|
return (e ?? this.bundle.getWorkflowExperiences()).flatMap(
|
|
11334
|
-
(a) => a.
|
|
11344
|
+
(a) => a.getStepsConditionallyActive().filter((n) => {
|
|
11335
11345
|
var i;
|
|
11336
11346
|
return n.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (i = n.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : i.some(
|
|
11337
11347
|
(s) => {
|
|
@@ -13458,7 +13468,7 @@ const bi = f`
|
|
|
13458
13468
|
}
|
|
13459
13469
|
}
|
|
13460
13470
|
}
|
|
13461
|
-
`,
|
|
13471
|
+
`, oe = async (c) => {
|
|
13462
13472
|
var e;
|
|
13463
13473
|
for (const t in c.layouts) {
|
|
13464
13474
|
const A = c.layouts[t].elements.filter(
|
|
@@ -13535,7 +13545,7 @@ class es {
|
|
|
13535
13545
|
} catch (A) {
|
|
13536
13546
|
throw console.error(A), new H("Critical - Unable to synchronize workflow state with server.");
|
|
13537
13547
|
}
|
|
13538
|
-
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.5.
|
|
13548
|
+
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.5.2"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
13539
13549
|
}
|
|
13540
13550
|
/** @deprecated Use `configure` instead */
|
|
13541
13551
|
configureUrls(e, t, A) {
|
|
@@ -13952,10 +13962,10 @@ class es {
|
|
|
13952
13962
|
};
|
|
13953
13963
|
if (a.type === "transaction" && i.workflowState) {
|
|
13954
13964
|
const w = JSON.parse(i.workflowState);
|
|
13955
|
-
r.layouts = Object.values(w.layouts).map((u) => u.layout), await
|
|
13965
|
+
r.layouts = Object.values(w.layouts).map((u) => u.layout), await ie(w), await oe(w), r.reloadedState = w;
|
|
13956
13966
|
} else if (!o && a.workflowState) {
|
|
13957
13967
|
const w = JSON.parse(a.workflowState);
|
|
13958
|
-
r.layouts = Object.values(w.layouts).map((u) => u.layout), await
|
|
13968
|
+
r.layouts = Object.values(w.layouts).map((u) => u.layout), await ie(w), await oe(w), r.reloadedState = w;
|
|
13959
13969
|
} else
|
|
13960
13970
|
r.layouts = $e(
|
|
13961
13971
|
r.transaction,
|
|
@@ -14067,10 +14077,10 @@ class es {
|
|
|
14067
14077
|
};
|
|
14068
14078
|
if (N.type === "transaction" && Q.workflowState) {
|
|
14069
14079
|
const T = JSON.parse(Q.workflowState);
|
|
14070
|
-
R.layouts = Object.values(T.layouts || {}).map((W) => W.layout), await
|
|
14080
|
+
R.layouts = Object.values(T.layouts || {}).map((W) => W.layout), await ie(T), await oe(T), R.reloadedState = T;
|
|
14071
14081
|
} else if (!y && N.workflowState) {
|
|
14072
14082
|
const T = JSON.parse(N.workflowState);
|
|
14073
|
-
R.layouts = Object.values(T.layouts || {}).map((W) => W.layout), await
|
|
14083
|
+
R.layouts = Object.values(T.layouts || {}).map((W) => W.layout), await ie(T), await oe(T), R.reloadedState = T;
|
|
14074
14084
|
} else
|
|
14075
14085
|
R.layouts = $e(
|
|
14076
14086
|
R.transaction,
|
|
@@ -14217,7 +14227,7 @@ class es {
|
|
|
14217
14227
|
const o = await xe(this.experienceOptions.transaction.workflowId);
|
|
14218
14228
|
if (this.experienceOptions.workflow = o, this.experienceOptions.transaction.workflowState) {
|
|
14219
14229
|
const g = JSON.parse(this.experienceOptions.transaction.workflowState);
|
|
14220
|
-
this.experienceOptions.layouts = Object.values(g.layouts).map((B) => B.layout), await
|
|
14230
|
+
this.experienceOptions.layouts = Object.values(g.layouts).map((B) => B.layout), await ie(g), await oe(g), this.experienceOptions.reloadedState = g;
|
|
14221
14231
|
}
|
|
14222
14232
|
this.experienceOptions.previewService = A && A(o), this.experienceOptions.renderableContextService = new Ye(this.experienceOptions.layouts), (a = this.experienceOptions.product) != null && a.modelUrl && (this.experienceOptions.modelContainer = (n = this.experienceOptions.previewService) == null ? void 0 : n.loadModel({
|
|
14223
14233
|
model: this.experienceOptions.product.modelUrl,
|
|
@@ -14239,7 +14249,7 @@ class es {
|
|
|
14239
14249
|
}), B = xe(e);
|
|
14240
14250
|
if (await Promise.all([g, B]), this.experienceOptions.workflow = await B, t) {
|
|
14241
14251
|
const C = JSON.parse(t);
|
|
14242
|
-
this.experienceOptions.layouts = Object.values(C.layouts).map((d) => d.layout), await
|
|
14252
|
+
this.experienceOptions.layouts = Object.values(C.layouts).map((d) => d.layout), await ie(C), await oe(C), this.experienceOptions.reloadedState = C;
|
|
14243
14253
|
} else
|
|
14244
14254
|
this.experienceOptions.layouts = $e(
|
|
14245
14255
|
this.experienceOptions.transaction,
|
|
@@ -14443,6 +14453,9 @@ class Is {
|
|
|
14443
14453
|
getWorkflowSelections() {
|
|
14444
14454
|
return {};
|
|
14445
14455
|
}
|
|
14456
|
+
getStepSelections() {
|
|
14457
|
+
return {};
|
|
14458
|
+
}
|
|
14446
14459
|
setCurrentAdjustingStepId(e) {
|
|
14447
14460
|
}
|
|
14448
14461
|
setEditedStatus(e, t) {
|
|
@@ -14657,7 +14670,7 @@ export {
|
|
|
14657
14670
|
wt as AddonHandle,
|
|
14658
14671
|
Ds as ArrayInput,
|
|
14659
14672
|
ys as AspectType,
|
|
14660
|
-
|
|
14673
|
+
ne as AssetNotFoundError,
|
|
14661
14674
|
Ms as AssetType,
|
|
14662
14675
|
Ss as BringForwardCommand,
|
|
14663
14676
|
Ys as BringToBackCommand,
|