@spiffcommerce/core 13.1.1 → 13.1.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/main.js +5 -1
- package/dist/module.js +5 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -670,10 +670,14 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),A=require("react/j
|
|
|
670
670
|
id
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
`;function ac(t,e,A){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var A=t[Symbol.toPrimitive];if(void 0!==A){var i=A.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):t[e]=A,t}class rc{constructor(t){ac(this,"bundle",void 0),ac(this,"handleCache",{}),this.bundle=t}async getHandle(t){if(this.handleCache[t.name])return this.handleCache[t.name];const e=await this.createHandle(t);return this.handleCache[t.name]=e,e}async getHandles(){if(!this.bundle.getProductCollection()?.globalPropertyConfiguration)return[];const t=this.bundle.getProductCollection().globalPropertyConfiguration;return Promise.all(t.aspects.map((t=>this.getHandle(t))))}applyConditionsFromState(t,e){if(!e||!this.bundle.getProductCollection()?.globalPropertyConfiguration)return t;const A=this.bundle.getProductCollection().globalPropertyConfiguration;return t.filter((t=>{const i=A.aspects.find((e=>e.name===t.getName()));return!!i&&this.aspectConditionsSatisfied(i,e)}))}aspectConditionsSatisfied(t,e){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const A=e.aspects.find((e=>e.name===t.targetAspectName));return!!A&&t.requiredVariantSelections.some((t=>t===A.value))}))}async createHandle(t){switch(t.type){case eA.FileUpload:return new oc(this.bundle,t);case eA.Option:const e=t.entityId?await Ha.getOption(t.entityId):void 0;return new lc(this.bundle,t,e);case eA.Text:return new cc(this.bundle,t)}}}class sc{constructor(t,e){ac(this,"bundle",void 0),ac(this,"property",void 0),this.bundle=t,this.property=e}getName(){return this.property.name}getTitle(){return this.property.title}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){const e=(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyAspectConfigurations?.some((t=>t.globalPropertyConfigurationId===this.bundle.getProductCollection()?.globalPropertyConfiguration?.id&&t.aspectName===this.property.name))))));return console.log("Shared steps:",e),e}}class oc extends sc{constructor(t,e){super(t,e)}async selectImage(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.key),this.applyImageSelection(t)])}async applyGlobalState(t){const e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();const A=await Pa.getLocalOrFromServer(e);return A?this.applyImageSelection(A,t):Promise.resolve()}async applyImageSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectImage(t)));await Promise.all(A)}}class cc extends sc{constructor(t,e){super(t,e)}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 e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();await this.applyTextSelection(e,t)}async applyTextSelection(t,e){const A=this.getSharedSteps(e).map((e=>{e.setText(t)}));await Promise.all(A)}}class lc extends sc{constructor(t,e,A){super(t,e),ac(this,"optionResource",void 0),this.optionResource=A}getCurrentVariant(){if(!this.optionResource)return;const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!t)return;const e=this.optionResource.variants?.find((e=>e.id===t));return e?new Qo(e):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new Qo(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new Qo(t)))}async selectVariant(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.getId()),this.applyVariantSelection(t)])}async applyGlobalState(t){const e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();const A=this.optionResource?.variants?.find((t=>t.id===e));return A?this.applyVariantSelection(new Qo(A),t):Promise.resolve()}async applyVariantSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectVariant(t)));await Promise.all(A)}}const gc=M.gql`
|
|
673
|
+
`;function ac(t,e,A){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var A=t[Symbol.toPrimitive];if(void 0!==A){var i=A.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):t[e]=A,t}class rc{constructor(t){ac(this,"bundle",void 0),ac(this,"handleCache",{}),this.bundle=t}async getHandle(t){if(this.handleCache[t.name])return this.handleCache[t.name];const e=await this.createHandle(t);return this.handleCache[t.name]=e,e}async getHandles(){if(!this.bundle.getProductCollection()?.globalPropertyConfiguration)return[];const t=this.bundle.getProductCollection().globalPropertyConfiguration;return Promise.all(t.aspects.map((t=>this.getHandle(t))))}applyConditionsFromState(t,e){if(!e||!e.aspects||!this.bundle.getProductCollection()?.globalPropertyConfiguration)return t;const A=this.bundle.getProductCollection().globalPropertyConfiguration;return t.filter((t=>{const i=A.aspects.find((e=>e.name===t.getName()));return!!i&&this.aspectConditionsSatisfied(i,e)}))}aspectConditionsSatisfied(t,e){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const A=e.aspects.find((e=>e.name===t.targetAspectName));return!!A&&t.requiredVariantSelections.some((t=>t===A.value))}))}async createHandle(t){switch(t.type){case eA.FileUpload:return new oc(this.bundle,t);case eA.Option:const e=t.entityId?await Ha.getOption(t.entityId):void 0;return new lc(this.bundle,t,e);case eA.Text:return new cc(this.bundle,t)}}}class sc{constructor(t,e){ac(this,"bundle",void 0),ac(this,"property",void 0),this.bundle=t,this.property=e}getName(){return this.property.name}getTitle(){return this.property.title}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){const e=(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyAspectConfigurations?.some((t=>t.globalPropertyConfigurationId===this.bundle.getProductCollection()?.globalPropertyConfiguration?.id&&t.aspectName===this.property.name))))));return console.log("Shared steps:",e),e}}class oc extends sc{constructor(t,e){super(t,e)}async selectImage(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.key),this.applyImageSelection(t)])}async applyGlobalState(t){const e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();const A=await Pa.getLocalOrFromServer(e);return A?this.applyImageSelection(A,t):Promise.resolve()}async applyImageSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectImage(t)));await Promise.all(A)}}class cc extends sc{constructor(t,e){super(t,e)}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 e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();await this.applyTextSelection(e,t)}async applyTextSelection(t,e){const A=this.getSharedSteps(e).map((e=>{e.setText(t)}));await Promise.all(A)}}class lc extends sc{constructor(t,e,A){super(t,e),ac(this,"optionResource",void 0),this.optionResource=A}getCurrentVariant(){if(!this.optionResource)return;const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!t)return;const e=this.optionResource.variants?.find((e=>e.id===t));return e?new Qo(e):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new Qo(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new Qo(t)))}async selectVariant(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.getId()),this.applyVariantSelection(t)])}async applyGlobalState(t){const e=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!e)return Promise.resolve();const A=this.optionResource?.variants?.find((t=>t.id===e));return A?this.applyVariantSelection(new Qo(A),t):Promise.resolve()}async applyVariantSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectVariant(t)));await Promise.all(A)}}const gc=M.gql`
|
|
674
674
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
675
675
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
676
676
|
id
|
|
677
|
+
aspects {
|
|
678
|
+
name
|
|
679
|
+
value
|
|
680
|
+
}
|
|
677
681
|
}
|
|
678
682
|
}
|
|
679
683
|
`,hc=M.gql`
|
package/dist/module.js
CHANGED
|
@@ -670,10 +670,14 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
670
670
|
id
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
`;function oi(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 ri{constructor(t){oi(this,"bundle",void 0),oi(this,"handleCache",{}),this.bundle=t}async getHandle(t){if(this.handleCache[t.name])return this.handleCache[t.name];const A=await this.createHandle(t);return this.handleCache[t.name]=A,A}async getHandles(){if(!this.bundle.getProductCollection()?.globalPropertyConfiguration)return[];const t=this.bundle.getProductCollection().globalPropertyConfiguration;return Promise.all(t.aspects.map((t=>this.getHandle(t))))}applyConditionsFromState(t,A){if(!A||!this.bundle.getProductCollection()?.globalPropertyConfiguration)return t;const e=this.bundle.getProductCollection().globalPropertyConfiguration;return t.filter((t=>{const n=e.aspects.find((A=>A.name===t.getName()));return!!n&&this.aspectConditionsSatisfied(n,A)}))}aspectConditionsSatisfied(t,A){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const e=A.aspects.find((A=>A.name===t.targetAspectName));return!!e&&t.requiredVariantSelections.some((t=>t===e.value))}))}async createHandle(t){switch(t.type){case It.FileUpload:return new ci(this.bundle,t);case It.Option:const A=t.entityId?await kA.getOption(t.entityId):void 0;return new li(this.bundle,t,A);case It.Text:return new gi(this.bundle,t)}}}class si{constructor(t,A){oi(this,"bundle",void 0),oi(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getTitle(){return this.property.title}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().globalPropertyAspectConfigurations?.some((t=>t.globalPropertyConfigurationId===this.bundle.getProductCollection()?.globalPropertyConfiguration?.id&&t.aspectName===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),oi(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`
|
|
673
|
+
`;function oi(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 ri{constructor(t){oi(this,"bundle",void 0),oi(this,"handleCache",{}),this.bundle=t}async getHandle(t){if(this.handleCache[t.name])return this.handleCache[t.name];const A=await this.createHandle(t);return this.handleCache[t.name]=A,A}async getHandles(){if(!this.bundle.getProductCollection()?.globalPropertyConfiguration)return[];const t=this.bundle.getProductCollection().globalPropertyConfiguration;return Promise.all(t.aspects.map((t=>this.getHandle(t))))}applyConditionsFromState(t,A){if(!A||!A.aspects||!this.bundle.getProductCollection()?.globalPropertyConfiguration)return t;const e=this.bundle.getProductCollection().globalPropertyConfiguration;return t.filter((t=>{const n=e.aspects.find((A=>A.name===t.getName()));return!!n&&this.aspectConditionsSatisfied(n,A)}))}aspectConditionsSatisfied(t,A){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const e=A.aspects.find((A=>A.name===t.targetAspectName));return!!e&&t.requiredVariantSelections.some((t=>t===e.value))}))}async createHandle(t){switch(t.type){case It.FileUpload:return new ci(this.bundle,t);case It.Option:const A=t.entityId?await kA.getOption(t.entityId):void 0;return new li(this.bundle,t,A);case It.Text:return new gi(this.bundle,t)}}}class si{constructor(t,A){oi(this,"bundle",void 0),oi(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getTitle(){return this.property.title}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().globalPropertyAspectConfigurations?.some((t=>t.globalPropertyConfigurationId===this.bundle.getProductCollection()?.globalPropertyConfiguration?.id&&t.aspectName===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),oi(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`
|
|
674
674
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
675
675
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
676
676
|
id
|
|
677
|
+
aspects {
|
|
678
|
+
name
|
|
679
|
+
value
|
|
680
|
+
}
|
|
677
681
|
}
|
|
678
682
|
}
|
|
679
683
|
`,wi=Zt`
|