@spiffcommerce/core 12.9.7 → 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 +35 -23
- package/dist/module.js +13 -1
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -213,6 +213,9 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
213
213
|
integrationProduct {
|
|
214
214
|
id
|
|
215
215
|
externalProductId
|
|
216
|
+
externalVariantId
|
|
217
|
+
additionalExternalProductId
|
|
218
|
+
additionalExternalVariantId
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
}
|
|
@@ -286,6 +289,9 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
286
289
|
integrationProduct {
|
|
287
290
|
id
|
|
288
291
|
externalProductId
|
|
292
|
+
externalVariantId
|
|
293
|
+
additionalExternalProductId
|
|
294
|
+
additionalExternalVariantId
|
|
289
295
|
}
|
|
290
296
|
}
|
|
291
297
|
}
|
|
@@ -366,6 +372,9 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
366
372
|
integrationProduct {
|
|
367
373
|
id
|
|
368
374
|
externalProductId
|
|
375
|
+
externalVariantId
|
|
376
|
+
additionalExternalProductId
|
|
377
|
+
additionalExternalVariantId
|
|
369
378
|
}
|
|
370
379
|
}
|
|
371
380
|
}
|
|
@@ -504,6 +513,9 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
504
513
|
integrationProducts {
|
|
505
514
|
id
|
|
506
515
|
externalProductId
|
|
516
|
+
externalVariantId
|
|
517
|
+
additionalExternalProductId
|
|
518
|
+
additionalExternalVariantId
|
|
507
519
|
integration {
|
|
508
520
|
enabled
|
|
509
521
|
externalIntegrationId
|
|
@@ -660,7 +672,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
660
672
|
}
|
|
661
673
|
}
|
|
662
674
|
}
|
|
663
|
-
`;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`
|
|
664
676
|
${FA}
|
|
665
677
|
${SA}
|
|
666
678
|
${GA}
|