@spiffcommerce/core 12.10.6 → 12.10.8

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 CHANGED
@@ -471,7 +471,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),A=require("react/j
471
471
  id
472
472
  }
473
473
  }
474
- `;class Mo extends yo{constructor(t,e){super(t,e),Do(this,"transaction",this.manager.getTransaction())}selectVariant(){throw new Error("Bulk step does not support variants.")}async setDesignName(t){await Qr.getShadowGraphqlClient().mutate({mutation:xo,variables:{transactionId:this.manager.getTransaction().id,designName:t}});const e=this.manager.getTransaction();this.manager.setTransaction({...e,designName:t})}addVariationRecord(){const t=this.manager.addVariationRecord({transactionId:this.transaction.id,values:[]});return this.manager.setCurrentVariationRecord(t),t}updateBulkIsConnected(t){this.manager.updateStorage(this.getId(),{bulkIsConnected:t})}openBulkSourceUrl(){window.open(this.transaction.bulkSourceUrl,"_blank")}async sendGoogleSheetLinkToEmail(t){await Qr.getShadowGraphqlClient().mutate({mutation:Io,variables:{id:this.transaction.id,details:{emailAddress:t},type:"Owner"}}),this.openBulkSourceUrl()}deleteVariationRecord(t){this.manager.removeVariationRecord(t)}getAspects(){return this.step.data.aspects}}class vo extends yo{constructor(t,e){super(t,e)}async selectVariant(t){if(this.getCurrentVariant()!==t)return Ao.selectVariant(this.step,t.getResource(),this.manager.getRegionElements(this.step.stepName)||[],(t=>this.setUpdateState(t)),this.manager)}getColors(){const t=this.manager.getRegionElements(this.step.stepName)||[];if(0!==t.length)try{return ji(t[0].id,this.manager.getAllLayoutData()).colors}catch(t){console.error(t)}}setColor(t,e){const A=new Map;return A.set(t,e),Ao.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,(()=>this.manager.getCommandContext().getAllLayouts()),A)}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?Ao.availableColors(this.step,this.manager):Promise.resolve([])}hasVaryingSelection(){return this.step.data.varySelection}hasVaryingColors(){return this.step.data.varyColors}isColorPickerEnabled(){return this.step.data.colorPickerEnabled}}class So extends yo{constructor(t,e){super(t,e)}selectVariant(t){return io.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Fo extends yo{constructor(t,e){super(t,e)}selectVariant(t){return no.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class bo extends yo{constructor(t,e){super(t,e)}selectVariant(t){return ao.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Yo extends yo{constructor(t,e){super(t,e)}async selectVariant(t){if(!t.getId())throw new Error("Unable to select variant with a null ID");await so.selectVariant(this.step,t.getId(),this.manager)}getDisplayType(){return this.step.option?.displayType}}class Po extends yo{constructor(t,e){super(t,e)}selectVariant(t){return Promise.resolve()}setColor(t){return oo.selectVariant(this.step,t,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return oo.availableColours(this.step)}}class No extends yo{constructor(t,e){super(t,e)}async selectVariant(t){uo.selectVariant(this.step,t.getResource(),this.manager,(t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:"An issue has occured with test",messageType:Bo.Error,stepID:this.step.stepName}]);else{const t=this.manager.getInformationResults().filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}}),(t=>{}))}getAvailableFillColors(){return this.step.data.colorPickerEnabled?uo.availableFillColors(this.step):[]}async setFillColor(t){const e=this.manager.getRegionElements(this.step.stepName);await uo.changeFillColor(this.step,t,e,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return uo.availableFillImages(this.step)}async setFillImage(t){const e=this.manager.getRegionElements(this.step.stepName);await uo.changeFillImage(this.step,t,e,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}setFullTextCustomization(t){const e=this.manager.getStepStorage(this.step.stepName)?.inputText||"",A=void 0!==this.step.data.replaceableText?this.step.data.replaceableText.replace("{{}}",e):e,i=t?A:this.step.data.defaultText;this.manager.updateStorage(this.step.stepName,{customiseAllText:t,text:i,defaultCleared:!1});return this.setText(i)}setText(t){const e={input:t},A=uo.findLayoutElements(this.manager,this.step),i=uo.filterUnsupportedCharacters(t,A[0]?.fontData);!!this.step.data&&!!this.step.data.maxLength&&i.length>this.step.data.maxLength||(e.input=i);const n=A.length<=0,r=n?{inputText:i,text:i}:{inputText:i};if(this.manager.updateStorage(this.step.stepName,r),this.manager.updateMetadata(this.step.stepName,{text:i}),n)return e;const{command:a,errors:s,helperText:o}=uo.updateInputText(i,A,this.step,this.manager);a&&this.manager.getCommandDispatcher()(a);const c=this.manager.getInformationResults(),l=s[0]?.localizationKey;if(l)this.manager.setInformationResults([...c,{message:`${l} - ${this.step.stepTitle}`,messageType:Bo.Error,stepID:this.step.stepName}]);else{const t=c.filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}return e.helperText=l||o,e.errorText=l,e}getText(){const t=this.step.data.defaultText;return this.manager.getStepStorage(this.step.stepName)?.text||t||""}isReplaceable(){return this.step.data.userCanReplaceText}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");return this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""}),t}}hasVaryingText(){return this.step.data.varyText}hasVaryingColor(){return this.step.data.varyColor}hasVaryingSelection(){return this.step.data.varySelection}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const t=this.step.data.maxLength;if(void 0===t)return;return t-this.getText().length}}class Ro{static get(t,e){switch(e.type){case aA.Question:return new Yo(t,e);case aA.Text:return new No(t,e);case aA.Illustration:return new vo(t,e);case aA.Picture:return new bo(t,e);case aA.Shape:return new Po(t,e);case aA.Material:return new So(t,e);case aA.Model:return new Fo(t,e);case aA.Frame:return new kc(t,e);case aA.Bulk:return new Mo(t,e);default:throw new nr(`Step type ${e.type} not yet supported in Core SDK`)}}}function ko(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 Ho=t.gql`
474
+ `;class Mo extends yo{constructor(t,e){super(t,e),Do(this,"transaction",this.manager.getTransaction())}selectVariant(){throw new Error("Bulk step does not support variants.")}async setDesignName(t){await Qr.getShadowGraphqlClient().mutate({mutation:xo,variables:{transactionId:this.manager.getTransaction().id,designName:t}});const e=this.manager.getTransaction();this.manager.setTransaction({...e,designName:t})}addVariationRecord(){const t=this.manager.addVariationRecord({transactionId:this.transaction.id,values:[]});return this.manager.setCurrentVariationRecord(t),t}updateBulkIsConnected(t){this.manager.updateStorage(this.getId(),{bulkIsConnected:t})}openBulkSourceUrl(){window.open(this.transaction.bulkSourceUrl,"_blank")}async sendGoogleSheetLinkToEmail(t){await Qr.getShadowGraphqlClient().mutate({mutation:Io,variables:{id:this.transaction.id,details:{emailAddress:t},type:"Owner"}}),this.openBulkSourceUrl()}deleteVariationRecord(t){this.manager.removeVariationRecord(t)}getAspects(){return this.step.data.aspects}}class vo extends yo{constructor(t,e){super(t,e)}async selectVariant(t){if(this.getCurrentVariant()!==t)return Ao.selectVariant(this.step,t.getResource(),this.manager.getRegionElements(this.step.stepName)||[],(t=>this.setUpdateState(t)),this.manager)}getColors(){const t=this.manager.getRegionElements(this.step.stepName)||[];if(0!==t.length)try{return ji(t[0].id,this.manager.getAllLayoutData()).colors}catch(t){console.error(t)}}setColor(t,e){const A=new Map;return A.set(t,e),Ao.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,(()=>this.manager.getCommandContext().getAllLayouts()),A)}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?Ao.availableColors(this.step,this.manager):Promise.resolve([])}hasVaryingSelection(){return this.step.data.varySelection}hasVaryingColors(){return this.step.data.varyColors}isColorPickerEnabled(){return this.step.data.colorPickerEnabled}}class So extends yo{constructor(t,e){super(t,e)}selectVariant(t){return io.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Fo extends yo{constructor(t,e){super(t,e)}selectVariant(t){return no.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class bo extends yo{constructor(t,e){super(t,e)}selectVariant(t){return ao.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Yo extends yo{constructor(t,e){super(t,e)}async selectVariant(t){if(!t.getId())throw new Error("Unable to select variant with a null ID");await so.selectVariant(this.step,t.getId(),this.manager)}getDisplayType(){return this.step.option?.displayType}}class Po extends yo{constructor(t,e){super(t,e)}selectVariant(t){const e=t.getResource();return oo.selectVariant(this.step,{fill:e.color,stroke:e.color,variant:e},this.manager.getRegionElements(this.step.stepName)||[],this.manager)}setColor(t){return oo.selectVariant(this.step,t,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return oo.availableColours(this.step)}}class No extends yo{constructor(t,e){super(t,e)}async selectVariant(t){uo.selectVariant(this.step,t.getResource(),this.manager,(t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:"An issue has occured with test",messageType:Bo.Error,stepID:this.step.stepName}]);else{const t=this.manager.getInformationResults().filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}}),(t=>{}))}getAvailableFillColors(){return this.step.data.colorPickerEnabled?uo.availableFillColors(this.step):[]}async setFillColor(t){const e=this.manager.getRegionElements(this.step.stepName);await uo.changeFillColor(this.step,t,e,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return uo.availableFillImages(this.step)}async setFillImage(t){const e=this.manager.getRegionElements(this.step.stepName);await uo.changeFillImage(this.step,t,e,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}setFullTextCustomization(t){const e=this.manager.getStepStorage(this.step.stepName)?.inputText||"",A=void 0!==this.step.data.replaceableText?this.step.data.replaceableText.replace("{{}}",e):e,i=t?A:this.step.data.defaultText;this.manager.updateStorage(this.step.stepName,{customiseAllText:t,text:i,defaultCleared:!1});return this.setText(i)}setText(t){const e={input:t},A=uo.findLayoutElements(this.manager,this.step),i=uo.filterUnsupportedCharacters(t,A[0]?.fontData);!!this.step.data&&!!this.step.data.maxLength&&i.length>this.step.data.maxLength||(e.input=i);const n=A.length<=0,r=n?{inputText:i,text:i}:{inputText:i};if(this.manager.updateStorage(this.step.stepName,r),this.manager.updateMetadata(this.step.stepName,{text:i}),n)return e;const{command:a,errors:s,helperText:o}=uo.updateInputText(i,A,this.step,this.manager);a&&this.manager.getCommandDispatcher()(a);const c=this.manager.getInformationResults(),l=s[0]?.localizationKey;if(l)this.manager.setInformationResults([...c,{message:`${l} - ${this.step.stepTitle}`,messageType:Bo.Error,stepID:this.step.stepName}]);else{const t=c.filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}return e.helperText=l||o,e.errorText=l,e}getText(){const t=this.step.data.defaultText;return this.manager.getStepStorage(this.step.stepName)?.text||t||""}isReplaceable(){return this.step.data.userCanReplaceText}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");return this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""}),t}}hasVaryingText(){return this.step.data.varyText}hasVaryingColor(){return this.step.data.varyColor}hasVaryingSelection(){return this.step.data.varySelection}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const t=this.step.data.maxLength;if(void 0===t)return;return t-this.getText().length}}class Ro{static get(t,e){switch(e.type){case aA.Question:return new Yo(t,e);case aA.Text:return new No(t,e);case aA.Illustration:return new vo(t,e);case aA.Picture:return new bo(t,e);case aA.Shape:return new Po(t,e);case aA.Material:return new So(t,e);case aA.Model:return new Fo(t,e);case aA.Frame:return new kc(t,e);case aA.Bulk:return new Mo(t,e);default:throw new nr(`Step type ${e.type} not yet supported in Core SDK`)}}}function ko(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 Ho=t.gql`
475
475
  mutation CreateDesign(
476
476
  $name: String!
477
477
  $layouts: [LayoutInput]!
@@ -881,6 +881,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),A=require("react/j
881
881
  steps {
882
882
  stepName
883
883
  type
884
+ globalPropertyConfigurationAspectNames
884
885
  option {
885
886
  ...OptionFields
886
887
  }
package/dist/module.js CHANGED
@@ -471,7 +471,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
471
471
  id
472
472
  }
473
473
  }
474
- `;class va extends Ma{constructor(t,A){super(t,A),Fa(this,"transaction",this.manager.getTransaction())}selectVariant(){throw new Error("Bulk step does not support variants.")}async setDesignName(t){await yA.getShadowGraphqlClient().mutate({mutation:Sa,variables:{transactionId:this.manager.getTransaction().id,designName:t}});const A=this.manager.getTransaction();this.manager.setTransaction({...A,designName:t})}addVariationRecord(){const t=this.manager.addVariationRecord({transactionId:this.transaction.id,values:[]});return this.manager.setCurrentVariationRecord(t),t}updateBulkIsConnected(t){this.manager.updateStorage(this.getId(),{bulkIsConnected:t})}openBulkSourceUrl(){window.open(this.transaction.bulkSourceUrl,"_blank")}async sendGoogleSheetLinkToEmail(t){await yA.getShadowGraphqlClient().mutate({mutation:Ya,variables:{id:this.transaction.id,details:{emailAddress:t},type:"Owner"}}),this.openBulkSourceUrl()}deleteVariationRecord(t){this.manager.removeVariationRecord(t)}getAspects(){return this.step.data.aspects}}class xa extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){if(this.getCurrentVariant()!==t)return oa.selectVariant(this.step,t.getResource(),this.manager.getRegionElements(this.step.stepName)||[],(t=>this.setUpdateState(t)),this.manager)}getColors(){const t=this.manager.getRegionElements(this.step.stepName)||[];if(0!==t.length)try{return y(t[0].id,this.manager.getAllLayoutData()).colors}catch(t){console.error(t)}}setColor(t,A){const e=new Map;return e.set(t,A),oa.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,(()=>this.manager.getCommandContext().getAllLayouts()),e)}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?oa.availableColors(this.step,this.manager):Promise.resolve([])}hasVaryingSelection(){return this.step.data.varySelection}hasVaryingColors(){return this.step.data.varyColors}isColorPickerEnabled(){return this.step.data.colorPickerEnabled}}class Na extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return ra.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Ra extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return sa.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Pa extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return ga.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Ha extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){if(!t.getId())throw new Error("Unable to select variant with a null ID");await la.selectVariant(this.step,t.getId(),this.manager)}getDisplayType(){return this.step.option?.displayType}}class Ua extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return Promise.resolve()}setColor(t){return Ba.selectVariant(this.step,t,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return Ba.availableColours(this.step)}}class Ga extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){Ca.selectVariant(this.step,t.getResource(),this.manager,(t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:"An issue has occured with test",messageType:ua.Error,stepID:this.step.stepName}]);else{const t=this.manager.getInformationResults().filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}}),(t=>{}))}getAvailableFillColors(){return this.step.data.colorPickerEnabled?Ca.availableFillColors(this.step):[]}async setFillColor(t){const A=this.manager.getRegionElements(this.step.stepName);await Ca.changeFillColor(this.step,t,A,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return Ca.availableFillImages(this.step)}async setFillImage(t){const A=this.manager.getRegionElements(this.step.stepName);await Ca.changeFillImage(this.step,t,A,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}setFullTextCustomization(t){const A=this.manager.getStepStorage(this.step.stepName)?.inputText||"",e=void 0!==this.step.data.replaceableText?this.step.data.replaceableText.replace("{{}}",A):A,n=t?e:this.step.data.defaultText;this.manager.updateStorage(this.step.stepName,{customiseAllText:t,text:n,defaultCleared:!1});return this.setText(n)}setText(t){const A={input:t},e=Ca.findLayoutElements(this.manager,this.step),n=Ca.filterUnsupportedCharacters(t,e[0]?.fontData);!!this.step.data&&!!this.step.data.maxLength&&n.length>this.step.data.maxLength||(A.input=n);const a=e.length<=0,i=a?{inputText:n,text:n}:{inputText:n};if(this.manager.updateStorage(this.step.stepName,i),this.manager.updateMetadata(this.step.stepName,{text:n}),a)return A;const{command:o,errors:r,helperText:s}=Ca.updateInputText(n,e,this.step,this.manager);o&&this.manager.getCommandDispatcher()(o);const c=this.manager.getInformationResults(),g=r[0]?.localizationKey;if(g)this.manager.setInformationResults([...c,{message:`${g} - ${this.step.stepTitle}`,messageType:ua.Error,stepID:this.step.stepName}]);else{const t=c.filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}return A.helperText=g||s,A.errorText=g,A}getText(){const t=this.step.data.defaultText;return this.manager.getStepStorage(this.step.stepName)?.text||t||""}isReplaceable(){return this.step.data.userCanReplaceText}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");return this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""}),t}}hasVaryingText(){return this.step.data.varyText}hasVaryingColor(){return this.step.data.varyColor}hasVaryingSelection(){return this.step.data.varySelection}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const t=this.step.data.maxLength;if(void 0===t)return;return t-this.getText().length}}class ka{static get(t,A){switch(A.type){case m.Question:return new Ha(t,A);case m.Text:return new Ga(t,A);case m.Illustration:return new xa(t,A);case m.Picture:return new Pa(t,A);case m.Shape:return new Ua(t,A);case m.Material:return new Na(t,A);case m.Model:return new Ra(t,A);case m.Frame:return new Hi(t,A);case m.Bulk:return new va(t,A);default:throw new rA(`Step type ${A.type} not yet supported in Core SDK`)}}}function ba(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 Ja=ft`
474
+ `;class va extends Ma{constructor(t,A){super(t,A),Fa(this,"transaction",this.manager.getTransaction())}selectVariant(){throw new Error("Bulk step does not support variants.")}async setDesignName(t){await yA.getShadowGraphqlClient().mutate({mutation:Sa,variables:{transactionId:this.manager.getTransaction().id,designName:t}});const A=this.manager.getTransaction();this.manager.setTransaction({...A,designName:t})}addVariationRecord(){const t=this.manager.addVariationRecord({transactionId:this.transaction.id,values:[]});return this.manager.setCurrentVariationRecord(t),t}updateBulkIsConnected(t){this.manager.updateStorage(this.getId(),{bulkIsConnected:t})}openBulkSourceUrl(){window.open(this.transaction.bulkSourceUrl,"_blank")}async sendGoogleSheetLinkToEmail(t){await yA.getShadowGraphqlClient().mutate({mutation:Ya,variables:{id:this.transaction.id,details:{emailAddress:t},type:"Owner"}}),this.openBulkSourceUrl()}deleteVariationRecord(t){this.manager.removeVariationRecord(t)}getAspects(){return this.step.data.aspects}}class xa extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){if(this.getCurrentVariant()!==t)return oa.selectVariant(this.step,t.getResource(),this.manager.getRegionElements(this.step.stepName)||[],(t=>this.setUpdateState(t)),this.manager)}getColors(){const t=this.manager.getRegionElements(this.step.stepName)||[];if(0!==t.length)try{return y(t[0].id,this.manager.getAllLayoutData()).colors}catch(t){console.error(t)}}setColor(t,A){const e=new Map;return e.set(t,A),oa.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,(()=>this.manager.getCommandContext().getAllLayouts()),e)}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?oa.availableColors(this.step,this.manager):Promise.resolve([])}hasVaryingSelection(){return this.step.data.varySelection}hasVaryingColors(){return this.step.data.varyColors}isColorPickerEnabled(){return this.step.data.colorPickerEnabled}}class Na extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return ra.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Ra extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return sa.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Pa extends Ma{constructor(t,A){super(t,A)}selectVariant(t){return ga.selectVariant(this.step,t.getResource(),this.manager,(t=>this.setUpdateState(t)))}}class Ha extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){if(!t.getId())throw new Error("Unable to select variant with a null ID");await la.selectVariant(this.step,t.getId(),this.manager)}getDisplayType(){return this.step.option?.displayType}}class Ua extends Ma{constructor(t,A){super(t,A)}selectVariant(t){const A=t.getResource();return Ba.selectVariant(this.step,{fill:A.color,stroke:A.color,variant:A},this.manager.getRegionElements(this.step.stepName)||[],this.manager)}setColor(t){return Ba.selectVariant(this.step,t,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return Ba.availableColours(this.step)}}class Ga extends Ma{constructor(t,A){super(t,A)}async selectVariant(t){Ca.selectVariant(this.step,t.getResource(),this.manager,(t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:"An issue has occured with test",messageType:ua.Error,stepID:this.step.stepName}]);else{const t=this.manager.getInformationResults().filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}}),(t=>{}))}getAvailableFillColors(){return this.step.data.colorPickerEnabled?Ca.availableFillColors(this.step):[]}async setFillColor(t){const A=this.manager.getRegionElements(this.step.stepName);await Ca.changeFillColor(this.step,t,A,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return Ca.availableFillImages(this.step)}async setFillImage(t){const A=this.manager.getRegionElements(this.step.stepName);await Ca.changeFillImage(this.step,t,A,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}setFullTextCustomization(t){const A=this.manager.getStepStorage(this.step.stepName)?.inputText||"",e=void 0!==this.step.data.replaceableText?this.step.data.replaceableText.replace("{{}}",A):A,n=t?e:this.step.data.defaultText;this.manager.updateStorage(this.step.stepName,{customiseAllText:t,text:n,defaultCleared:!1});return this.setText(n)}setText(t){const A={input:t},e=Ca.findLayoutElements(this.manager,this.step),n=Ca.filterUnsupportedCharacters(t,e[0]?.fontData);!!this.step.data&&!!this.step.data.maxLength&&n.length>this.step.data.maxLength||(A.input=n);const a=e.length<=0,i=a?{inputText:n,text:n}:{inputText:n};if(this.manager.updateStorage(this.step.stepName,i),this.manager.updateMetadata(this.step.stepName,{text:n}),a)return A;const{command:o,errors:r,helperText:s}=Ca.updateInputText(n,e,this.step,this.manager);o&&this.manager.getCommandDispatcher()(o);const c=this.manager.getInformationResults(),g=r[0]?.localizationKey;if(g)this.manager.setInformationResults([...c,{message:`${g} - ${this.step.stepTitle}`,messageType:ua.Error,stepID:this.step.stepName}]);else{const t=c.filter((t=>t.stepID!==this.step.stepName));this.manager.setInformationResults(t)}return A.helperText=g||s,A.errorText=g,A}getText(){const t=this.step.data.defaultText;return this.manager.getStepStorage(this.step.stepName)?.text||t||""}isReplaceable(){return this.step.data.userCanReplaceText}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");return this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""}),t}}hasVaryingText(){return this.step.data.varyText}hasVaryingColor(){return this.step.data.varyColor}hasVaryingSelection(){return this.step.data.varySelection}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const t=this.step.data.maxLength;if(void 0===t)return;return t-this.getText().length}}class ka{static get(t,A){switch(A.type){case m.Question:return new Ha(t,A);case m.Text:return new Ga(t,A);case m.Illustration:return new xa(t,A);case m.Picture:return new Pa(t,A);case m.Shape:return new Ua(t,A);case m.Material:return new Na(t,A);case m.Model:return new Ra(t,A);case m.Frame:return new Hi(t,A);case m.Bulk:return new va(t,A);default:throw new rA(`Step type ${A.type} not yet supported in Core SDK`)}}}function ba(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 Ja=ft`
475
475
  mutation CreateDesign(
476
476
  $name: String!
477
477
  $layouts: [LayoutInput]!
@@ -881,6 +881,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
881
881
  steps {
882
882
  stepName
883
883
  type
884
+ globalPropertyConfigurationAspectNames
884
885
  option {
885
886
  ...OptionFields
886
887
  }
package/dist/types.d.ts CHANGED
@@ -1582,11 +1582,12 @@ export class QuestionStepHandle extends StepHandle<_QuestionStepData1> {
1582
1582
  }
1583
1583
  export class ShapeStepHandle extends StepHandle<_ShapeStepData1> {
1584
1584
  constructor(manager: WorkflowManager, step: _Step1<_ShapeStepData1>);
1585
- selectVariant(_: Variant): Promise<void>;
1585
+ selectVariant(variant: Variant): Promise<void>;
1586
1586
  /**
1587
1587
  * Sets the color of the shape.
1588
1588
  * @param color The color option to use.
1589
1589
  * @returns A promise resolving when the color has changed in the design.
1590
+ * @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
1590
1591
  */
1591
1592
  setColor(color: ColorOption): Promise<void>;
1592
1593
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "12.10.6",
3
+ "version": "12.10.8",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",