@spiffcommerce/core 12.10.5 → 12.10.7
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 +2 -1
- package/package.json +1 -1
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
|
|
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]!
|
|
@@ -651,7 +651,7 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),A=require("react/j
|
|
|
651
651
|
id
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
`;function rc(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 ac{constructor(t,e){rc(this,"bundle",void 0),rc(this,"property",void 0),this.bundle=t,this.property=e}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){return(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>
|
|
654
|
+
`;function rc(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 ac{constructor(t,e){rc(this,"bundle",void 0),rc(this,"property",void 0),this.bundle=t,this.property=e}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){return(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyConfigurationAspectNames?.includes(this.property.name)))))}}class sc extends ac{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 Yr.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 oc extends ac{constructor(t,e,A){super(t,e),rc(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 fo(e):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new fo(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new fo(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 fo(A),t):Promise.resolve()}async applyVariantSelection(t,e){const A=this.getSharedSteps(e).map((e=>e.selectVariant(t)));await Promise.all(A)}}const cc=M.gql`
|
|
655
655
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
656
656
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
657
657
|
id
|
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
|
|
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]!
|
|
@@ -651,7 +651,7 @@ import{CommandContext as t,AssetType as A,BringForwardCommand as e,BringToFrontC
|
|
|
651
651
|
id
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
`;function ri(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 si{constructor(t,A){ri(this,"bundle",void 0),ri(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){return(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>
|
|
654
|
+
`;function ri(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 si{constructor(t,A){ri(this,"bundle",void 0),ri(this,"property",void 0),this.bundle=t,this.property=A}getName(){return this.property.name}getDescription(){return this.property.description}getType(){return this.property.type}getSharedSteps(t){return(t??this.bundle.getWorkflowExperiences()).flatMap((t=>t.getSteps().filter((t=>t.getRaw().globalPropertyConfigurationAspectNames?.includes(this.property.name)))))}}class ci extends si{constructor(t,A){super(t,A)}async selectImage(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.key),this.applyImageSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=await HA.getLocalOrFromServer(A);return e?this.applyImageSelection(e,t):Promise.resolve()}async applyImageSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectImage(t)));await Promise.all(e)}}class gi extends si{constructor(t,A,e){super(t,A),ri(this,"optionResource",void 0),this.optionResource=e}getCurrentVariant(){if(!this.optionResource)return;const t=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!t)return;const A=this.optionResource.variants?.find((A=>A.id===t));return A?new fa(A):void 0}getAvailableVariants(){return(this.optionResource?.variants?.filter((t=>t.enabled))||[]).map((t=>new fa(t)))}getAllVariants(){return(this.optionResource?.variants||[]).map((t=>new fa(t)))}async selectVariant(t){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,t.getId()),this.applyVariantSelection(t)])}async applyGlobalState(t){const A=this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);if(!A)return Promise.resolve();const e=this.optionResource?.variants?.find((t=>t.id===A));return e?this.applyVariantSelection(new fa(e),t):Promise.resolve()}async applyVariantSelection(t,A){const e=this.getSharedSteps(A).map((A=>A.selectVariant(t)));await Promise.all(e)}}const li=Zt`
|
|
655
655
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
656
656
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
657
657
|
id
|
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(
|
|
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
|
/**
|