@spiffcommerce/core 16.0.0-beta.4 → 16.0.0-beta.5

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/index.d.ts CHANGED
@@ -1102,7 +1102,7 @@ declare class Variant {
1102
1102
  getThumbnail(): string | undefined;
1103
1103
  /**
1104
1104
  * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
1105
- * @deprecated To be removed in a future version
1105
+ * @deprecated To be removed in a future version, Please use getThumbnail() instead
1106
1106
  */
1107
1107
  getDisplayImage(): string | undefined;
1108
1108
  /**
package/dist/index.js CHANGED
@@ -50543,7 +50543,7 @@ class Gi {
50543
50543
  }
50544
50544
  /**
50545
50545
  * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
50546
- * @deprecated To be removed in a future version
50546
+ * @deprecated To be removed in a future version, Please use getThumbnail() instead
50547
50547
  */
50548
50548
  getDisplayImage() {
50549
50549
  var t, n, r;
@@ -51139,18 +51139,19 @@ class io {
51139
51139
  const xE = ct`
51140
51140
  fragment CreateDesignTransaction on Transaction {
51141
51141
  id
51142
- designName
51143
51142
  bulk
51144
- priceModifierTotal
51145
- variationsCount
51146
- externalDesignProductId
51147
- externalDesignProductVariantId
51143
+ bulkEmailAddress
51144
+ designName
51148
51145
  externalCartProductId
51149
51146
  externalCartProductVariantId
51147
+ externalDesignProductId
51148
+ externalDesignProductVariantId
51149
+ lastSyncedAt
51150
+ previewImageLink
51151
+ priceModifierTotal
51152
+ variationsCount
51150
51153
  workflowViewerLink
51151
51154
  workflowViewerReadOnlyLink
51152
- lastSyncedAt
51153
- bulkEmailAddress
51154
51155
  }
51155
51156
  `, yO = ct`
51156
51157
  ${xE}
@@ -2053,18 +2053,19 @@ IfnI8vaNAAAAAElFTkSuQmCC" transform="matrix(0.13 0.0141 -0.0141 0.1301 104.926 1
2053
2053
  `;class OE extends Xn{constructor(t,n){super(t,n),this.transaction=this.manager.getTransaction()}selectVariant(){throw new Error("Bulk step does not support variants.")}async setDesignName(t){await St.getShadowGraphqlClient().mutate({mutation:RO,variables:{transactionId:this.manager.getTransaction().id,designName:t}});const n=this.manager.getTransaction();this.manager.setTransaction({...n,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 St.getShadowGraphqlClient().mutate({mutation:RE,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 UE extends Xn{constructor(t,n){super(t,n)}async selectVariant(t){if(this.getCurrentVariant()!==t)return Ro.selectVariant(this.step,t.getResource(),this.manager.getRegionElements(this.step.stepName)||[],n=>this.setUpdateState(n),this.manager)}getColors(){const t=this.manager.getRegionElements(this.step.stepName)||[];if(t.length!==0)try{return we(t[0].id,this.manager.getAllLayoutData()).colors}catch(n){console.error(n)}}setColor(t,n){const r=new Map;return r.set(t,n),Ro.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,()=>this.manager.getCommandContext().getAllLayouts(),r)}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?Ro.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 LE extends Xn{constructor(t,n){super(t,n)}selectVariant(t){return C0.selectVariant(this.step,t.getResource(),this.manager,n=>this.setUpdateState(n))}}class YE extends Xn{constructor(t,n){super(t,n)}selectVariant(t){return x0.selectVariant(this.step,t.getResource(),this.manager,n=>this.setUpdateState(n))}}class HE extends Xn{constructor(t,n){super(t,n)}selectVariant(t){return F0.selectVariant(this.step,t.getResource(),this.manager,n=>this.setUpdateState(n))}}class GE extends Xn{constructor(t,n){super(t,n)}async selectVariant(t){if(!t.getId())throw new Error("Unable to select variant with a null ID");await Q0.selectVariant(this.step,t.getId(),this.manager)}getDisplayType(){var t;return(t=this.step.option)==null?void 0:t.displayType}}class VE extends Xn{constructor(t,n){super(t,n)}selectVariant(t){const n=t.getResource();return rs.selectVariant(this.step,{fill:n.color,stroke:n.color,variant:n},this.manager.getRegionElements(this.step.stepName)||[],this.manager)}setColor(t){return rs.selectVariant(this.step,t,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return rs.availableColours(this.step)}setCustomColor(t){var n;if(((n=this.getCurrentVariant())==null?void 0:n.getColor())!=="#custom")throw new Error("Custom colors can only be set on a non-custom variant. Please add a custom variant to the step.");return rs.setCustomColor(t,this.step,this.manager)}getCustomColor(){var n,r;const t=(n=this.manager.getStepStorage(this.step.stepName))==null?void 0:n.colour;if(((r=this.getCurrentVariant())==null?void 0:r.getColor())!=="#custom")throw new Error("Custom colors can only be set on a non-custom variant. Please add a custom variant to the step.");if(!t)throw new Error("Color not available on step. Set a default on the workflow to fix this.");return t}}class zE extends Xn{constructor(t,n){super(t,n)}async selectVariant(t){Wn.selectVariant(this.step,t.getResource(),this.manager,n=>{if(n)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:"An issue has occured with test",messageType:Yo.Error,stepID:this.step.stepName}]);else{const r=this.manager.getInformationResults().filter(i=>i.stepID!==this.step.stepName);this.manager.setInformationResults(r)}},()=>{})}getAvailableFillColors(){return this.step.data.colorPickerEnabled?Wn.availableFillColors(this.step):[]}async setFillColor(t){const n=this.manager.getRegionElements(this.step.stepName);await Wn.changeFillColor(this.step,t,n,this.manager)}getFillColor(){var t;return((t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.color)||"#000000"}getAvailableFillImages(){return Wn.availableFillImages(this.step)}async setFillImage(t){const n=this.manager.getRegionElements(this.step.stepName);await Wn.changeFillImage(this.step,t,n,this.manager)}getFillImage(){var t;return(t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.fillImage}setFullTextCustomization(t){var s;const n=((s=this.manager.getStepStorage(this.step.stepName))==null?void 0:s.inputText)||"",r=this.step.data.replaceableText!==void 0?this.step.data.replaceableText.replace("{{}}",n):n,i=t?r:this.step.data.defaultText;return this.manager.updateStorage(this.step.stepName,{customiseAllText:t,text:i,defaultCleared:!1}),this.setText(i)}setText(t){var f,d;const n={input:t},r=Wn.findLayoutElements(this.manager,this.step),i=Wn.filterUnsupportedCharacters(t,(f=r[0])==null?void 0:f.fontData);!!this.step.data&&!!this.step.data.maxLength&&i.length>this.step.data.maxLength||(n.input=i);const s=r.length<=0,o=s?{inputText:i,text:i}:{inputText:i};if(this.manager.updateStorage(this.step.stepName,o),this.manager.updateMetadata(this.step.stepName,{text:i}),s)return n;const{command:c,errors:l,helperText:u}=Wn.updateInputText(i,r,this.step,this.manager);c&&this.manager.getCommandDispatcher()(c);const A=this.manager.getInformationResults(),h=(d=l[0])==null?void 0:d.localizationKey;if(h)this.manager.setInformationResults([...A,{message:`${h} - ${this.step.stepTitle}`,messageType:Yo.Error,stepID:this.step.stepName}]);else{const p=A.filter(m=>m.stepID!==this.step.stepName);this.manager.setInformationResults(p)}return n.helperText=h||u,n.errorText=h,n}getText(){var n;const t=this.step.data.defaultText;return((n=this.manager.getStepStorage(this.step.stepName))==null?void 0:n.text)||t||""}isReplaceable(){return this.step.data.userCanReplaceText}clearDefaultTextIfNecessary(){const t=this.manager.getStepStorage(this.step.stepName);if(!(t!=null&&t.defaultCleared)&&this.step.data.deleteDefaultOnFocus){const n=this.setText("");return this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""}),n}}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(t===void 0)return;const n=this.getText();return t-n.length}}class JE extends Xn{constructor(t,n){super(t,n)}async selectVariant(){}getContent(){return this.step.data.content}}class Ho{static get(t,n){switch(n.type){case j.Information:return new JE(t,n);case j.Question:return new GE(t,n);case j.Text:return new zE(t,n);case j.Illustration:return new UE(t,n);case j.Picture:return new HE(t,n);case j.Shape:return new VE(t,n);case j.Material:return new LE(t,n);case j.Model:return new YE(t,n);case j.Frame:return new lB(t,n);case j.Bulk:return new OE(t,n);default:throw new ge(`Step type ${n.type} not yet supported in Core SDK`)}}}const jE=lt`
2054
2054
  fragment CreateDesignTransaction on Transaction {
2055
2055
  id
2056
- designName
2057
2056
  bulk
2058
- priceModifierTotal
2059
- variationsCount
2060
- externalDesignProductId
2061
- externalDesignProductVariantId
2057
+ bulkEmailAddress
2058
+ designName
2062
2059
  externalCartProductId
2063
2060
  externalCartProductVariantId
2061
+ externalDesignProductId
2062
+ externalDesignProductVariantId
2063
+ lastSyncedAt
2064
+ previewImageLink
2065
+ priceModifierTotal
2066
+ variationsCount
2064
2067
  workflowViewerLink
2065
2068
  workflowViewerReadOnlyLink
2066
- lastSyncedAt
2067
- bulkEmailAddress
2068
2069
  }
2069
2070
  `,OO=lt`
2070
2071
  ${jE}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "16.0.0-beta.4",
3
+ "version": "16.0.0-beta.5",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.umd.cjs",