@spiffcommerce/core 12.9.8 → 12.9.9
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 +1 -1
- package/dist/module.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -672,7 +672,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),A=require("react/j
|
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
`;function hc(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 dc{constructor(t){hc(this,"bundleId",void 0),hc(this,"globalPropertyState",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t))}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}setAspect(t,e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=this.globalPropertyState.aspects.find((e=>e.name===t));return A?A.value=e:this.globalPropertyState.aspects.push({name:t,value:e}),this.updateGlobalPropertyState()}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await Qa.getShadowGraphqlClient().mutate({mutation:lc,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 Qa.getShadowGraphqlClient().query({query:gc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await Qa.getShadowGraphqlClient().mutate({mutation:cc,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 uc(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 wc{constructor(t,e){uc(this,"client",void 0),uc(this,"id",void 0),uc(this,"name",void 0),uc(this,"metadata",void 0),uc(this,"productCollection",void 0),uc(this,"globalConfigurations",void 0),uc(this,"globalPropertyStateManager",void 0),uc(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.globalConfigurations=this.resolveGlobalProperties(),this.globalPropertyStateManager=new dc(this.id)}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()}async hasGlobalProperties(){const t=await this.globalConfigurations;return t.length>0&&t.some((t=>t.aspects.length>0))}async getGlobalProperties(){const t=await this.globalConfigurations;if(0===t.length)return[];return(await Promise.all(t.map((t=>Promise.all(t.aspects.map((async t=>{switch(t.type){case tA.FileUpload:return new sc(this,t);case tA.Option:return new oc(this,t,t.entityId?await ka.getOption(t.entityId):void 0)}}))))))).flat()}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 Qa.getShadowGraphqlClient().mutate({mutation:_o,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);if(!(e>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await Qa.getShadowGraphqlClient().mutate({mutation:tc,variables:{id:this.id,transactionId:t.getWorkflowManager().getTransaction().id}}),this.workflowExperiences.splice(e,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await Qa.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 Qa.getShadowGraphqlClient().mutate({mutation:ec,variables:{id:this.id,details:t,type:e||ir.Owner}})}async updateStakeholders(t){await Qa.getShadowGraphqlClient().mutate({mutation:Ac,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await Qa.getShadowGraphqlClient().query({query:qo,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||[]}setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await Qa.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 resolveGlobalProperties(){const t=this.productCollection;if(!t)return Promise.resolve([]);const e=new Set;t.products.forEach((t=>t.workflows?.forEach((t=>e.add(t.workflowName)))));const A=await Qa.getShadowGraphqlClient().query({query:ic,errorPolicy:"all",variables:{ids:Array.from(e)}}),i=new Map;return A.data.workflows?.forEach((t=>{t.globalPropertyConfiguration&&i.set(t.globalPropertyConfiguration.id,t.globalPropertyConfiguration)})),
|
|
675
|
+
`;function hc(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 dc{constructor(t){hc(this,"bundleId",void 0),hc(this,"globalPropertyState",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t))}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}setAspect(t,e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=this.globalPropertyState.aspects.find((e=>e.name===t));return A?A.value=e:this.globalPropertyState.aspects.push({name:t,value:e}),this.updateGlobalPropertyState()}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await Qa.getShadowGraphqlClient().mutate({mutation:lc,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 Qa.getShadowGraphqlClient().query({query:gc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const e=await Qa.getShadowGraphqlClient().mutate({mutation:cc,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 uc(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 wc{constructor(t,e){uc(this,"client",void 0),uc(this,"id",void 0),uc(this,"name",void 0),uc(this,"metadata",void 0),uc(this,"productCollection",void 0),uc(this,"globalConfigurations",void 0),uc(this,"globalPropertyStateManager",void 0),uc(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.globalConfigurations=this.resolveGlobalProperties(),this.globalPropertyStateManager=new dc(this.id)}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()}async hasGlobalProperties(){const t=await this.globalConfigurations;return t.length>0&&t.some((t=>t.aspects.length>0))}async getGlobalProperties(){const t=await this.globalConfigurations;if(0===t.length)return[];return(await Promise.all(t.map((t=>Promise.all(t.aspects.map((async t=>{switch(t.type){case tA.FileUpload:return new sc(this,t);case tA.Option:return new oc(this,t,t.entityId?await ka.getOption(t.entityId):void 0)}}))))))).flat()}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 Qa.getShadowGraphqlClient().mutate({mutation:_o,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);if(!(e>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await Qa.getShadowGraphqlClient().mutate({mutation:tc,variables:{id:this.id,transactionId:t.getWorkflowManager().getTransaction().id}}),this.workflowExperiences.splice(e,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await Qa.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 Qa.getShadowGraphqlClient().mutate({mutation:ec,variables:{id:this.id,details:t,type:e||ir.Owner}})}async updateStakeholders(t){await Qa.getShadowGraphqlClient().mutate({mutation:Ac,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await Qa.getShadowGraphqlClient().query({query:qo,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||[]}setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await Qa.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 resolveGlobalProperties(){const t=this.productCollection;if(!t)return Promise.resolve([]);const e=new Set;t.products.forEach((t=>t.workflows?.forEach((t=>e.add(t.workflowName)))));const A=await Qa.getShadowGraphqlClient().query({query:ic,errorPolicy:"all",variables:{ids:Array.from(e)}}),i=new Map;return A.data.workflows?.forEach((t=>{t.globalPropertyConfiguration&&i.set(t.globalPropertyConfiguration.id,t.globalPropertyConfiguration)})),Array.from(i.values())}}function Bc(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}const pc=t.gql`
|
|
676
676
|
fragment RegionFields on Region {
|
|
677
677
|
width
|
|
678
678
|
top
|
package/dist/module.js
CHANGED
|
@@ -672,7 +672,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
`;function di(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 hi{constructor(t){di(this,"bundleId",void 0),di(this,"globalPropertyState",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t))}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=this.globalPropertyState.aspects.find((A=>A.name===t));if(A)return A.value}setAspect(t,A){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((A=>A.name===t));return e?e.value=A:this.globalPropertyState.aspects.push({name:t,value:A}),this.updateGlobalPropertyState()}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await yA.getShadowGraphqlClient().mutate({mutation:Bi,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:wi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const A=await yA.getShadowGraphqlClient().mutate({mutation:li,variables:{bundleId:this.bundleId}});if(A.data?.globalPropertyStateCreate&&A.data.globalPropertyStateCreate.id)return A.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Ei(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 Ci{constructor(t,A){Ei(this,"client",void 0),Ei(this,"id",void 0),Ei(this,"name",void 0),Ei(this,"metadata",void 0),Ei(this,"productCollection",void 0),Ei(this,"globalConfigurations",void 0),Ei(this,"globalPropertyStateManager",void 0),Ei(this,"workflowExperiences",[]),this.client=t,this.id=A.id,this.name=A.name||"",this.metadata=new Map(A.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=A.productCollection,this.globalConfigurations=this.resolveGlobalProperties(),this.globalPropertyStateManager=new hi(this.id)}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,A){return this.name=t,this.metadata=new Map(A),this.updateBundle()}async hasGlobalProperties(){const t=await this.globalConfigurations;return t.length>0&&t.some((t=>t.aspects.length>0))}async getGlobalProperties(){const t=await this.globalConfigurations;if(0===t.length)return[];return(await Promise.all(t.map((t=>Promise.all(t.aspects.map((async t=>{switch(t.type){case It.FileUpload:return new ci(this,t);case It.Option:return new gi(this,t,t.entityId?await bA.getOption(t.entityId):void 0)}}))))))).flat()}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,A)=>t+A),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const A=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===A)))throw new Error("Unable to add transaction to bundle - Already Exists!");await yA.getShadowGraphqlClient().mutate({mutation:Ai,variables:{id:this.id,transactionId:A}}),this.workflowExperiences.push(t);const e=await this.getGlobalProperties();await Promise.all(e.map((A=>A.applyGlobalState([t]))))}async removeWorkflowExperience(t){const A=this.workflowExperiences.indexOf(t);if(!(A>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await yA.getShadowGraphqlClient().mutate({mutation:ei,variables:{id:this.id,transactionId:t.getWorkflowManager().getTransaction().id}}),this.workflowExperiences.splice(A,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await yA.getShadowGraphqlClient().mutate({mutation:oi,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,A){await yA.getShadowGraphqlClient().mutate({mutation:ni,variables:{id:this.id,details:t,type:A||oe.Owner}})}async updateStakeholders(t){await yA.getShadowGraphqlClient().mutate({mutation:ai,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await yA.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||[]}setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await yA.getShadowGraphqlClient().mutate({mutation:ti,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,A])=>({key:t,value:A})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async resolveGlobalProperties(){const t=this.productCollection;if(!t)return Promise.resolve([]);const A=new Set;t.products.forEach((t=>t.workflows?.forEach((t=>A.add(t.workflowName)))));const e=await yA.getShadowGraphqlClient().query({query:ii,errorPolicy:"all",variables:{ids:Array.from(A)}}),n=new Map;return e.data.workflows?.forEach((t=>{t.globalPropertyConfiguration&&n.set(t.globalPropertyConfiguration.id,t.globalPropertyConfiguration)})),
|
|
675
|
+
`;function di(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 hi{constructor(t){di(this,"bundleId",void 0),di(this,"globalPropertyState",void 0),this.bundleId=t,this.getOrCreateGlobalPropertyState().then((t=>this.globalPropertyState=t))}getGlobalPropertyState(){return this.globalPropertyState}getAspect(t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const A=this.globalPropertyState.aspects.find((A=>A.name===t));if(A)return A.value}setAspect(t,A){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const e=this.globalPropertyState.aspects.find((A=>A.name===t));return e?e.value=A:this.globalPropertyState.aspects.push({name:t,value:A}),this.updateGlobalPropertyState()}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=await yA.getShadowGraphqlClient().mutate({mutation:Bi,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:wi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{bundleId:this.bundleId}});if(t.data.globalPropertyState&&t.data.globalPropertyState.id)return t.data.globalPropertyState;const A=await yA.getShadowGraphqlClient().mutate({mutation:li,variables:{bundleId:this.bundleId}});if(A.data?.globalPropertyStateCreate&&A.data.globalPropertyStateCreate.id)return A.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}function Ei(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 Ci{constructor(t,A){Ei(this,"client",void 0),Ei(this,"id",void 0),Ei(this,"name",void 0),Ei(this,"metadata",void 0),Ei(this,"productCollection",void 0),Ei(this,"globalConfigurations",void 0),Ei(this,"globalPropertyStateManager",void 0),Ei(this,"workflowExperiences",[]),this.client=t,this.id=A.id,this.name=A.name||"",this.metadata=new Map(A.metadata?.map((t=>[t.key,t.value]))||[]),this.productCollection=A.productCollection,this.globalConfigurations=this.resolveGlobalProperties(),this.globalPropertyStateManager=new hi(this.id)}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,A){return this.name=t,this.metadata=new Map(A),this.updateBundle()}async hasGlobalProperties(){const t=await this.globalConfigurations;return t.length>0&&t.some((t=>t.aspects.length>0))}async getGlobalProperties(){const t=await this.globalConfigurations;if(0===t.length)return[];return(await Promise.all(t.map((t=>Promise.all(t.aspects.map((async t=>{switch(t.type){case It.FileUpload:return new ci(this,t);case It.Option:return new gi(this,t,t.entityId?await bA.getOption(t.entityId):void 0)}}))))))).flat()}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}getTotalSubunits(){return this.workflowExperiences.map((t=>t.getTotalPriceSubunits())).reduce(((t,A)=>t+A),0)}getProductCollection(){return this.productCollection}async addWorkflowExperience(t){const A=t.getWorkflowManager().getTransaction().id;if(this.workflowExperiences.find((t=>t.getWorkflowManager().getTransaction().id===A)))throw new Error("Unable to add transaction to bundle - Already Exists!");await yA.getShadowGraphqlClient().mutate({mutation:Ai,variables:{id:this.id,transactionId:A}}),this.workflowExperiences.push(t);const e=await this.getGlobalProperties();await Promise.all(e.map((A=>A.applyGlobalState([t]))))}async removeWorkflowExperience(t){const A=this.workflowExperiences.indexOf(t);if(!(A>-1))throw new Error("Unable to remove workflow experience from bundle - Not Found!");await yA.getShadowGraphqlClient().mutate({mutation:ei,variables:{id:this.id,transactionId:t.getWorkflowManager().getTransaction().id}}),this.workflowExperiences.splice(A,1)}getWorkflowExperiences(){return[...this.workflowExperiences]}async sortWorkflowExperiences(t){this.workflowExperiences=this.workflowExperiences.sort(t),await yA.getShadowGraphqlClient().mutate({mutation:oi,variables:{id:this.id,transactionIds:this.workflowExperiences.map((t=>t.getWorkflowManager().getTransaction().id))}})}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(t,A){await yA.getShadowGraphqlClient().mutate({mutation:ni,variables:{id:this.id,details:t,type:A||oe.Owner}})}async updateStakeholders(t){await yA.getShadowGraphqlClient().mutate({mutation:ai,variables:{id:this.id,input:t}})}async getAllStakeholders(){const t=await yA.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||[]}setWorkflowExperiencesInternal(t){this.workflowExperiences=t}async updateBundle(){if(!(await yA.getShadowGraphqlClient().mutate({mutation:ti,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map((([t,A])=>({key:t,value:A})))}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async resolveGlobalProperties(){const t=this.productCollection;if(!t)return Promise.resolve([]);const A=new Set;t.products.forEach((t=>t.workflows?.forEach((t=>A.add(t.workflowName)))));const e=await yA.getShadowGraphqlClient().query({query:ii,errorPolicy:"all",variables:{ids:Array.from(A)}}),n=new Map;return e.data.workflows?.forEach((t=>{t.globalPropertyConfiguration&&n.set(t.globalPropertyConfiguration.id,t.globalPropertyConfiguration)})),Array.from(n.values())}}function Qi(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}const ui=ft`
|
|
676
676
|
${FA}
|
|
677
677
|
${SA}
|
|
678
678
|
${GA}
|