@spiffcommerce/core 14.0.1 → 14.1.0
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 +2 -2
- package/dist/module.js +2 -2
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -670,7 +670,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),i=require("react/j
|
|
|
670
670
|
id
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
`;function ac(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,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){return e?t.filter((t=>this.aspectConditionsSatisfied(t.getRawProperty(),e))):t}aspectConditionsSatisfied(t,e){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const i=e.aspects.find((e=>e.name===t.targetAspectName));return!!i&&t.requiredVariantSelections.some((t=>t===i.value))}))}async createHandle(t){switch(t.type){case ei.FileUpload:return new oc(this.bundle,t);case ei.Option:const e=t.entityId?await Ha.getOption(t.entityId):void 0;return new lc(this.bundle,t,e);case ei.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}getRawProperty(){return this.property}getSharedSteps(t){
|
|
673
|
+
`;function ac(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,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){return e?t.filter((t=>this.aspectConditionsSatisfied(t.getRawProperty(),e))):t}aspectConditionsSatisfied(t,e){return!t.conditions||0===t.conditions.length||t.conditions.some((t=>{const i=e.aspects.find((e=>e.name===t.targetAspectName));return!!i&&t.requiredVariantSelections.some((t=>t===i.value))}))}async createHandle(t){switch(t.type){case ei.FileUpload:return new oc(this.bundle,t);case ei.Option:const e=t.entityId?await Ha.getOption(t.entityId):void 0;return new lc(this.bundle,t,e);case ei.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}getRawProperty(){return this.property}getSharedSteps(t){return(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))))))}}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 i=await Pa.getLocalOrFromServer(e);return i?this.applyImageSelection(i,t):Promise.resolve()}async applyImageSelection(t,e){const i=this.getSharedSteps(e).map((e=>e.selectImage(t)));await Promise.all(i)}}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 i=this.getSharedSteps(e).map((e=>{e.setText(t)}));await Promise.all(i)}}class lc extends sc{constructor(t,e,i){super(t,e),ac(this,"optionResource",void 0),this.optionResource=i}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 i=this.optionResource?.variants?.find((t=>t.id===e));return i?this.applyVariantSelection(new Qo(i),t):Promise.resolve()}async applyVariantSelection(t,e){const i=this.getSharedSteps(e).map((e=>e.selectVariant(t)));await Promise.all(i)}}const gc=v.gql`
|
|
674
674
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
675
675
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
676
676
|
id
|
|
@@ -700,7 +700,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),i=require("react/j
|
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
|
-
`;function uc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class wc{constructor(t,e){uc(this,"bundleId",void 0),uc(this,"globalPropertyState",void 0),uc(this,"onGlobalPropertyStateChange",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t)),this.onGlobalPropertyStateChange=e}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((e=>e.name===t));if(e)return e.value}async setAspect(t,i){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=F(e)(this.globalPropertyState),n=this.globalPropertyState.aspects.find((e=>e.name===t));n?n.value=i:this.globalPropertyState.aspects.push({name:t,value:i}),await this.updateGlobalPropertyState(),await this.onGlobalPropertyStateChange(A,this.globalPropertyState)}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await ya.getShadowGraphqlClient().mutate({mutation:hc,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects}});if(!t.data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state");this.globalPropertyState=t.data.globalPropertyStateUpdate}async getOrCreateGlobalPropertyState(){const t=await ya.getShadowGraphqlClient().query({query:dc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await ya.getShadowGraphqlClient().mutate({mutation:gc,variables:{bundleId:this.bundleId}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Bc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class pc{constructor(t,e){Bc(this,"client",void 0),Bc(this,"id",void 0),Bc(this,"name",void 0),Bc(this,"metadata",void 0),Bc(this,"productCollection",void 0),Bc(this,"globalConfiguration",void 0),Bc(this,"globalPropertyStateManager",void 0),Bc(this,"globalPropertyHandleService",void 0),Bc(this,"eventListeners",new Map),Bc(this,"workflowExperiences",[]),this.client=t,this.id=e.id,this.name=e.name||"",this.metadata=new Map(e.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=e.productCollection,this.globalConfiguration=this.productCollection?.globalPropertyConfiguration,this.globalPropertyStateManager=new wc(this.id,this.checkConditionalHandlesChanged.bind(this)),this.globalPropertyHandleService=new rc(this)}addEventListener(t,e){this.eventListeners.set(t,[...this.eventListeners.get(t)||[],e])}removeEventListener(t,e){const i=this.eventListeners.get(t)||[],A=i.indexOf(e);A>-1&&i.splice(A,1)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}setName(t){return this.name=t,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(t){return this.metadata=new Map(t),this.updateBundle()}setNameAndMetadata(t,e){return this.name=t,this.metadata=new Map(e),this.updateBundle()}hasGlobalProperties(){return!!this.globalConfiguration&&this.globalConfiguration.aspects.length>0}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,e)=>t+e),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const e=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===e)))throw new Error("Unable to add transaction to bundle - Already Exists!");await ya.getShadowGraphqlClient().mutate({mutation:tc,variables:{id:this.id,transactionId:e}}),this.workflowExperiences.push(t);const i=await this.getGlobalProperties();await Promise.all(i.map((e=>e.applyGlobalState([t]))))}async removeWorkflowExperience(t){const e=this.workflowExperiences.indexOf(t);await this.removeTransaction(e,this.workflowExperiences[e].getWorkflowManager().getTransaction())}async removeWorkflowExperienceByTransaction(t){const e=this.workflowExperiences.findIndex((e=>e.getWorkflowManager().getTransaction().id===t.id));await this.removeTransaction(e,t)}async removeTransaction(t,e){if(!(t>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await ya.getShadowGraphqlClient().mutate({mutation:ec,variables:{id:this.id,transactionId:e.id}}),this.workflowExperiences.splice(t,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await ya.getShadowGraphqlClient().mutate({mutation:nc,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,e){await ya.getShadowGraphqlClient().mutate({mutation:ic,variables:{id:this.id,details:t,type:e||nr.Owner}})}async updateStakeholders(t){await ya.getShadowGraphqlClient().mutate({mutation:Ac,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await ya.getShadowGraphqlClient().query({query:Zo,errorPolicy:"all",variables:{id:this.id}});if(!t.data.bundles||0===t.data.bundles.length)throw new Error("Bundle not found!");return t.data.bundles[0].bundleStakeholders||[]}async finish(){return Promise.all(this.workflowExperiences.map((t=>t.onDesignFinished())))}_setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await ya.getShadowGraphqlClient().mutate({mutation:_o,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,e])=>({key:t,value:e})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async checkConditionalHandlesChanged(t,e){(i=>{const A=this.globalPropertyHandleService.applyConditionsFromState(i,t),n=this.globalPropertyHandleService.applyConditionsFromState(i,e);if(A.length!==n.length)return!0;for(let t=0;t<A.length;t++)if(A[t].getName()!==n[t].getName())return!0;return!1})(await this.globalPropertyHandleService.getHandles())&&this.fireEvent("conditional-global-properties-changed")}fireEvent(t){(this.eventListeners.get(t)||[]).forEach((t=>t()))}}function Ec(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const mc=t.gql`
|
|
703
|
+
`;function uc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class wc{constructor(t,e){uc(this,"bundleId",void 0),uc(this,"globalPropertyState",void 0),uc(this,"onGlobalPropertyStateChange",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t)),this.onGlobalPropertyStateChange=e}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((e=>e.name===t));if(e)return e.value}async setAspect(t,i){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=F(e)(this.globalPropertyState),n=this.globalPropertyState.aspects.find((e=>e.name===t));n?n.value=i:this.globalPropertyState.aspects.push({name:t,value:i}),await this.updateGlobalPropertyState(),await this.onGlobalPropertyStateChange(A,this.globalPropertyState)}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await ya.getShadowGraphqlClient().mutate({mutation:hc,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects}});if(!t.data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state");this.globalPropertyState=t.data.globalPropertyStateUpdate}async getOrCreateGlobalPropertyState(){const t=await ya.getShadowGraphqlClient().query({query:dc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await ya.getShadowGraphqlClient().mutate({mutation:gc,variables:{bundleId:this.bundleId}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Bc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class pc{constructor(t,e){Bc(this,"client",void 0),Bc(this,"id",void 0),Bc(this,"name",void 0),Bc(this,"metadata",void 0),Bc(this,"productCollection",void 0),Bc(this,"globalConfiguration",void 0),Bc(this,"globalPropertyStateManager",void 0),Bc(this,"globalPropertyHandleService",void 0),Bc(this,"eventListeners",new Map),Bc(this,"workflowExperiences",[]),this.client=t,this.id=e.id,this.name=e.name||"",this.metadata=new Map(e.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=e.productCollection,this.globalConfiguration=this.productCollection?.globalPropertyConfiguration,this.globalPropertyStateManager=new wc(this.id,this.checkConditionalHandlesChanged.bind(this)),this.globalPropertyHandleService=new rc(this)}addEventListener(t,e){this.eventListeners.set(t,[...this.eventListeners.get(t)||[],e])}removeEventListener(t,e){const i=this.eventListeners.get(t)||[],A=i.indexOf(e);A>-1&&i.splice(A,1)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}setName(t){return this.name=t,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(t){return this.metadata=new Map(t),this.updateBundle()}setNameAndMetadata(t,e){return this.name=t,this.metadata=new Map(e),this.updateBundle()}hasGlobalProperties(){return!!this.globalConfiguration&&this.globalConfiguration.aspects.length>0}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}async getGlobalPropertyTotalSubunits(){return(await this.globalPropertyHandleService.getHandles()).filter((t=>t.getType()===ei.Option)).map((t=>t.getCurrentVariant()?.getPrice()||0)).reduce(((t,e)=>t+e),0)}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,e)=>t+e),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const e=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===e)))throw new Error("Unable to add transaction to bundle - Already Exists!");await ya.getShadowGraphqlClient().mutate({mutation:tc,variables:{id:this.id,transactionId:e}}),this.workflowExperiences.push(t);const i=await this.getGlobalProperties();await Promise.all(i.map((e=>e.applyGlobalState([t]))))}async removeWorkflowExperience(t){const e=this.workflowExperiences.indexOf(t);await this.removeTransaction(e,this.workflowExperiences[e].getWorkflowManager().getTransaction())}async removeWorkflowExperienceByTransaction(t){const e=this.workflowExperiences.findIndex((e=>e.getWorkflowManager().getTransaction().id===t.id));await this.removeTransaction(e,t)}async removeTransaction(t,e){if(!(t>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await ya.getShadowGraphqlClient().mutate({mutation:ec,variables:{id:this.id,transactionId:e.id}}),this.workflowExperiences.splice(t,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await ya.getShadowGraphqlClient().mutate({mutation:nc,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,e){await ya.getShadowGraphqlClient().mutate({mutation:ic,variables:{id:this.id,details:t,type:e||nr.Owner}})}async updateStakeholders(t){await ya.getShadowGraphqlClient().mutate({mutation:Ac,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await ya.getShadowGraphqlClient().query({query:Zo,errorPolicy:"all",variables:{id:this.id}});if(!t.data.bundles||0===t.data.bundles.length)throw new Error("Bundle not found!");return t.data.bundles[0].bundleStakeholders||[]}async finish(){return Promise.all(this.workflowExperiences.map((t=>t.onDesignFinished())))}_setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await ya.getShadowGraphqlClient().mutate({mutation:_o,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,e])=>({key:t,value:e})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async checkConditionalHandlesChanged(t,e){(i=>{const A=this.globalPropertyHandleService.applyConditionsFromState(i,t),n=this.globalPropertyHandleService.applyConditionsFromState(i,e);if(A.length!==n.length)return!0;for(let t=0;t<A.length;t++)if(A[t].getName()!==n[t].getName())return!0;return!1})(await this.globalPropertyHandleService.getHandles())&&this.fireEvent("conditional-global-properties-changed")}fireEvent(t){(this.eventListeners.get(t)||[]).forEach((t=>t()))}}function Ec(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const mc=t.gql`
|
|
704
704
|
mutation processFlowCreate($processFlowId: String!, $inputs: [String]!) {
|
|
705
705
|
processExecutionCreate(processFlowId: $processFlowId, inputs: $inputs) {
|
|
706
706
|
id
|
package/dist/module.js
CHANGED
|
@@ -670,7 +670,7 @@ import{CommandContext as t,AssetType as e,BringForwardCommand as A,BringToFrontC
|
|
|
670
670
|
id
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
`;function oi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 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 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){return e?t.filter((t=>this.aspectConditionsSatisfied(t.getRawProperty(),e))):t}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 It.FileUpload:return new ci(this.bundle,t);case It.Option:const e=t.entityId?await ke.getOption(t.entityId):void 0;return new li(this.bundle,t,e);case It.Text:return new gi(this.bundle,t)}}}class si{constructor(t,e){oi(this,"bundle",void 0),oi(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}getRawProperty(){return this.property}getSharedSteps(t){
|
|
673
|
+
`;function oi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 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 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){return e?t.filter((t=>this.aspectConditionsSatisfied(t.getRawProperty(),e))):t}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 It.FileUpload:return new ci(this.bundle,t);case It.Option:const e=t.entityId?await ke.getOption(t.entityId):void 0;return new li(this.bundle,t,e);case It.Text:return new gi(this.bundle,t)}}}class si{constructor(t,e){oi(this,"bundle",void 0),oi(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}getRawProperty(){return this.property}getSharedSteps(t){return(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))))))}}class ci extends si{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 He.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 gi extends si{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 li extends si{constructor(t,e,A){super(t,e),oi(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 fa(e):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 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 fa(A),t):Promise.resolve()}async applyVariantSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectVariant(t)));await Promise.all(A)}}const Bi=Zt`
|
|
674
674
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
675
675
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
676
676
|
id
|
|
@@ -700,7 +700,7 @@ import{CommandContext as t,AssetType as e,BringForwardCommand as A,BringToFrontC
|
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
|
-
`;function hi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 Ei{constructor(t,e){hi(this,"bundleId",void 0),hi(this,"globalPropertyState",void 0),hi(this,"onGlobalPropertyStateChange",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t)),this.onGlobalPropertyStateChange=e}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((e=>e.name===t));if(e)return e.value}async setAspect(t,e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=zt(this.globalPropertyState),n=this.globalPropertyState.aspects.find((e=>e.name===t));n?n.value=e:this.globalPropertyState.aspects.push({name:t,value:e}),await this.updateGlobalPropertyState(),await this.onGlobalPropertyStateChange(A,this.globalPropertyState)}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await ye.getShadowGraphqlClient().mutate({mutation:wi,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects}});if(!t.data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state");this.globalPropertyState=t.data.globalPropertyStateUpdate}async getOrCreateGlobalPropertyState(){const t=await ye.getShadowGraphqlClient().query({query:di,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await ye.getShadowGraphqlClient().mutate({mutation:Bi,variables:{bundleId:this.bundleId}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Ci(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 ui{constructor(t,e){Ci(this,"client",void 0),Ci(this,"id",void 0),Ci(this,"name",void 0),Ci(this,"metadata",void 0),Ci(this,"productCollection",void 0),Ci(this,"globalConfiguration",void 0),Ci(this,"globalPropertyStateManager",void 0),Ci(this,"globalPropertyHandleService",void 0),Ci(this,"eventListeners",new Map),Ci(this,"workflowExperiences",[]),this.client=t,this.id=e.id,this.name=e.name||"",this.metadata=new Map(e.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=e.productCollection,this.globalConfiguration=this.productCollection?.globalPropertyConfiguration,this.globalPropertyStateManager=new Ei(this.id,this.checkConditionalHandlesChanged.bind(this)),this.globalPropertyHandleService=new ri(this)}addEventListener(t,e){this.eventListeners.set(t,[...this.eventListeners.get(t)||[],e])}removeEventListener(t,e){const A=this.eventListeners.get(t)||[],n=A.indexOf(e);n>-1&&A.splice(n,1)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}setName(t){return this.name=t,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(t){return this.metadata=new Map(t),this.updateBundle()}setNameAndMetadata(t,e){return this.name=t,this.metadata=new Map(e),this.updateBundle()}hasGlobalProperties(){return!!this.globalConfiguration&&this.globalConfiguration.aspects.length>0}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,e)=>t+e),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const e=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===e)))throw new Error("Unable to add transaction to bundle - Already Exists!");await ye.getShadowGraphqlClient().mutate({mutation:ei,variables:{id:this.id,transactionId:e}}),this.workflowExperiences.push(t);const A=await this.getGlobalProperties();await Promise.all(A.map((e=>e.applyGlobalState([t]))))}async removeWorkflowExperience(t){const e=this.workflowExperiences.indexOf(t);await this.removeTransaction(e,this.workflowExperiences[e].getWorkflowManager().getTransaction())}async removeWorkflowExperienceByTransaction(t){const e=this.workflowExperiences.findIndex((e=>e.getWorkflowManager().getTransaction().id===t.id));await this.removeTransaction(e,t)}async removeTransaction(t,e){if(!(t>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await ye.getShadowGraphqlClient().mutate({mutation:Ai,variables:{id:this.id,transactionId:e.id}}),this.workflowExperiences.splice(t,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await ye.getShadowGraphqlClient().mutate({mutation:ii,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,e){await ye.getShadowGraphqlClient().mutate({mutation:ni,variables:{id:this.id,details:t,type:e||oA.Owner}})}async updateStakeholders(t){await ye.getShadowGraphqlClient().mutate({mutation:ai,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await ye.getShadowGraphqlClient().query({query:$a,errorPolicy:"all",variables:{id:this.id}});if(!t.data.bundles||0===t.data.bundles.length)throw new Error("Bundle not found!");return t.data.bundles[0].bundleStakeholders||[]}async finish(){return Promise.all(this.workflowExperiences.map((t=>t.onDesignFinished())))}_setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await ye.getShadowGraphqlClient().mutate({mutation:ti,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,e])=>({key:t,value:e})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async checkConditionalHandlesChanged(t,e){(A=>{const n=this.globalPropertyHandleService.applyConditionsFromState(A,t),a=this.globalPropertyHandleService.applyConditionsFromState(A,e);if(n.length!==a.length)return!0;for(let t=0;t<n.length;t++)if(n[t].getName()!==a[t].getName())return!0;return!1})(await this.globalPropertyHandleService.getHandles())&&this.fireEvent("conditional-global-properties-changed")}fireEvent(t){(this.eventListeners.get(t)||[]).forEach((t=>t()))}}function Qi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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}const pi=ft`
|
|
703
|
+
`;function hi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 Ei{constructor(t,e){hi(this,"bundleId",void 0),hi(this,"globalPropertyState",void 0),hi(this,"onGlobalPropertyStateChange",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t)),this.onGlobalPropertyStateChange=e}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((e=>e.name===t));if(e)return e.value}async setAspect(t,e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=zt(this.globalPropertyState),n=this.globalPropertyState.aspects.find((e=>e.name===t));n?n.value=e:this.globalPropertyState.aspects.push({name:t,value:e}),await this.updateGlobalPropertyState(),await this.onGlobalPropertyStateChange(A,this.globalPropertyState)}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await ye.getShadowGraphqlClient().mutate({mutation:wi,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects}});if(!t.data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state");this.globalPropertyState=t.data.globalPropertyStateUpdate}async getOrCreateGlobalPropertyState(){const t=await ye.getShadowGraphqlClient().query({query:di,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await ye.getShadowGraphqlClient().mutate({mutation:Bi,variables:{bundleId:this.bundleId}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Ci(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 ui{constructor(t,e){Ci(this,"client",void 0),Ci(this,"id",void 0),Ci(this,"name",void 0),Ci(this,"metadata",void 0),Ci(this,"productCollection",void 0),Ci(this,"globalConfiguration",void 0),Ci(this,"globalPropertyStateManager",void 0),Ci(this,"globalPropertyHandleService",void 0),Ci(this,"eventListeners",new Map),Ci(this,"workflowExperiences",[]),this.client=t,this.id=e.id,this.name=e.name||"",this.metadata=new Map(e.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=e.productCollection,this.globalConfiguration=this.productCollection?.globalPropertyConfiguration,this.globalPropertyStateManager=new Ei(this.id,this.checkConditionalHandlesChanged.bind(this)),this.globalPropertyHandleService=new ri(this)}addEventListener(t,e){this.eventListeners.set(t,[...this.eventListeners.get(t)||[],e])}removeEventListener(t,e){const A=this.eventListeners.get(t)||[],n=A.indexOf(e);n>-1&&A.splice(n,1)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}setName(t){return this.name=t,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(t){return this.metadata=new Map(t),this.updateBundle()}setNameAndMetadata(t,e){return this.name=t,this.metadata=new Map(e),this.updateBundle()}hasGlobalProperties(){return!!this.globalConfiguration&&this.globalConfiguration.aspects.length>0}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}async getGlobalPropertyTotalSubunits(){return(await this.globalPropertyHandleService.getHandles()).filter((t=>t.getType()===It.Option)).map((t=>t.getCurrentVariant()?.getPrice()||0)).reduce(((t,e)=>t+e),0)}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,e)=>t+e),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const e=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===e)))throw new Error("Unable to add transaction to bundle - Already Exists!");await ye.getShadowGraphqlClient().mutate({mutation:ei,variables:{id:this.id,transactionId:e}}),this.workflowExperiences.push(t);const A=await this.getGlobalProperties();await Promise.all(A.map((e=>e.applyGlobalState([t]))))}async removeWorkflowExperience(t){const e=this.workflowExperiences.indexOf(t);await this.removeTransaction(e,this.workflowExperiences[e].getWorkflowManager().getTransaction())}async removeWorkflowExperienceByTransaction(t){const e=this.workflowExperiences.findIndex((e=>e.getWorkflowManager().getTransaction().id===t.id));await this.removeTransaction(e,t)}async removeTransaction(t,e){if(!(t>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await ye.getShadowGraphqlClient().mutate({mutation:Ai,variables:{id:this.id,transactionId:e.id}}),this.workflowExperiences.splice(t,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await ye.getShadowGraphqlClient().mutate({mutation:ii,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,e){await ye.getShadowGraphqlClient().mutate({mutation:ni,variables:{id:this.id,details:t,type:e||oA.Owner}})}async updateStakeholders(t){await ye.getShadowGraphqlClient().mutate({mutation:ai,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await ye.getShadowGraphqlClient().query({query:$a,errorPolicy:"all",variables:{id:this.id}});if(!t.data.bundles||0===t.data.bundles.length)throw new Error("Bundle not found!");return t.data.bundles[0].bundleStakeholders||[]}async finish(){return Promise.all(this.workflowExperiences.map((t=>t.onDesignFinished())))}_setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await ye.getShadowGraphqlClient().mutate({mutation:ti,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,e])=>({key:t,value:e})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async checkConditionalHandlesChanged(t,e){(A=>{const n=this.globalPropertyHandleService.applyConditionsFromState(A,t),a=this.globalPropertyHandleService.applyConditionsFromState(A,e);if(n.length!==a.length)return!0;for(let t=0;t<n.length;t++)if(n[t].getName()!==a[t].getName())return!0;return!1})(await this.globalPropertyHandleService.getHandles())&&this.fireEvent("conditional-global-properties-changed")}fireEvent(t){(this.eventListeners.get(t)||[]).forEach((t=>t()))}}function Qi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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}const pi=ft`
|
|
704
704
|
mutation processFlowCreate($processFlowId: String!, $inputs: [String]!) {
|
|
705
705
|
processExecutionCreate(processFlowId: $processFlowId, inputs: $inputs) {
|
|
706
706
|
id
|
package/dist/types.d.ts
CHANGED
|
@@ -2011,6 +2011,10 @@ interface _Bundle1 {
|
|
|
2011
2011
|
* Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
|
|
2012
2012
|
*/
|
|
2013
2013
|
getGlobalPropertyStateManager(): GlobalPropertyStateManager;
|
|
2014
|
+
/**
|
|
2015
|
+
* Get the total in subunits for all global properties in this bundle.
|
|
2016
|
+
*/
|
|
2017
|
+
getGlobalPropertyTotalSubunits(): Promise<number>;
|
|
2014
2018
|
/**
|
|
2015
2019
|
* Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
|
|
2016
2020
|
*/
|