@spiffcommerce/core 29.1.2-beta.2102523f-f498-5d84-b95b-77365fe8e2f4 → 29.2.0-beta.d6eca60e-99f1-5e8b-b469-3e390879560c
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 +17 -4
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9631,6 +9631,7 @@ const re = v`
|
|
|
9631
9631
|
value
|
|
9632
9632
|
type
|
|
9633
9633
|
channel
|
|
9634
|
+
mandatoryFulfilled
|
|
9634
9635
|
storage {
|
|
9635
9636
|
... on GlobalPropertyStateColorOptionStorage {
|
|
9636
9637
|
customColor
|
|
@@ -9760,6 +9761,7 @@ const re = v`
|
|
|
9760
9761
|
title
|
|
9761
9762
|
description
|
|
9762
9763
|
entityId
|
|
9764
|
+
mandatory
|
|
9763
9765
|
conditions {
|
|
9764
9766
|
targetAspectName
|
|
9765
9767
|
action
|
|
@@ -13568,13 +13570,13 @@ class Pa {
|
|
|
13568
13570
|
return this.property.name;
|
|
13569
13571
|
}
|
|
13570
13572
|
/**
|
|
13571
|
-
* @returns A human
|
|
13573
|
+
* @returns A human-friendly title.
|
|
13572
13574
|
*/
|
|
13573
13575
|
getTitle() {
|
|
13574
13576
|
return this.property.title;
|
|
13575
13577
|
}
|
|
13576
13578
|
/**
|
|
13577
|
-
* @returns A human
|
|
13579
|
+
* @returns A human-friendly description.
|
|
13578
13580
|
*/
|
|
13579
13581
|
getDescription() {
|
|
13580
13582
|
return this.property.description;
|
|
@@ -13591,6 +13593,18 @@ class Pa {
|
|
|
13591
13593
|
getRawProperty() {
|
|
13592
13594
|
return this.property;
|
|
13593
13595
|
}
|
|
13596
|
+
/**
|
|
13597
|
+
* @returns Whether this aspect has been marked as required to be completed before the user can continue.
|
|
13598
|
+
*/
|
|
13599
|
+
isMandatory() {
|
|
13600
|
+
return !!this.property.mandatory;
|
|
13601
|
+
}
|
|
13602
|
+
/**
|
|
13603
|
+
* @returns Whether this aspect has been marked as `completed` for mandatory checks. Note that this function always returns `true` if the aspect has not been marked as mandatory.
|
|
13604
|
+
*/
|
|
13605
|
+
isMandatoryFulfilled() {
|
|
13606
|
+
return !this.property.mandatory || !!this.bundle.getGlobalPropertyStateManager().getAspectMandatoryFulfilled(this.property.name);
|
|
13607
|
+
}
|
|
13594
13608
|
/**
|
|
13595
13609
|
* Returns all steps that share this property.
|
|
13596
13610
|
* @param targetExperiences Optionally filter the steps to only those in the given experiences.
|
|
@@ -13652,12 +13666,18 @@ class cl extends Pa {
|
|
|
13652
13666
|
async selectImage(t) {
|
|
13653
13667
|
const e = this.bundle.getGlobalPropertyStateManager();
|
|
13654
13668
|
await Promise.all([
|
|
13655
|
-
e.setAspect(
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13669
|
+
e.setAspect(
|
|
13670
|
+
this.property.name,
|
|
13671
|
+
t.key,
|
|
13672
|
+
{
|
|
13673
|
+
...e.getAspectStorage(this.property.name) || {},
|
|
13674
|
+
originalAssetKey: t.key,
|
|
13675
|
+
backgroundRemovedAssetKey: void 0,
|
|
13676
|
+
useOriginalAsset: void 0
|
|
13677
|
+
},
|
|
13678
|
+
void 0,
|
|
13679
|
+
!0
|
|
13680
|
+
),
|
|
13661
13681
|
this.applyImageSelection(t),
|
|
13662
13682
|
this.loadImageData()
|
|
13663
13683
|
]);
|
|
@@ -13873,7 +13893,7 @@ class dl extends Pa {
|
|
|
13873
13893
|
*/
|
|
13874
13894
|
async setText(t) {
|
|
13875
13895
|
await Promise.all([
|
|
13876
|
-
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t),
|
|
13896
|
+
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t, void 0, void 0, t.trim() !== ""),
|
|
13877
13897
|
this.applyTextSelection(t)
|
|
13878
13898
|
]);
|
|
13879
13899
|
}
|
|
@@ -13948,7 +13968,7 @@ class er extends Pa {
|
|
|
13948
13968
|
*/
|
|
13949
13969
|
async selectVariant(t, e) {
|
|
13950
13970
|
await Promise.all([
|
|
13951
|
-
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
|
|
13971
|
+
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e, !0),
|
|
13952
13972
|
this.applyVariantSelection(t)
|
|
13953
13973
|
]);
|
|
13954
13974
|
}
|
|
@@ -13975,7 +13995,7 @@ class Ka extends er {
|
|
|
13975
13995
|
*/
|
|
13976
13996
|
async selectVariant(t, e) {
|
|
13977
13997
|
await Promise.all([
|
|
13978
|
-
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
|
|
13998
|
+
this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e, !0),
|
|
13979
13999
|
this.applyColorVariant(t, void 0, e)
|
|
13980
14000
|
]);
|
|
13981
14001
|
}
|
|
@@ -14078,73 +14098,85 @@ class hl {
|
|
|
14078
14098
|
throw new Error("Global property state not initialized");
|
|
14079
14099
|
return (a = this.globalPropertyState.aspects.find((n) => n.name === t && n.channel === e)) == null ? void 0 : a.storage;
|
|
14080
14100
|
}
|
|
14081
|
-
|
|
14101
|
+
getAspectMandatoryFulfilled(t) {
|
|
14102
|
+
if (!this.globalPropertyState)
|
|
14103
|
+
throw new Error("Global property state not initialized");
|
|
14104
|
+
const e = this.globalPropertyState.aspects.filter((a) => a.name === t);
|
|
14105
|
+
if (e)
|
|
14106
|
+
return e.some((a) => !!a.mandatoryFulfilled);
|
|
14107
|
+
}
|
|
14108
|
+
async setAspect(t, e, a, n, i) {
|
|
14082
14109
|
if (!this.globalPropertyState)
|
|
14083
14110
|
throw new Error("Global property state not initialized");
|
|
14084
14111
|
if (!this.configuration)
|
|
14085
14112
|
throw new Error("Global property configuration not linked to the state manager.");
|
|
14086
|
-
const
|
|
14087
|
-
if (!
|
|
14113
|
+
const s = this.configuration.aspects.find((c) => c.name === t);
|
|
14114
|
+
if (!s)
|
|
14088
14115
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
14089
|
-
const
|
|
14090
|
-
if (
|
|
14116
|
+
const o = yt(this.globalPropertyState), l = this.globalPropertyState.aspects.filter((c) => c.name === t);
|
|
14117
|
+
if (l.length > 0)
|
|
14091
14118
|
if (n) {
|
|
14092
|
-
const
|
|
14093
|
-
if (
|
|
14094
|
-
|
|
14119
|
+
const c = l.find((d) => d.channel === n);
|
|
14120
|
+
if (c)
|
|
14121
|
+
c.value = e, c.type = s.type, c.channel = n, a !== void 0 && (c.storage = a !== null ? a : void 0), i !== void 0 && (c.mandatoryFulfilled = i);
|
|
14095
14122
|
else {
|
|
14096
14123
|
if (n === 1) {
|
|
14097
|
-
const
|
|
14098
|
-
|
|
14124
|
+
const d = this.globalPropertyState.aspects.findIndex(
|
|
14125
|
+
(A) => !A.channel && A.name === t
|
|
14126
|
+
);
|
|
14127
|
+
d && d > 0 && this.globalPropertyState.aspects.splice(d, 1);
|
|
14099
14128
|
}
|
|
14100
14129
|
this.globalPropertyState.aspects.push({
|
|
14101
14130
|
name: t,
|
|
14102
14131
|
value: e,
|
|
14103
|
-
type:
|
|
14132
|
+
type: s.type,
|
|
14104
14133
|
storage: a !== null ? a : void 0,
|
|
14105
|
-
channel: n
|
|
14134
|
+
channel: n,
|
|
14135
|
+
mandatoryFulfilled: i
|
|
14106
14136
|
});
|
|
14107
14137
|
}
|
|
14108
14138
|
} else {
|
|
14109
|
-
const
|
|
14110
|
-
|
|
14139
|
+
const c = l[0];
|
|
14140
|
+
c.value = e, c.type = s.type, a !== void 0 && (c.storage = a !== null ? a : void 0), i !== void 0 && (c.mandatoryFulfilled = i);
|
|
14111
14141
|
}
|
|
14112
14142
|
else
|
|
14113
14143
|
this.globalPropertyState.aspects.push({
|
|
14114
14144
|
name: t,
|
|
14115
14145
|
value: e,
|
|
14116
|
-
type:
|
|
14146
|
+
type: s.type,
|
|
14117
14147
|
storage: a !== null ? a : void 0,
|
|
14118
|
-
channel: n
|
|
14148
|
+
channel: n,
|
|
14149
|
+
mandatoryFulfilled: i
|
|
14119
14150
|
});
|
|
14120
|
-
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(
|
|
14151
|
+
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(o, this.globalPropertyState);
|
|
14121
14152
|
}
|
|
14122
|
-
async setAspectStorage(t, e, a) {
|
|
14153
|
+
async setAspectStorage(t, e, a, n) {
|
|
14123
14154
|
if (!this.globalPropertyState)
|
|
14124
14155
|
throw new Error("Global property state not initialized");
|
|
14125
14156
|
if (!this.configuration)
|
|
14126
14157
|
throw new Error("Global property configuration not linked to the state manager.");
|
|
14127
|
-
const
|
|
14128
|
-
if (!
|
|
14158
|
+
const i = this.configuration.aspects.find((l) => l.name === t);
|
|
14159
|
+
if (!i)
|
|
14129
14160
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
14130
|
-
const
|
|
14131
|
-
if (
|
|
14161
|
+
const s = yt(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
|
|
14162
|
+
if (o.length > 0)
|
|
14132
14163
|
if (a) {
|
|
14133
|
-
const
|
|
14134
|
-
|
|
14164
|
+
const l = o.find((c) => c.channel === a);
|
|
14165
|
+
l && (l.storage = e !== null ? e : void 0, l.type = i.type, n !== void 0 && (l.mandatoryFulfilled = n));
|
|
14135
14166
|
} else {
|
|
14136
|
-
const
|
|
14137
|
-
|
|
14167
|
+
const l = o[0];
|
|
14168
|
+
l.storage = e !== null ? e : void 0, l.type = i.type, n !== void 0 && (l.mandatoryFulfilled = n);
|
|
14138
14169
|
}
|
|
14139
14170
|
else
|
|
14140
14171
|
this.globalPropertyState.aspects.push({
|
|
14141
14172
|
name: t,
|
|
14142
14173
|
value: "",
|
|
14143
|
-
type:
|
|
14174
|
+
type: i.type,
|
|
14144
14175
|
storage: e !== null ? e : void 0,
|
|
14145
|
-
channel: a
|
|
14176
|
+
channel: a,
|
|
14177
|
+
mandatoryFulfilled: n
|
|
14146
14178
|
});
|
|
14147
|
-
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(
|
|
14179
|
+
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(s, this.globalPropertyState);
|
|
14148
14180
|
}
|
|
14149
14181
|
async updateGlobalPropertyState() {
|
|
14150
14182
|
var e, a;
|
|
@@ -16124,7 +16156,7 @@ class gd {
|
|
|
16124
16156
|
} catch (a) {
|
|
16125
16157
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
16126
16158
|
}
|
|
16127
|
-
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 29.
|
|
16159
|
+
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 29.2.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
16128
16160
|
}
|
|
16129
16161
|
configure(t) {
|
|
16130
16162
|
mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && zr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|