@spiffcommerce/core 12.11.1 → 12.11.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/main.js +23 -23
- package/dist/module.js +1 -1
- package/package.json +2 -2
package/dist/module.js
CHANGED
|
@@ -651,7 +651,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
651
651
|
id
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
`;function ri(t,A,e){return(A=function(t){var A=function(t,A){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,A||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===A?String:Number)(t)}(t,"string");return"symbol"==typeof A?A:String(A)}(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}class si{constructor(t,A){ri(this,"bundle",void 0),ri(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){const A=(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyConfigurationAspectNames?.includes(this.property.name)))));return console.log("Shared steps:",A),A}}class ci extends si{constructor(t,A){super(t,A)}async selectImage(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.key),this.applyImageSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=await HA.getLocalOrFromServer(A);return e?this.applyImageSelection(e,t):Promise.resolve()}async applyImageSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectImage(t)));await Promise.all(e)}}class gi extends si{constructor(t,A){super(t,A)}async setText(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t),this.applyTextSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();await this.applyTextSelection(A,t)}async applyTextSelection(t,A){const e=this.getSharedSteps(A).map((A=>{A.setText(t)}));await Promise.all(e)}}class li extends si{constructor(t,A,e){super(t,A),ri(this,"optionResource",void 0),this.optionResource=e}getCurrentVariant(){if(!this.optionResource)return;const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!t)return;const A=this.optionResource.variants?.find((A=>A.id===t));return A?new fa(A):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new fa(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new fa(t)))}async selectVariant(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.getId()),this.applyVariantSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=this.optionResource?.variants?.find((t=>t.id===A));return e?this.applyVariantSelection(new fa(e),t):Promise.resolve()}async applyVariantSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectVariant(t)));await Promise.all(e)}}const Bi=Zt`
|
|
654
|
+
`;function ri(t,A,e){return(A=function(t){var A=function(t,A){if("object"!=typeof t||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,A||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===A?String:Number)(t)}(t,"string");return"symbol"==typeof A?A:String(A)}(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}class si{constructor(t,A){ri(this,"bundle",void 0),ri(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){const A=(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyConfigurationAspectNames?.includes(this.property.name)))));return console.log("Shared steps:",A),A}}class ci extends si{constructor(t,A){super(t,A)}async selectImage(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.key),this.applyImageSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=await HA.getLocalOrFromServer(A);return e?this.applyImageSelection(e,t):Promise.resolve()}async applyImageSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectImage(t)));await Promise.all(e)}}class gi extends si{constructor(t,A){super(t,A)}getText(){const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);return t||""}async setText(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t),this.applyTextSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();await this.applyTextSelection(A,t)}async applyTextSelection(t,A){const e=this.getSharedSteps(A).map((A=>{A.setText(t)}));await Promise.all(e)}}class li extends si{constructor(t,A,e){super(t,A),ri(this,"optionResource",void 0),this.optionResource=e}getCurrentVariant(){if(!this.optionResource)return;const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!t)return;const A=this.optionResource.variants?.find((A=>A.id===t));return A?new fa(A):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new fa(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new fa(t)))}async selectVariant(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.getId()),this.applyVariantSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=this.optionResource?.variants?.find((t=>t.id===A));return e?this.applyVariantSelection(new fa(e),t):Promise.resolve()}async applyVariantSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectVariant(t)));await Promise.all(e)}}const Bi=Zt`
|
|
655
655
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
656
656
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
657
657
|
id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/core",
|
|
3
|
-
"version": "12.11.
|
|
3
|
+
"version": "12.11.3",
|
|
4
4
|
"description": "Core client API for interacting with the Spiff Commerce backend.",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@apollo/client": "^3.7.0",
|
|
90
|
-
"@spiffcommerce/papyrus": "^2.0.
|
|
90
|
+
"@spiffcommerce/papyrus": "^2.0.11",
|
|
91
91
|
"cross-fetch": "^3.1.5",
|
|
92
92
|
"graphql": "^16.6.0",
|
|
93
93
|
"lodash.clonedeep": "^4.5.0",
|