@spiffcommerce/core 11.0.2 → 11.1.0

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/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import{CommandContext as A,AssetType as t,BringForwardCommand as e,BringToFrontCommand as n,BringToBackCommand as i,CanvasCommand as a,CreateElementCommand as o,CreateLayoutCommand as r,DeleteElementCommand as s,FontAlignmentCommand as c,FontColorCommand as g,FontSizeCommand as B,FontSourceCommand as l,GroupCommand as w,LayoutElementFactory as d,LayoutElementType as E,MoveCommand as h,ResizeCommand as Q,RotateCommand as C,SendBackwardsCommand as u,StepAspectType as D,StepType as m,TextChangeCommand as p,UnitOfMeasurement as I,dataUrlFromExternalUrl as f,findElement as y,frameDataCache as M,generate as F,getAxisAlignedBoundingBox as Y,generateSVGWithUnknownColors as x,getAttributesFromArrayBuffer as S,rehydrateSerializedLayout as v,getFrameData as N,getSvgElement as R,loadFontFromDataUrl as H,loadFontFromExternalUrl as U,determineCorrectFontSizeAndLines as P,patternImageDataCache as G,registerJSDOM as k,isCloseToValue as b,mmPerPixel as J,cmPerPixel as L,getElementVertices as O,rotateAroundPoint as T,ScaleAxis as z,findAngle as j,currentDirection as K,sortElementsByLayersWithIndex as V,LayoutRenderingPurpose as W,TextAlgorithm as X,toBase64 as q,getPatternImageData as Z,getVariant as $,generateFrameSVG as _,calculateOffsets as AA,UpdateFramePattern as tA,getDefaultVariant as eA,fetchAsString as nA,domParser as iA,sanitizeSvgTree as aA,traverse as oA,xmlSerializer as rA,fetchAsArrayBuffer as sA,arrayBufferToDataUrl as cA,loadFontFaceSet as gA,applyTextTransformations as BA,createElementNS as lA,createElement as wA,svgObjectURL as dA,UpdateWorkflowStateCommand as EA,generateDefaultRectangleFrameSvg as hA,GetSVGDimensions as QA,modifySVGWithElementProperties as CA,IllustrationColorCommand as uA,IllustrationCacheCommand as DA,getFontMetrics as mA,FontImageFillCommand as pA}from"@spiffcommerce/papyrus";import{gql as IA,createHttpLink as fA,InMemoryCache as yA,ApolloClient as MA,from as FA}from"@apollo/client";import{setContext as YA}from"@apollo/client/link/context";import{onError as xA}from"@apollo/client/link/error";import{fetch as SA}from"cross-fetch";import{createContext as vA,useState as NA,useCallback as RA,useContext as HA,useEffect as UA,useReducer as PA,useMemo as GA,useRef as kA}from"react";import{jsx as bA,jsxs as JA,Fragment as LA}from"react/jsx-runtime";import OA from"lodash.isequal";import TA from"lodash.clonedeep";import{Pith as zA}from"pith";import jA from"react-dom/server";import{toString as KA}from"qrcode";import VA from"svg-path-bbox";import WA from"lodash.debounce";import{split as XA}from"unicode-default-word-boundary";function qA(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class ZA extends Error{constructor(A){super(A),this.name=this.constructor.name}}class $A extends ZA{constructor(A){super(`ConfigurationError - ${A}`)}}class _A extends $A{constructor(A){super(`Option not Configured: ${A.stepTitle}`),qA(this,"optionId",void 0),this.optionId=A?.optionId||"N/A"}}class At extends $A{constructor(A){super(`Panel not Found: ${A.panelId}`),qA(this,"panelId",void 0),this.panelId=A?.panelId||"N/A"}}class tt extends $A{constructor(A){super(`Asset not found for variant: ${A.name}`),qA(this,"variant",void 0),this.variant=A}}class et extends $A{constructor(A){super(`Resource not found for asset: ${A.name}`),qA(this,"asset",void 0),this.asset=A}}class nt extends $A{constructor(A,t){super(`Workflow Misconfiguration: ${A.stepName} - ${t}`),qA(this,"step",void 0),this.step=A}}class it extends ZA{constructor(A){super(`ImplementationError - ${A}`)}}class at extends it{constructor(A){super(`Unhandled Behavior Encountered: ${A}`)}}class ot extends it{constructor(A){super(`Parsing Error: ${A}`)}}class rt extends it{constructor(A){super(`Client Error: ${A}`)}}class st extends it{constructor(A){super(`Resource Generation Failed: ${A}`)}}function ct(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class gt{get(A){return localStorage.getItem(A)||void 0}set(A,t){localStorage.setItem(A,t)}remove(A){localStorage.removeItem(A)}getMap(A){const t=this.get(A);if(t)return new Map(JSON.parse(t))}setMap(A,t){const e=JSON.stringify([...t.entries()]);this.set(A,e)}}class Bt{constructor(){ct(this,"storage",new Map)}get(A){return this.storage.get(A)||void 0}set(A,t){this.storage.set(A,t)}remove(A){this.storage.delete(A)}getMap(A){const t=this.get(A);if(t)return new Map(JSON.parse(t))}setMap(A,t){const e=JSON.stringify([...t.entries()]);this.set(A,e)}}const lt=(()=>{try{return localStorage?new gt:new Bt}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new Bt}})();function wt(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}const dt=new class{constructor(){wt(this,"defaultServerUrl","https://api.spiff.com.au"),wt(this,"defaultServicesApiUrl","https://services.spiff.com.au"),wt(this,"defaultHubUrl","https://hub.spiff.com.au"),wt(this,"serverUrl",void 0),wt(this,"servicesApiUrl",void 0),wt(this,"hubUrl",void 0),wt(this,"serverUrlCallbacks",void 0),this.serverUrl=this.defaultServerUrl,this.servicesApiUrl=this.defaultServicesApiUrl,this.hubUrl=this.defaultHubUrl,this.serverUrlCallbacks=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(A){this.serverUrl=A,this.serverUrlCallbacks.forEach((A=>A()))}setServicesApiUrl(A){this.servicesApiUrl=A}setHubUrl(A){this.hubUrl=A}addServerUrlCallback(A){this.serverUrlCallbacks.push(A)}};function Et(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}let ht;const Qt=A=>{ht=A};let Ct;const ut=A=>{Ct=A};let Dt;const mt=new class{constructor(){Et(this,"shadowGraphqlClient",void 0),console.log("Constructing shadow graphql client"),this.shadowGraphqlClient=this.constructShadowGraphqlClient(),dt.addServerUrlCallback((()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()}))}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){const A=fA({uri:`${dt.getServerUrl()}/graphql`,fetch:SA}),t=YA((async(A,{headers:t})=>{const e=t||{},n=await(async()=>{const A={transactionOwnerId:ht,customerToken:Ct,applicationKey:Dt};return"undefined"!=typeof window&&window.location.href.includes("/workflows/product/")?{...await new Promise((A=>{const t=dt.getHubUrl();if(window.location.href.includes("localhost")||window.location.href.includes("ngrok"))return void A({});const e=n=>{n.origin===t&&(window.removeEventListener("message",e),A(n.data))};window.parent!==window&&(window.addEventListener("message",e,!1),window.parent.postMessage("ready",t))})),...A}:A})();return n.bearer&&(e.Authorization=`Bearer ${n.bearer}`),n.partnerId&&(e.partnerId=n.partnerId),n.activeIntegration&&(e.activeIntegration=n.activeIntegration),n.transactionOwnerId&&(e.transactionOwnerId=n.transactionOwnerId),n.customerToken&&(e.customerToken=n.customerToken),n.applicationKey&&(e["X-Application-Key"]=n.applicationKey),{headers:e}})),e=xA((({operation:A,graphQLErrors:t,networkError:e})=>{(t||[]).forEach((({message:t,locations:e,path:n})=>{console.log("[GraphQL Operation Error]"),console.log("Name:"+A.operationName),console.log("Query:"+JSON.stringify(A.query)),console.log(`Message: ${t}, Location: ${JSON.stringify(e,null,2)}, Path: ${n}`),console.log("Variables:"+JSON.stringify(A.variables))})),e&&console.log("GraphQL Network error")}));const n=new yA({addTypename:!1,typePolicies:{Transaction:{fields:{bulkEmailAddress:{read:(A=null)=>A,merge:(A,t)=>t||A||null},transactionOwnerId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},customLogoLink:{read:(A=null)=>A,merge:(A,t)=>t||A||null},workflowFooterLogoLink:{read:(A=null)=>A,merge:(A,t)=>t||A||null},workflowState:{read:(A=null)=>A,merge:(A,t)=>t||A||null},bulkSourceUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalDesignProductId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalDesignProductVariantId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalCartProductId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalCartProductVariantId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},lastSyncedAt:{read:(A=null)=>A,merge:(A,t)=>t||A||null},lineItem:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}},WorkflowProduct:{fields:{isPresent:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}},Product:{fields:{imageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},overlayImageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},preloadImageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},weight:{read:(A=null)=>A,merge:(A,t)=>t||A||null},conversionConfiguration:{read:(A=null)=>A,merge:(A,t)=>t||A||null},bulkConfiguration:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}}}});return new MA({link:FA([e,t,A]),cache:n,name:"Core"})}};function pt(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}const It=IA`
1
+ import{CommandContext as A,AssetType as t,BringForwardCommand as e,BringToFrontCommand as n,BringToBackCommand as i,CanvasCommand as a,CreateElementCommand as o,CreateLayoutCommand as r,DeleteElementCommand as s,FontAlignmentCommand as c,FontColorCommand as g,FontSizeCommand as B,FontSourceCommand as l,GroupCommand as w,LayoutElementFactory as d,LayoutElementType as E,MoveCommand as h,ResizeCommand as Q,RotateCommand as C,SendBackwardsCommand as u,StepAspectType as D,StepType as m,TextChangeCommand as p,UnitOfMeasurement as I,dataUrlFromExternalUrl as f,findElement as y,frameDataCache as M,generate as F,getAxisAlignedBoundingBox as Y,generateSVGWithUnknownColors as x,getAttributesFromArrayBuffer as S,rehydrateSerializedLayout as v,getFrameData as N,getSvgElement as R,loadFontFromDataUrl as H,loadFontFromExternalUrl as U,determineCorrectFontSizeAndLines as P,patternImageDataCache as G,registerJSDOM as k,isCloseToValue as b,mmPerPixel as J,cmPerPixel as L,getElementVertices as O,rotateAroundPoint as T,ScaleAxis as z,findAngle as j,currentDirection as K,sortElementsByLayersWithIndex as V,LayoutRenderingPurpose as W,TextAlgorithm as X,toBase64 as q,getPatternImageData as Z,getVariant as $,generateFrameSVG as _,calculateOffsets as AA,UpdateFramePattern as tA,getDefaultVariant as eA,fetchAsString as nA,domParser as iA,sanitizeSvgTree as aA,traverse as oA,xmlSerializer as rA,fetchAsArrayBuffer as sA,arrayBufferToDataUrl as cA,loadFontFaceSet as gA,applyTextTransformations as BA,createElementNS as lA,createElement as wA,svgObjectURL as dA,UpdateWorkflowStateCommand as EA,generateDefaultRectangleFrameSvg as hA,GetSVGDimensions as QA,modifySVGWithElementProperties as CA,IllustrationColorCommand as uA,IllustrationCacheCommand as DA,getFontMetrics as mA,FontImageFillCommand as pA}from"@spiffcommerce/papyrus";import{gql as IA,createHttpLink as fA,InMemoryCache as yA,ApolloClient as MA,from as FA}from"@apollo/client";import{setContext as YA}from"@apollo/client/link/context";import{onError as xA}from"@apollo/client/link/error";import{fetch as SA}from"cross-fetch";import{createContext as vA,useState as NA,useCallback as RA,useContext as HA,useEffect as UA,useReducer as PA,useMemo as GA,useRef as kA}from"react";import{jsx as bA,jsxs as JA,Fragment as LA}from"react/jsx-runtime";import OA from"lodash.isequal";import TA from"lodash.clonedeep";import{Pith as zA}from"pith";import jA from"react-dom/server";import{toString as KA}from"qrcode";import VA from"svg-path-bbox";import WA from"lodash.debounce";import{split as XA}from"unicode-default-word-boundary";function qA(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class ZA extends Error{constructor(A){super(A),this.name=this.constructor.name}}class $A extends ZA{constructor(A){super(`ConfigurationError - ${A}`)}}class _A extends $A{constructor(A){super(`Option not Configured: ${A.stepTitle}`),qA(this,"optionId",void 0),this.optionId=A?.optionId||"N/A"}}class At extends $A{constructor(A){super(`Panel not Found: ${A.panelId}`),qA(this,"panelId",void 0),this.panelId=A?.panelId||"N/A"}}class tt extends $A{constructor(A){super(`Asset not found for variant: ${A.name}`),qA(this,"variant",void 0),this.variant=A}}class et extends $A{constructor(A){super(`Resource not found for asset: ${A.name}`),qA(this,"asset",void 0),this.asset=A}}class nt extends $A{constructor(A,t){super(`Workflow Misconfiguration: ${A.stepName} - ${t}`),qA(this,"step",void 0),this.step=A}}class it extends ZA{constructor(A){super(`ImplementationError - ${A}`)}}class at extends it{constructor(A){super(`Unhandled Behavior Encountered: ${A}`)}}class ot extends it{constructor(A){super(`Parsing Error: ${A}`)}}class rt extends it{constructor(A){super(`Client Error: ${A}`)}}class st extends it{constructor(A){super(`Resource Generation Failed: ${A}`)}}function ct(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class gt{get(A){return localStorage.getItem(A)||void 0}set(A,t){localStorage.setItem(A,t)}remove(A){localStorage.removeItem(A)}getMap(A){const t=this.get(A);if(t)return new Map(JSON.parse(t))}setMap(A,t){const e=JSON.stringify([...t.entries()]);this.set(A,e)}}class Bt{constructor(){ct(this,"storage",new Map)}get(A){return this.storage.get(A)||void 0}set(A,t){this.storage.set(A,t)}remove(A){this.storage.delete(A)}getMap(A){const t=this.get(A);if(t)return new Map(JSON.parse(t))}setMap(A,t){const e=JSON.stringify([...t.entries()]);this.set(A,e)}}const lt=(()=>{try{return localStorage?new gt:new Bt}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new Bt}})();function wt(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}const dt=new class{constructor(){wt(this,"defaultServerUrl","https://api.spiff.com.au"),wt(this,"defaultServicesApiUrl","https://services.spiff.com.au"),wt(this,"defaultHubUrl","https://hub.spiff.com.au"),wt(this,"serverUrl",void 0),wt(this,"servicesApiUrl",void 0),wt(this,"hubUrl",void 0),wt(this,"serverUrlCallbacks",void 0),this.serverUrl=this.defaultServerUrl,this.servicesApiUrl=this.defaultServicesApiUrl,this.hubUrl=this.defaultHubUrl,this.serverUrlCallbacks=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(A){this.serverUrl=A,this.serverUrlCallbacks.forEach((A=>A()))}setServicesApiUrl(A){this.servicesApiUrl=A}setHubUrl(A){this.hubUrl=A}addServerUrlCallback(A){this.serverUrlCallbacks.push(A)}};function Et(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}let ht;const Qt=A=>{ht=A};let Ct;const ut=A=>{Ct=A};let Dt;const mt=new class{constructor(){Et(this,"shadowGraphqlClient",void 0),console.log("Constructing shadow graphql client"),this.shadowGraphqlClient=this.constructShadowGraphqlClient(),dt.addServerUrlCallback((()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()}))}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){const A=fA({uri:`${dt.getServerUrl()}/graphql`,fetch:SA}),t=YA((async(A,{headers:t})=>{const e=t||{},n=await(async()=>{const A={transactionOwnerId:ht,customerToken:Ct,applicationKey:Dt};return"undefined"!=typeof window&&(window.location.href.includes("/workflows/product/")||window.location.href.includes("hub=true"))?{...await new Promise((A=>{const t=dt.getHubUrl(),e=n=>{n.origin===t&&(window.removeEventListener("message",e),A(n.data))};window.parent!==window&&(window.addEventListener("message",e,!1),window.parent.postMessage("ready",t))})),...A}:A})();return n.bearer&&(e.Authorization=`Bearer ${n.bearer}`),n.partnerId&&(e.partnerId=n.partnerId),n.activeIntegration&&(e.activeIntegration=n.activeIntegration),n.transactionOwnerId&&(e.transactionOwnerId=n.transactionOwnerId),n.customerToken&&(e.customerToken=n.customerToken),n.applicationKey&&(e["X-Application-Key"]=n.applicationKey),{headers:e}})),e=xA((({operation:A,graphQLErrors:t,networkError:e})=>{(t||[]).forEach((({message:t,locations:e,path:n})=>{console.log("[GraphQL Operation Error]"),console.log("Name:"+A.operationName),console.log("Query:"+JSON.stringify(A.query)),console.log(`Message: ${t}, Location: ${JSON.stringify(e,null,2)}, Path: ${n}`),console.log("Variables:"+JSON.stringify(A.variables))})),e&&console.log("GraphQL Network error")}));const n=new yA({addTypename:!1,typePolicies:{Transaction:{fields:{bulkEmailAddress:{read:(A=null)=>A,merge:(A,t)=>t||A||null},transactionOwnerId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},customLogoLink:{read:(A=null)=>A,merge:(A,t)=>t||A||null},workflowFooterLogoLink:{read:(A=null)=>A,merge:(A,t)=>t||A||null},workflowState:{read:(A=null)=>A,merge:(A,t)=>t||A||null},bulkSourceUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalDesignProductId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalDesignProductVariantId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalCartProductId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},externalCartProductVariantId:{read:(A=null)=>A,merge:(A,t)=>t||A||null},lastSyncedAt:{read:(A=null)=>A,merge:(A,t)=>t||A||null},lineItem:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}},WorkflowProduct:{fields:{isPresent:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}},Product:{fields:{imageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},overlayImageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},preloadImageUrl:{read:(A=null)=>A,merge:(A,t)=>t||A||null},weight:{read:(A=null)=>A,merge:(A,t)=>t||A||null},conversionConfiguration:{read:(A=null)=>A,merge:(A,t)=>t||A||null},bulkConfiguration:{read:(A=null)=>A,merge:(A,t)=>t||A||null}}}}});return new MA({link:FA([e,t,A]),cache:n,name:"Core"})}};function pt(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}const It=IA`
2
2
  fragment AssetFields on Asset {
3
3
  name
4
4
  key
@@ -1099,5 +1099,5 @@ import{CommandContext as A,AssetType as t,BringForwardCommand as e,BringToFrontC
1099
1099
  }
1100
1100
  }
1101
1101
  }
1102
- `,ta=async A=>{const t=(await mt.getShadowGraphqlClient().query({query:Vi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:A}})).data.workflow;return t.steps.forEach((A=>{delete A.data.__typename})),t},ea=(A,t)=>{const e=A.workflowState,n=e?JSON.parse(e):void 0;return n?Object.values(n.layouts).map((A=>A.layout)):t.panels.sort(((A,t)=>A.index-t.index)).map((A=>({id:F(),panelId:A.name,name:A.name,index:A.index,createdAt:new Date,updatedAt:new Date,transparentBackground:A.transparentBackground,height:A.height,width:A.width,previewRegion:A.previewRegion,useEditableArea:A.useEditableArea,editableArea:A.editableArea})))};class na{constructor(A){var t;Ki(this,"options",void 0),Ki(this,"initialized",void 0),Ki(this,"experienceOptions",void 0),Ki(this,"currencyCode",void 0),Ki(this,"customer",void 0),Ki(this,"updateTransactionState",(async A=>{try{return mt.getShadowGraphqlClient().mutate({...A,mutation:Nn})}catch(A){throw console.error(A),new rt("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=A,this.options.applicationKey&&(t=this.options.applicationKey,Dt=t)}getAssetManager(){return vt}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}async authenticateTransactionFromLocalStorage(A){const t=mt.getShadowGraphqlClient(),e=await t.query({query:Wi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:A}});if(!e.data.transactions||0===e.data.transactions.length)throw new Error(`Transaction not found: ${A}`);const n=e.data.transactions[0],i=n.product?.partner?.id;if(!i)throw new Error(`Unable to read transaction: ${A}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const a=lt.getMap("transactionOwnerIds");if(a?.has(A)){const t=a.get(A);return Qt(t),Promise.resolve({success:!0,stakeholderType:ee.Owner})}const o=lt.getMap("transactionCustomerIds");if(o?.has(A)){const t=o.get(A);if(t){if(await this.authenticateCustomerId(t)){const t=this.customer?.stakeholders?.find((t=>t.transaction?.id===A));if(t)return Promise.resolve({success:!0,stakeholderType:t.type})}}}const r=(await t.query({query:Xi,errorPolicy:"all",variables:{id:n.workflowId}})).data.workflow;if(!r)throw new Error(`Unable to read workflow: ${n.workflowId}`);return Promise.resolve({success:!1,theme:r.overrideTheme,customLogoLink:n.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(A){const t=lt.getMap("transactionCustomerIds");t?.has(A)&&(t.delete(A),lt.setMap("transactionCustomerIds",t))}async getOrCreateCustomer(A){this.customer=void 0;const t=mt.getShadowGraphqlClient(),e=(await t.query({query:qi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:A}})).data.customer;if(!e.id){const e=(await t.mutate({mutation:Zi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:A}}})).data?.customerCreate;if(!e)throw new Error("Unable to create customer.");return this.customer=e,{customer:e,isAuthenticated:!1}}const n=await this.authenticateCustomerId(e.id);return{customer:this.customer||e,isAuthenticated:n}}async authenticateCustomerId(A){const t=mt.getShadowGraphqlClient(),e=lt.getMap("customerTokens");if(!e?.has(A))return!1;const n=e.get(A);if(!n)return!1;const i=(await t.mutate({mutation:$i,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data?.customerAuthenticate;return!!i&&(ut(n),this.customer=i,!0)}async generateVerificationCode(A){await mt.getShadowGraphqlClient().mutate({mutation:_i,variables:{emailAddress:A}})}async verifyCode(A,t){const e=await mt.getShadowGraphqlClient().mutate({mutation:Aa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:A,verificationCode:t}});if(e.data?.customerVerifyCode.loginToken){if(!e.data.customerVerifyCode.partner?.id)throw new Error(`Unable to find customer: ${A}`);const t=lt.getMap("customerTokens")||new Map;return t.set(e.data.customerVerifyCode.id,e.data.customerVerifyCode.loginToken),lt.setMap("customerTokens",t),ut(e.data.customerVerifyCode.loginToken),this.customer={...e.data.customerVerifyCode,loginToken:void 0},!0}return!1}async getWorkflowExperience(A,t,e,n){if(!n)return await this.getWorkflowExperienceDeprecated(A,t,e);const i=async A=>{for(const t in A.layouts){const e=A.layouts[t].elements.filter((A=>A.type===E.Illustration));for(let A=0;A<e.length;++A){const t=e[A];t.src&&t.svg&&(t.cachedObjectURL=await dA(t.svg))}const n=A.layouts[t].elements.filter((A=>A.type===E.Textbox));for(let A=0;A<n.length;++A){const t=n[A];t.fontData?.assetUrl&&U(t.fontData.assetUrl)}}},{transaction:a,workflow:o,readOnly:r}=await(async()=>{const A=mt.getShadowGraphqlClient();if(await A.resetStore(),"transaction"===n.type){const{transactionId:t,readOnly:e}=n,i=await A.query({query:vn,variables:{id:t},errorPolicy:"all"});if(!i.data?.transactions||0===i.data.transactions.length)throw new rt("Existing transaction not found.");const a=i.data?.transactions[0];if(!a.workflowId)throw new rt("Existing transaction has no workflow ID.");const o=await ta(a.workflowId);if(!a.product)throw new rt("Failed to load transaction, product not available.");return{transaction:a,workflow:o,readOnly:e}}if("integration"===n.type||"external"===n.type){const t=async()=>{const t="integration"===n.type?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},e=await A.mutate({mutation:xn,variables:{...t,bulk:n.bulk,workflowId:n.workflowId,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!e.data||!e.data.transactionCreate)throw new rt("Failed to create transaction!");const i=e.data.transactionCreate;if(!i.product)throw new rt("Failed to create transaction, product not available.");return i},e=ta(n.workflowId),[i,a]=await Promise.all([t(),e]);return{transaction:i,workflow:a}}throw new rt("No workflow ID provided.")})();if(this.currencyCode=a.product.partner?.currencyCode,this.experienceOptions={product:a.product,transaction:a,layouts:[],stateMutationFunc:r?async()=>{throw new at("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:r,workflow:o},"transaction"===n.type&&a.workflowState){const A=JSON.parse(a.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await i(A),this.experienceOptions.reloadedState=A}else if(!r&&n.workflowState){const A=JSON.parse(n.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await i(A),this.experienceOptions.reloadedState=A}else this.experienceOptions.layouts=ea(this.experienceOptions.transaction,this.experienceOptions.workflow);if(this.experienceOptions.previewService=e&&e(o),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService),"transaction"!==n.type){const A=lt.getMap("transactionOwnerIds")||new Map;A.set(a.id,a.transactionOwnerId),Qt(a.transactionOwnerId||""),lt.setMap("transactionOwnerIds",A)}this.initialized=!0;const s=new ji(this,this.experienceOptions);return await s.getWorkflowManager().getInitializationPromise(),"transaction"!==n.type&&this.customer&&await s.attachCustomerDetails({email:this.customer.emailAddress}),s}async initFromIntegrationProduct(A){if(""===A)throw new rt("No integration product ID provided.");const t=mt.getShadowGraphqlClient();await t.resetStore();const e=await t.mutate({mutation:xn,variables:{integrationProductId:A,bulk:this.options.bulk||!1,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!e.data||!e.data.transactionCreate)throw new rt("Failed to create transaction!");const n=e.data.transactionCreate;if(!n.product)throw new rt("Failed to create transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode;const i=lt.getMap("transactionOwnerIds")||new Map;i.set(n.id,n.transactionOwnerId),Qt(n.transactionOwnerId||""),lt.setMap("transactionOwnerIds",i),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(A,t=!1){if(""===A)throw new rt("No transaction ID provided.");const e=mt.getShadowGraphqlClient();await e.resetStore();if(t)return await(async()=>{const n=(await e.query({query:vn,variables:{id:A},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new rt("Failed to read transaction.");if(!n.product)throw new rt("Failed to load transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode,this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:async()=>{throw new at("State mutation is forbidden in read only mode!")},readOnly:t},this.initialized=!0})();const n=lt.getMap("transactionOwnerIds")||new Map,i=n.get(A);if(i){Qt(i);const n=(await e.query({query:vn,variables:{id:A},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new rt("Failed to read transaction.");if(!n.product)throw new rt("Failed to load transaction, product not available.");return this.currencyCode=n.product.partner?.currencyCode,this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:t},void(this.initialized=!0)}try{const i=(await e.mutate({mutation:Sn,variables:{id:A},errorPolicy:"all"})).data?.transactionClaim;if(!i)throw new rt("Failed to read transaction.");if(!i.product)throw new rt("Failed to load transaction, product not available.");this.currencyCode=i.product.partner?.currencyCode,i.transactionOwnerId&&(n.set(i.id,i.transactionOwnerId),Qt(i.transactionOwnerId),lt.setMap("transactionOwnerIds",n)),this.experienceOptions={product:i.product,transaction:i,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:t},this.initialized=!0}catch{throw new rt("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(A,t,e){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot launch experience: Not initialized.");const n=async A=>{for(const t in A.layouts){const e=A.layouts[t].elements.filter((A=>A.type===E.Illustration));for(let A=0;A<e.length;++A){const t=e[A];t.src&&t.svg&&(t.cachedObjectURL=await dA(t.svg))}const n=A.layouts[t].elements.filter((A=>A.type===E.Textbox));for(let A=0;A<n.length;++A){const t=n[A];t.fontData?.assetUrl&&U(t.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const A=await ta(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=A,this.experienceOptions.transaction.workflowState){const A=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await n(A),this.experienceOptions.reloadedState=A}this.experienceOptions.previewService=e&&e(A),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService);const t=new ji(this,this.experienceOptions);return await t.getWorkflowManager().getInitializationPromise(),t}if(A){const i=mt.getShadowGraphqlClient().mutate({mutation:Rn,variables:{workflowId:A,id:this.experienceOptions.transaction.id}}),a=ta(A);if(await Promise.all([i,a]),this.experienceOptions.workflow=await a,t){const A=JSON.parse(t);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await n(A),this.experienceOptions.reloadedState=A}else this.experienceOptions.layouts=ea(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=e&&e(await a),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService);const o=new ji(this,this.experienceOptions);return await o.getWorkflowManager().getInitializationPromise(),o}throw new rt("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function ia(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class aa{constructor(){ia(this,"getProduct",void 0),ia(this,"getCommandContext",void 0),ia(this,"getAllLayoutData",void 0),ia(this,"getMetadata",void 0),ia(this,"getWorkflowMetadata",void 0),ia(this,"getStepStorage",void 0),ia(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(A){}addVariationRecord(A){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(A){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(A){}addPoller(A){}addConfirmCallback(A){}addCurrentVariationCallback(A){}addEditedCallback(A){}addElementsCallback(A){}addInformationResultCallback(A){}addInitCallback(A){}addMakingAdjustmentsCallback(A){}addMandatoryCallback(A){}addMetadataCallback(A){}addSelectionCallback(A){}addStepSpecificStorageCallback(A,t){}addStorageCallback(A){}addVariationRecordsCallback(A){}getCommandDispatcher(){return A=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getProfanities(){return[]}getRegionElements(A){return[]}getSerializedStep(A,t){}getStepSpecificServices(A){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(A){}markUpdateCompleted(A){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(A){}setCurrentVariationRecord(A){}setEditedStatus(A,t){}setInformationResults(A){}setMandatoryFulfilled(A,t){}async setSelectionsAndElements(A,t,e){}setVariationRecords(A){}toggleDesignConfirmed(){}updateMetadata(A,t){}async updateStorage(A,t){}}function oa(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}let ra;var sa;(sa=ra||(ra={})).SelectFrame="SelectFrame",sa.SelectImage="SelectImage",sa.Position="Position";class ca extends pi{constructor(A,t){super(A,t),oa(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(A){const t=this.manager.getRegionElements(this.step.stepName);return ti.selectVariant(this.step,A.getResource(),t,this.manager,(A=>this.setUpdateState(A)))}onFrameDataChanged(A){this.frameService&&this.frameService.onFrameDataChanged((t=>{t&&A(t)}))}selectImage(A){return ti.selectImage(this.step,A,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(A,t,e,n){return n&&n.length>1&&void 0===A?ra.SelectFrame:t||e||this.getImageData()?ra.Position:ra.SelectImage}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}hasVaryingUpload(){return this.step.data.varyUpload}hasVaryingSelection(){return this.step.data.varySelection}}const ga=A=>{const t=kA(null);let e=kA(void 0);const[n,i]=NA(void 0),{addEvent:a,removeEvent:o,updateEvent:r,eventCache:s}=Gt(),[c,g]=NA(!1),[B,l]=NA(!1),{state:w,uiDispatcher:d}=Vt(),E=RA((A=>{const t=A;d(new Kt({zoom:Math.max(.1,Math.min(t,w.maxZoom))}))}),[d,w.maxZoom]),h=RA((A=>{o(A),1===s.length&&(e.current=void 0),2===s.length&&i(void 0);"touch"===A.pointerType&&s.length>1&&s.length-1==1&&(l(!1),g(!1))}),[t,s]),Q=RA((A=>{a(A);"touch"===A.pointerType&&1===s.length&&(d(new Kt({selectedElement:void 0})),l(!0),g(!0))}),[t,B,s]),C=RA((A=>{r(A),A.isPrimary&&(e.current={x:A.screenX,y:A.screenY});const t=1===s.length&&"touch"!==s[0].pointerType,a=2===s.length&&"touch"===s[0].pointerType;if(c&&a){const[A,t]=s,e=Math.abs(A.clientX-t.clientX),a=n;a&&E(w.zoom-.0055*(a-e)),i(e)}if(B&&(t||a)&&A.isPrimary){const t=(e?.current?.x||A.screenX)-A.screenX,n=(e?.current?.y||A.screenY)-A.screenY;d(new Kt({selectedElement:void 0,xTranslation:w.xTranslation-t/w.zoom,yTranslation:w.yTranslation-n/w.zoom}))}}),[w.xTranslation,w.yTranslation,w.zoom,B,c,E,s,e,n]),u=RA((A=>{c&&E(w.zoom-.035*Math.sign(A.deltaY))}),[w,c]);UA((()=>{if(!t.current||0===s.length)return;const A=s[0].pointerId,e=t.current.hasPointerCapture(A);B&&!e&&t.current.setPointerCapture(A),!B&&e&&t.current.releasePointerCapture(A)}),[t,B,s]),Pe([" "],(()=>{l(!0),d(new Kt({selectedElement:void 0}))}),(()=>l(!1))),Pe(["Control"],(()=>g(!0)),(()=>g(!1)));const D=GA((()=>({cursor:B&&0===s.length?"grab":B&&1===s.length?"grabbing":c?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[B,c,s]);return bA("div",{ref:t,className:"transform-wrapper",onWheel:u,onPointerDown:Q,onPointerUp:h,onPointerCancel:h,onPointerLeave:h,onPointerMove:C,style:D,children:A.children})};export{na as SpiffCommerceClient,A as CommandContext,dt as spiffCoreConfiguration,Je as PromiseQueue,be as QueueablePromise,aa as MockWorkflowManager,Ei as InformationMessageType,pi as StepHandle,Ri as TextStepHandle,ca as FrameStepHandle,Mi as BulkStepHandle,Ni as ShapeStepHandle,Fi as IllustrationStepHandle,Yi as MaterialStepHandle,xi as ModelStepHandle,Si as PictureStepHandle,vi as QuestionStepHandle,qt as BulkPriceCalculationStrategy,Di as Variant,_A as OptionNotFoundError,At as LayoutNotFoundError,tt as AssetNotFoundError,et as ResourceNotFoundError,nt as MisconfigurationError,ot as ParseError,at as UnhandledBehaviorError,vt as assetService,Ti as designService,Ji as createDesign,Ut as optionService,lt as persistenceService,mt as graphQlManager,oe as toast,Vn as FrameService,jn as getBoundedOffsets,ti as frameStepService,ii as modelStepService,ni as materialStepService,si as shapeStepService,ri as questionStepService,_n as digitalContentStepService,ai as moduleStepService,oi as pictureStepService,wi as textStepService,ei as illustrationStepService,Wt as ProductCameraRig,ra as FrameStep,$t as ConversionLocation,Ae as ConversionDataType,ta as getWorkflow,t as AssetType,e as BringForwardCommand,n as BringToFrontCommand,i as BringToBackCommand,a as CanvasCommand,o as CreateElementCommand,r as CreateLayoutCommand,s as DeleteElementCommand,c as FontAlignmentCommand,g as FontColorCommand,B as FontSizeCommand,l as FontSourceCommand,w as GroupCommand,d as LayoutElementFactory,E as LayoutElementType,h as MoveCommand,Q as ResizeCommand,C as RotateCommand,u as SendBackwardsCommand,ee as StakeholderType,D as StepAspectType,m as StepType,p as TextChangeCommand,I as UnitOfMeasurement,f as dataUrlFromExternalUrl,y as findElement,M as frameDataCache,F as generate,Y as getAxisAlignedBoundingBox,x as generateSVGWithUnknownColors,S as getAttributesFromArrayBuffer,v as rehydrateSerializedLayout,N as getFrameData,R as getSvgElement,H as loadFontFromDataUrl,U as loadFontFromExternalUrl,P as determineCorrectFontSizeAndLines,G as patternImageDataCache,Cn as generateCommands,k as registerJSDOM,Re as minZoom,Yn as AdvancedEditor,ga as TransformWrapper,Fn as EditorCore,kt as useLayouts,Vt as useEditorState,Ue as useEditorInteraction,Pe as useShortcutCombination,Tt as commandReducer,Ot as getDefaultState,Pt as CommandContextContext,jt as AdvancedEditorStateProvider,zt as AdvancedEditorContext,Kt as UICommand,Jt as EditorSubMenu,re as ElementEventType,ce as KeyEvent,Gn as gatherVaryingStepAspects};
1102
+ `,ta=async A=>{const t=(await mt.getShadowGraphqlClient().query({query:Vi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:A}})).data.workflow;return t.steps.forEach((A=>{delete A.data.__typename})),t},ea=(A,t)=>{const e=A.workflowState,n=e?JSON.parse(e):void 0;return n?Object.values(n.layouts).map((A=>A.layout)):t.panels.sort(((A,t)=>A.index-t.index)).map((A=>({id:F(),panelId:A.name,name:A.name,index:A.index,createdAt:new Date,updatedAt:new Date,transparentBackground:A.transparentBackground,height:A.height,width:A.width,previewRegion:A.previewRegion,useEditableArea:A.useEditableArea,editableArea:A.editableArea})))};class na{constructor(A){var t;Ki(this,"options",void 0),Ki(this,"initialized",void 0),Ki(this,"experienceOptions",void 0),Ki(this,"currencyCode",void 0),Ki(this,"customer",void 0),Ki(this,"updateTransactionState",(async A=>{try{return mt.getShadowGraphqlClient().mutate({...A,mutation:Nn})}catch(A){throw console.error(A),new rt("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=A,this.options.applicationKey&&(t=this.options.applicationKey,Dt=t)}getAssetManager(){return vt}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}async authenticateTransactionFromLocalStorage(A){const t=mt.getShadowGraphqlClient(),e=await t.query({query:Wi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:A}});if(!e.data.transactions||0===e.data.transactions.length)throw new Error(`Transaction not found: ${A}`);const n=e.data.transactions[0],i=n.product?.partner?.id;if(!i)throw new Error(`Unable to read transaction: ${A}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const a=lt.getMap("transactionOwnerIds");if(a?.has(A)){const t=a.get(A);return Qt(t),Promise.resolve({success:!0,stakeholderType:ee.Owner})}const o=lt.getMap("transactionCustomerIds");if(o?.has(A)){const t=o.get(A);if(t){if(await this.authenticateCustomerId(t)){const t=this.customer?.stakeholders?.find((t=>t.transaction?.id===A));if(t)return Promise.resolve({success:!0,stakeholderType:t.type})}}}const r=(await t.query({query:Xi,errorPolicy:"all",variables:{id:n.workflowId}})).data.workflow;if(!r)throw new Error(`Unable to read workflow: ${n.workflowId}`);return Promise.resolve({success:!1,theme:r.overrideTheme,customLogoLink:n.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(A){const t=lt.getMap("transactionCustomerIds");t?.has(A)&&(t.delete(A),lt.setMap("transactionCustomerIds",t))}getStakeholderTypeForTransaction(A){const t=this.customer?.stakeholders?.find((t=>t.transaction?.id===A));if(t)return t.type}async getOrCreateCustomer(A){this.customer=void 0;const t=mt.getShadowGraphqlClient(),e=(await t.query({query:qi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:A}})).data.customer;if(!e.id){const e=(await t.mutate({mutation:Zi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:A}}})).data?.customerCreate;if(!e)throw new Error("Unable to create customer.");return this.customer=e,{customer:e,isAuthenticated:!1}}const n=await this.authenticateCustomerId(e.id);return{customer:this.customer||e,isAuthenticated:n}}async authenticateCustomerId(A){const t=mt.getShadowGraphqlClient(),e=lt.getMap("customerTokens");if(!e?.has(A))return!1;const n=e.get(A);if(!n)return!1;const i=(await t.mutate({mutation:$i,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data?.customerAuthenticate;return!!i&&(ut(n),this.customer=i,!0)}async generateVerificationCode(A){await mt.getShadowGraphqlClient().mutate({mutation:_i,variables:{emailAddress:A}})}async verifyCode(A,t){const e=await mt.getShadowGraphqlClient().mutate({mutation:Aa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:A,verificationCode:t}});if(e.data?.customerVerifyCode.loginToken){if(!e.data.customerVerifyCode.partner?.id)throw new Error(`Unable to find customer: ${A}`);const t=lt.getMap("customerTokens")||new Map;return t.set(e.data.customerVerifyCode.id,e.data.customerVerifyCode.loginToken),lt.setMap("customerTokens",t),ut(e.data.customerVerifyCode.loginToken),this.customer={...e.data.customerVerifyCode,loginToken:void 0},!0}return!1}async getWorkflowExperience(A,t,e,n){if(!n)return await this.getWorkflowExperienceDeprecated(A,t,e);const i=async A=>{for(const t in A.layouts){const e=A.layouts[t].elements.filter((A=>A.type===E.Illustration));for(let A=0;A<e.length;++A){const t=e[A];t.src&&t.svg&&(t.cachedObjectURL=await dA(t.svg))}const n=A.layouts[t].elements.filter((A=>A.type===E.Textbox));for(let A=0;A<n.length;++A){const t=n[A];t.fontData?.assetUrl&&U(t.fontData.assetUrl)}}},{transaction:a,workflow:o,readOnly:r}=await(async()=>{const A=mt.getShadowGraphqlClient();if(await A.resetStore(),"transaction"===n.type){const{transactionId:t,readOnly:e}=n,i=await A.query({query:vn,variables:{id:t},errorPolicy:"all"});if(!i.data?.transactions||0===i.data.transactions.length)throw new rt("Existing transaction not found.");const a=i.data?.transactions[0];if(!a.workflowId)throw new rt("Existing transaction has no workflow ID.");const o=await ta(a.workflowId);if(!a.product)throw new rt("Failed to load transaction, product not available.");return{transaction:a,workflow:o,readOnly:e}}if("integration"===n.type||"external"===n.type){const t=async()=>{const t="integration"===n.type?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},e=await A.mutate({mutation:xn,variables:{...t,bulk:n.bulk,workflowId:n.workflowId,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!e.data||!e.data.transactionCreate)throw new rt("Failed to create transaction!");const i=e.data.transactionCreate;if(!i.product)throw new rt("Failed to create transaction, product not available.");return i},e=ta(n.workflowId),[i,a]=await Promise.all([t(),e]);return{transaction:i,workflow:a}}throw new rt("No workflow ID provided.")})();if(this.currencyCode=a.product.partner?.currencyCode,this.experienceOptions={product:a.product,transaction:a,layouts:[],stateMutationFunc:r?async()=>{throw new at("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:r,workflow:o},"transaction"===n.type&&a.workflowState){const A=JSON.parse(a.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await i(A),this.experienceOptions.reloadedState=A}else if(!r&&n.workflowState){const A=JSON.parse(n.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await i(A),this.experienceOptions.reloadedState=A}else this.experienceOptions.layouts=ea(this.experienceOptions.transaction,this.experienceOptions.workflow);if(this.experienceOptions.previewService=e&&e(o),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService),"transaction"!==n.type){const A=lt.getMap("transactionOwnerIds")||new Map;A.set(a.id,a.transactionOwnerId),Qt(a.transactionOwnerId||""),lt.setMap("transactionOwnerIds",A)}this.initialized=!0;const s=new ji(this,this.experienceOptions);return await s.getWorkflowManager().getInitializationPromise(),"transaction"!==n.type&&this.customer&&await s.attachCustomerDetails({email:this.customer.emailAddress}),s}async initFromIntegrationProduct(A){if(""===A)throw new rt("No integration product ID provided.");const t=mt.getShadowGraphqlClient();await t.resetStore();const e=await t.mutate({mutation:xn,variables:{integrationProductId:A,bulk:this.options.bulk||!1,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!e.data||!e.data.transactionCreate)throw new rt("Failed to create transaction!");const n=e.data.transactionCreate;if(!n.product)throw new rt("Failed to create transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode;const i=lt.getMap("transactionOwnerIds")||new Map;i.set(n.id,n.transactionOwnerId),Qt(n.transactionOwnerId||""),lt.setMap("transactionOwnerIds",i),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(A,t=!1){if(""===A)throw new rt("No transaction ID provided.");const e=mt.getShadowGraphqlClient();await e.resetStore();if(t)return await(async()=>{const n=(await e.query({query:vn,variables:{id:A},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new rt("Failed to read transaction.");if(!n.product)throw new rt("Failed to load transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode,this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:async()=>{throw new at("State mutation is forbidden in read only mode!")},readOnly:t},this.initialized=!0})();const n=lt.getMap("transactionOwnerIds")||new Map,i=n.get(A);if(i){Qt(i);const n=(await e.query({query:vn,variables:{id:A},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new rt("Failed to read transaction.");if(!n.product)throw new rt("Failed to load transaction, product not available.");return this.currencyCode=n.product.partner?.currencyCode,this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:t},void(this.initialized=!0)}try{const i=(await e.mutate({mutation:Sn,variables:{id:A},errorPolicy:"all"})).data?.transactionClaim;if(!i)throw new rt("Failed to read transaction.");if(!i.product)throw new rt("Failed to load transaction, product not available.");this.currencyCode=i.product.partner?.currencyCode,i.transactionOwnerId&&(n.set(i.id,i.transactionOwnerId),Qt(i.transactionOwnerId),lt.setMap("transactionOwnerIds",n)),this.experienceOptions={product:i.product,transaction:i,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:t},this.initialized=!0}catch{throw new rt("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(A,t,e){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot launch experience: Not initialized.");const n=async A=>{for(const t in A.layouts){const e=A.layouts[t].elements.filter((A=>A.type===E.Illustration));for(let A=0;A<e.length;++A){const t=e[A];t.src&&t.svg&&(t.cachedObjectURL=await dA(t.svg))}const n=A.layouts[t].elements.filter((A=>A.type===E.Textbox));for(let A=0;A<n.length;++A){const t=n[A];t.fontData?.assetUrl&&U(t.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const A=await ta(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=A,this.experienceOptions.transaction.workflowState){const A=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await n(A),this.experienceOptions.reloadedState=A}this.experienceOptions.previewService=e&&e(A),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService);const t=new ji(this,this.experienceOptions);return await t.getWorkflowManager().getInitializationPromise(),t}if(A){const i=mt.getShadowGraphqlClient().mutate({mutation:Rn,variables:{workflowId:A,id:this.experienceOptions.transaction.id}}),a=ta(A);if(await Promise.all([i,a]),this.experienceOptions.workflow=await a,t){const A=JSON.parse(t);this.experienceOptions.layouts=Object.values(A.layouts).map((A=>A.layout)),await v(A),await n(A),this.experienceOptions.reloadedState=A}else this.experienceOptions.layouts=ea(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=e&&e(await a),this.experienceOptions.renderableContextService=new Dn(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&this.experienceOptions.previewService?.initialize(this.experienceOptions.product.modelUrl,this.experienceOptions.renderableContextService);const o=new ji(this,this.experienceOptions);return await o.getWorkflowManager().getInitializationPromise(),o}throw new rt("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new rt("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function ia(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}class aa{constructor(){ia(this,"getProduct",void 0),ia(this,"getCommandContext",void 0),ia(this,"getAllLayoutData",void 0),ia(this,"getMetadata",void 0),ia(this,"getWorkflowMetadata",void 0),ia(this,"getStepStorage",void 0),ia(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(A){}addVariationRecord(A){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(A){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(A){}addPoller(A){}addConfirmCallback(A){}addCurrentVariationCallback(A){}addEditedCallback(A){}addElementsCallback(A){}addInformationResultCallback(A){}addInitCallback(A){}addMakingAdjustmentsCallback(A){}addMandatoryCallback(A){}addMetadataCallback(A){}addSelectionCallback(A){}addStepSpecificStorageCallback(A,t){}addStorageCallback(A){}addVariationRecordsCallback(A){}getCommandDispatcher(){return A=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getProfanities(){return[]}getRegionElements(A){return[]}getSerializedStep(A,t){}getStepSpecificServices(A){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(A){}markUpdateCompleted(A){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(A){}setCurrentVariationRecord(A){}setEditedStatus(A,t){}setInformationResults(A){}setMandatoryFulfilled(A,t){}async setSelectionsAndElements(A,t,e){}setVariationRecords(A){}toggleDesignConfirmed(){}updateMetadata(A,t){}async updateStorage(A,t){}}function oa(A,t,e){return(t=function(A){var t=function(A,t){if("object"!=typeof A||null===A)return A;var e=A[Symbol.toPrimitive];if(void 0!==e){var n=e.call(A,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(A)}(A,"string");return"symbol"==typeof t?t:String(t)}(t))in A?Object.defineProperty(A,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):A[t]=e,A}let ra;var sa;(sa=ra||(ra={})).SelectFrame="SelectFrame",sa.SelectImage="SelectImage",sa.Position="Position";class ca extends pi{constructor(A,t){super(A,t),oa(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(A){const t=this.manager.getRegionElements(this.step.stepName);return ti.selectVariant(this.step,A.getResource(),t,this.manager,(A=>this.setUpdateState(A)))}onFrameDataChanged(A){this.frameService&&this.frameService.onFrameDataChanged((t=>{t&&A(t)}))}selectImage(A){return ti.selectImage(this.step,A,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(A,t,e,n){return n&&n.length>1&&void 0===A?ra.SelectFrame:t||e||this.getImageData()?ra.Position:ra.SelectImage}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}hasVaryingUpload(){return this.step.data.varyUpload}hasVaryingSelection(){return this.step.data.varySelection}}const ga=A=>{const t=kA(null);let e=kA(void 0);const[n,i]=NA(void 0),{addEvent:a,removeEvent:o,updateEvent:r,eventCache:s}=Gt(),[c,g]=NA(!1),[B,l]=NA(!1),{state:w,uiDispatcher:d}=Vt(),E=RA((A=>{const t=A;d(new Kt({zoom:Math.max(.1,Math.min(t,w.maxZoom))}))}),[d,w.maxZoom]),h=RA((A=>{o(A),1===s.length&&(e.current=void 0),2===s.length&&i(void 0);"touch"===A.pointerType&&s.length>1&&s.length-1==1&&(l(!1),g(!1))}),[t,s]),Q=RA((A=>{a(A);"touch"===A.pointerType&&1===s.length&&(d(new Kt({selectedElement:void 0})),l(!0),g(!0))}),[t,B,s]),C=RA((A=>{r(A),A.isPrimary&&(e.current={x:A.screenX,y:A.screenY});const t=1===s.length&&"touch"!==s[0].pointerType,a=2===s.length&&"touch"===s[0].pointerType;if(c&&a){const[A,t]=s,e=Math.abs(A.clientX-t.clientX),a=n;a&&E(w.zoom-.0055*(a-e)),i(e)}if(B&&(t||a)&&A.isPrimary){const t=(e?.current?.x||A.screenX)-A.screenX,n=(e?.current?.y||A.screenY)-A.screenY;d(new Kt({selectedElement:void 0,xTranslation:w.xTranslation-t/w.zoom,yTranslation:w.yTranslation-n/w.zoom}))}}),[w.xTranslation,w.yTranslation,w.zoom,B,c,E,s,e,n]),u=RA((A=>{c&&E(w.zoom-.035*Math.sign(A.deltaY))}),[w,c]);UA((()=>{if(!t.current||0===s.length)return;const A=s[0].pointerId,e=t.current.hasPointerCapture(A);B&&!e&&t.current.setPointerCapture(A),!B&&e&&t.current.releasePointerCapture(A)}),[t,B,s]),Pe([" "],(()=>{l(!0),d(new Kt({selectedElement:void 0}))}),(()=>l(!1))),Pe(["Control"],(()=>g(!0)),(()=>g(!1)));const D=GA((()=>({cursor:B&&0===s.length?"grab":B&&1===s.length?"grabbing":c?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[B,c,s]);return bA("div",{ref:t,className:"transform-wrapper",onWheel:u,onPointerDown:Q,onPointerUp:h,onPointerCancel:h,onPointerLeave:h,onPointerMove:C,style:D,children:A.children})};export{na as SpiffCommerceClient,A as CommandContext,dt as spiffCoreConfiguration,Je as PromiseQueue,be as QueueablePromise,aa as MockWorkflowManager,Ei as InformationMessageType,pi as StepHandle,Ri as TextStepHandle,ca as FrameStepHandle,Mi as BulkStepHandle,Ni as ShapeStepHandle,Fi as IllustrationStepHandle,Yi as MaterialStepHandle,xi as ModelStepHandle,Si as PictureStepHandle,vi as QuestionStepHandle,qt as BulkPriceCalculationStrategy,Di as Variant,_A as OptionNotFoundError,At as LayoutNotFoundError,tt as AssetNotFoundError,et as ResourceNotFoundError,nt as MisconfigurationError,ot as ParseError,at as UnhandledBehaviorError,vt as assetService,Ti as designService,Ji as createDesign,Ut as optionService,lt as persistenceService,mt as graphQlManager,oe as toast,Vn as FrameService,jn as getBoundedOffsets,ti as frameStepService,ii as modelStepService,ni as materialStepService,si as shapeStepService,ri as questionStepService,_n as digitalContentStepService,ai as moduleStepService,oi as pictureStepService,wi as textStepService,ei as illustrationStepService,Wt as ProductCameraRig,ra as FrameStep,$t as ConversionLocation,Ae as ConversionDataType,ta as getWorkflow,t as AssetType,e as BringForwardCommand,n as BringToFrontCommand,i as BringToBackCommand,a as CanvasCommand,o as CreateElementCommand,r as CreateLayoutCommand,s as DeleteElementCommand,c as FontAlignmentCommand,g as FontColorCommand,B as FontSizeCommand,l as FontSourceCommand,w as GroupCommand,d as LayoutElementFactory,E as LayoutElementType,h as MoveCommand,Q as ResizeCommand,C as RotateCommand,u as SendBackwardsCommand,ee as StakeholderType,D as StepAspectType,m as StepType,p as TextChangeCommand,I as UnitOfMeasurement,f as dataUrlFromExternalUrl,y as findElement,M as frameDataCache,F as generate,Y as getAxisAlignedBoundingBox,x as generateSVGWithUnknownColors,S as getAttributesFromArrayBuffer,v as rehydrateSerializedLayout,N as getFrameData,R as getSvgElement,H as loadFontFromDataUrl,U as loadFontFromExternalUrl,P as determineCorrectFontSizeAndLines,G as patternImageDataCache,Cn as generateCommands,k as registerJSDOM,Re as minZoom,Yn as AdvancedEditor,ga as TransformWrapper,Fn as EditorCore,kt as useLayouts,Vt as useEditorState,Ue as useEditorInteraction,Pe as useShortcutCombination,Tt as commandReducer,Ot as getDefaultState,Pt as CommandContextContext,jt as AdvancedEditorStateProvider,zt as AdvancedEditorContext,Kt as UICommand,Jt as EditorSubMenu,re as ElementEventType,ce as KeyEvent,Gn as gatherVaryingStepAspects};
1103
1103
  //# sourceMappingURL=module.js.map
package/dist/types.d.ts CHANGED
@@ -1889,6 +1889,7 @@ export class SpiffCommerceClient {
1889
1889
  }>;
1890
1890
  clearCustomer(): void;
1891
1891
  clearCustomerForTransaction(transactionId: string): void;
1892
+ getStakeholderTypeForTransaction(transactionId: string): StakeholderType | undefined;
1892
1893
  getOrCreateCustomer(emailAddress: string): Promise<{
1893
1894
  customer: Customer;
1894
1895
  isAuthenticated: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "11.0.2",
3
+ "version": "11.1.0",
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",