@spiffcommerce/core 14.7.3-alpha.0 → 14.7.4-beta.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/main.js CHANGED
@@ -1358,5 +1358,5 @@ var t=require("@apollo/client"),e=require("lodash.clonedeep"),i=require("react/j
1358
1358
  }
1359
1359
  }
1360
1360
  }
1361
- `,Jc=async t=>(await ya.getShadowGraphqlClient().query({query:Nc,errorPolicy:"all",fetchPolicy:"cache-first",variables:{id:t}})).data.workflow,Lc=(t,e)=>{const i=t.workflowState,A=i?JSON.parse(i):void 0;return A?Object.values(A.layouts).map((t=>t.layout)):e.panels.sort(((t,e)=>t.index-e.index)).map((t=>({id:Te(),panelId:t.name,name:t.name,index:t.index,createdAt:new Date,updatedAt:new Date,transparentBackground:t.transparentBackground,height:t.height,width:t.width,previewRegion:t.previewRegion,useEditableArea:t.useEditableArea,editableArea:t.editableArea})))};class zc{constructor(t){var e;Sc(this,"options",void 0),Sc(this,"initialized",void 0),Sc(this,"currencyCode",void 0),Sc(this,"customer",void 0),Sc(this,"experienceOptions",void 0),Sc(this,"updateTransactionState",(async t=>{try{return ya.getShadowGraphqlClient().mutate({...t,mutation:Ps})}catch(t){throw console.error(t),new sa("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=t,this.options.applicationKey&&(e=this.options.applicationKey,Qa=e)}getAssetManager(){return Pa}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!this.options.applicationKey)throw new Error("Application key required to use Flow Service.");return new yc}async authenticateBundleFromLocalStorage(t){const e=ha.getMap("bundleOwnerIds");if(e?.has(t)){const i=e.get(t);return ma(i),Promise.resolve({success:!0,stakeholderType:nr.Owner})}const i=ha.getMap("bundleCustomerIds");if(i?.has(t)){const e=i.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(t){const e=ya.getShadowGraphqlClient(),i=await e.query({query:Rc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:t}});if(!i.data.transactions||0===i.data.transactions.length)throw new Error(`Transaction not found: ${t}`);const A=i.data.transactions[0],n=A.product?.partner?.id;if(!n)throw new Error(`Unable to read transaction: ${t}`);if(A.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const a=ha.getMap("transactionOwnerIds");if(a?.has(t)){const e=a.get(t);return pa(e),Promise.resolve({success:!0,stakeholderType:nr.Owner})}const r=ha.getMap("transactionCustomerIds");if(r?.has(t)){const e=r.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.transactions?.some((e=>e.id===t))))||this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}const s=(await e.query({query:kc,errorPolicy:"all",variables:{id:A.workflowId}})).data.workflow;if(!s)throw new Error(`Unable to read workflow: ${A.workflowId}`);return Promise.resolve({success:!1,theme:s.overrideTheme,customLogoLink:A.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(t){const e=ha.getMap("transactionCustomerIds");e?.has(t)&&(e.delete(t),ha.setMap("transactionCustomerIds",e))}getStakeholderTypeForTransaction(t){const e=this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return e.type}async getOrCreateCustomer(t){this.customer=void 0;const e=ya.getShadowGraphqlClient(),i=(await e.query({query:Hc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t}})).data.customer;if(!i.id){const i=(await e.mutate({mutation:Uc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:t}}})).data?.customerCreate;if(!i)throw new Error("Unable to create customer.");return this.customer=i,{customer:i,isAuthenticated:!1}}const A=await this.authenticateCustomerId(i.id);return{customer:this.customer||i,isAuthenticated:A}}async authenticateCustomerId(t){const e=ya.getShadowGraphqlClient(),i=ha.getMap("customerTokens");if(!i?.has(t))return!1;const A=i.get(t);if(!A)return!1;const n=(await e.mutate({mutation:Gc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:A}})).data?.customerAuthenticate;return!!n&&(Ca(A),this.customer=n,!0)}async generateVerificationCode(t){await ya.getShadowGraphqlClient().mutate({mutation:Tc,variables:{emailAddress:t}})}async verifyCode(t,e){const i=(await ya.getShadowGraphqlClient().mutate({mutation:Oc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t,verificationCode:e}})).data?.customerVerifyCode;if(i?.loginToken){if(!i.partner?.id)throw new Error(`Unable to find customer: ${t}`);const e=ha.getMap("customerTokens")||new Map;return e.set(i.id,i.loginToken),ha.setMap("customerTokens",e),Ca(i.loginToken),this.customer={...i,loginToken:void 0},!0}return!1}async getNewBundle(t){const e=(await ya.getShadowGraphqlClient().mutate({mutation:_o,variables:{collectionId:t},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!e)throw new Error("Unable to create bundle");ma(e.bundleOwnerId);const i=ha.getMap("bundleOwnerIds")||new Map;return i.set(e.id,e.bundleOwnerId),ha.setMap("bundleOwnerIds",i),new fc(this,e)}async getExistingBundle(t,e){const i=ha.getMap("bundleOwnerIds")?.get(t);i&&ma(i);const A=await ya.getShadowGraphqlClient().query({query:qo,variables:{id:t},fetchPolicy:"no-cache"});if(!A.data?.bundles||0===A.data?.bundles.length||!A.data?.bundles[0])throw new Error(`Unable to find bundle: ${t}`);const n=A.data?.bundles[0],a=new fc(this,n,e);return await a.getInitializationPromise(),a}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const t=await ya.getShadowGraphqlClient().query({query:$o,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!t.data?.customers||0===t.data.customers.length)throw new Error("Unable to find customer.");return t.data.customers[0].bundleStakeholders||[]}async getWorkflowExperience(t,e,i,A){if(!A)return await this.getWorkflowExperienceDeprecated(t,e,i);const n=async t=>{for(const e in t.layouts){const i=t.layouts[e].elements.filter((t=>t.type===ze.Illustration));for(let t=0;t<i.length;++t){const e=i[t];e.src&&e.svg&&(e.cachedObjectURL=await Kn(e.svg))}const A=t.layouts[e].elements.filter((t=>t.type===ze.Textbox));for(let t=0;t<A.length;++t){const e=A[t];e.fontData?.assetUrl&&rA(e.fontData.assetUrl)}}},{transaction:a,workflow:r,readOnly:s}=await(async()=>{const t=ya.getShadowGraphqlClient();if("transaction"===A.type){const{transactionId:e,readOnly:i}=A,n=await t.query({query:Ys,variables:{id:e},errorPolicy:"all",fetchPolicy:"no-cache"});if(!n.data?.transactions||0===n.data.transactions.length)throw new sa("Existing transaction not found.");const a=n.data?.transactions[0];if(!a.workflowId)throw new sa("Existing transaction has no workflow ID.");const r=await Jc(a.workflowId);if(!a.product)throw new sa("Failed to load transaction, product not available.");return{transaction:a,workflow:r,readOnly:i}}if("integration"===A.type||"external"===A.type){const e=async()=>{const e="integration"===A.type?{integrationProductId:A.integrationProductId}:{externalIntegrationId:A.externalIntegrationId,externalProductId:A.externalProductId},i=await t.mutate({mutation:Fs,variables:{...e,bulk:A.bulk,workflowId:A.workflowId,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!i.data||!i.data.transactionCreate)throw new sa("Failed to create transaction!");const n=i.data.transactionCreate;if(!n.product)throw new sa("Failed to create transaction, product not available.");return n},i=Jc(A.workflowId),[n,a]=await Promise.all([e(),i]);return{transaction:n,workflow:a}}throw new sa("No workflow ID provided.")})();this.currencyCode=a.product.partner?.currencyCode;const o={product:a.product,transaction:a,layouts:[],stateMutationFunc:s?async()=>{throw new aa("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:s,workflow:r};if("transaction"===A.type&&a.workflowState){const t=JSON.parse(a.workflowState);o.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await n(t),o.reloadedState=t}else if(!s&&A.workflowState){const t=JSON.parse(A.workflowState);o.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await n(t),o.reloadedState=t}else o.layouts=Lc(o.transaction,o.workflow);if(o.renderableContextService=new Cs(o.layouts),A.previewService?(o.previewService=A.previewService,o.product?.modelUrl&&(o.modelContainer=o.previewService.loadModel({model:o.product.modelUrl,contextService:o.renderableContextService}))):(o.previewService=i&&i(r),o.product?.modelUrl&&(o.previewService?.initialize({model:o.product.modelUrl,contextService:o.renderableContextService}),o.modelContainer=o.previewService?.getAllModels()[0])),"transaction"!==A.type){const t=ha.getMap("transactionOwnerIds")||new Map;t.set(a.id,a.transactionOwnerId),pa(a.transactionOwnerId||""),ha.setMap("transactionOwnerIds",t)}else{const t=(ha.getMap("transactionOwnerIds")||new Map).get(a.id);t&&pa(t),o.isReloadedTransaction=!0}this.initialized=!0,this.experienceOptions=o;const c=new Ko(this,o);return await c.getWorkflowManager().getInitializationPromise(),"transaction"!==A.type&&this.customer&&await c.attachCustomerDetails({email:this.customer.emailAddress}),c}async initFromIntegrationProduct(t){if(""===t)throw new sa("No integration product ID provided.");const e=ya.getShadowGraphqlClient(),i=await e.mutate({mutation:Fs,variables:{integrationProductId:t,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(!i.data||!i.data.transactionCreate)throw new sa("Failed to create transaction!");const A=i.data.transactionCreate;if(!A.product)throw new sa("Failed to create transaction, product not available.");this.currencyCode=A.product.partner?.currencyCode;const n=ha.getMap("transactionOwnerIds")||new Map;n.set(A.id,A.transactionOwnerId),pa(A.transactionOwnerId||""),ha.setMap("transactionOwnerIds",n),this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(t,e=!1){if(""===t)throw new sa("No transaction ID provided.");const i=ya.getShadowGraphqlClient();if(e)return await(async()=>{const A=(await i.query({query:Ys,variables:{id:t},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.transactions[0];if(!A)throw new sa("Failed to read transaction.");if(!A.product)throw new sa("Failed to load transaction, product not available.");this.currencyCode=A.product.partner?.currencyCode,this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:async()=>{throw new aa("State mutation is forbidden in read only mode!")},readOnly:e},this.initialized=!0})();const A=ha.getMap("transactionOwnerIds")||new Map,n=A.get(t);if(n){pa(n);const A=(await i.query({query:Ys,variables:{id:t},errorPolicy:"all"})).data?.transactions[0];if(!A)throw new sa("Failed to read transaction.");if(!A.product)throw new sa("Failed to load transaction, product not available.");return this.currencyCode=A.product.partner?.currencyCode,this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},void(this.initialized=!0)}try{const n=(await i.mutate({mutation:bs,variables:{id:t},errorPolicy:"all"})).data?.transactionClaim;if(!n)throw new sa("Failed to read transaction.");if(!n.product)throw new sa("Failed to load transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode,n.transactionOwnerId&&(A.set(n.id,n.transactionOwnerId),pa(n.transactionOwnerId),ha.setMap("transactionOwnerIds",A)),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},this.initialized=!0}catch{throw new sa("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(t,e,i){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot launch experience: Not initialized.");const A=async t=>{for(const e in t.layouts){const i=t.layouts[e].elements.filter((t=>t.type===ze.Illustration));for(let t=0;t<i.length;++t){const e=i[t];e.src&&e.svg&&(e.cachedObjectURL=await Kn(e.svg))}const A=t.layouts[e].elements.filter((t=>t.type===ze.Textbox));for(let t=0;t<A.length;++t){const e=A[t];e.fontData?.assetUrl&&rA(e.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const t=await Jc(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=t,this.experienceOptions.transaction.workflowState){const t=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await A(t),this.experienceOptions.reloadedState=t}this.experienceOptions.previewService=i&&i(t),this.experienceOptions.renderableContextService=new Cs(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const e=new Ko(this,this.experienceOptions);return await e.getWorkflowManager().getInitializationPromise(),e}if(t){const n=ya.getShadowGraphqlClient().mutate({mutation:Ns,variables:{workflowId:t,id:this.experienceOptions.transaction.id}}),a=Jc(t);if(await Promise.all([n,a]),this.experienceOptions.workflow=await a,e){const t=JSON.parse(e);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await A(t),this.experienceOptions.reloadedState=t}else this.experienceOptions.layouts=Lc(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=i&&i(await a),this.experienceOptions.renderableContextService=new Cs(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const r=new Ko(this,this.experienceOptions);return await r.getWorkflowManager().getInitializationPromise(),r}throw new sa("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function jc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class Vc{constructor(){jc(this,"getProduct",void 0),jc(this,"getCommandContext",void 0),jc(this,"getAllLayoutData",void 0),jc(this,"getMetadata",void 0),jc(this,"getWorkflowMetadata",void 0),jc(this,"getStepStorage",void 0),jc(this,"setModelContainer",void 0),jc(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(t){}addVariationRecord(t){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(t){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(t){}addPoller(t){}addConfirmCallback(t){}addCurrentVariationCallback(t){}addEditedCallback(t){}addElementsCallback(t){}addInformationResultCallback(t){}addInitCallback(t){}addMakingAdjustmentsCallback(t){}addMandatoryCallback(t){}addMetadataCallback(t){}addSelectionCallback(t){}addStepSpecificStorageCallback(t,e){}addStorageCallback(t){}addVariationRecordsCallback(t){}getCommandDispatcher(){return t=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(t){return[]}getSerializedStep(t,e){}getStepSpecificServices(t){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(t){}markUpdateCompleted(t){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(t){}setCurrentVariationRecord(t){}setEditedStatus(t,e){}setInformationResults(t){}setMandatoryFulfilled(t,e){}async setSelectionsAndElements(t,e,i){}setVariationRecords(t){}toggleDesignConfirmed(){}updateMetadata(t,e){}async updateStorage(t,e){}injectIntoPreviewService(t){return Promise.resolve()}ejectFromPreviewService(){}}function Kc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}let Wc;var Xc;(Xc=Wc||(Wc={})).SelectFrame="SelectFrame",Xc.SelectImage="SelectImage",Xc.Position="Position";class qc extends Do{constructor(t,e){super(t,e),Kc(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(t){const e=this.manager.getRegionElements(this.step.stepName);return io.selectVariant(this.step,t.getResource(),e,this.manager,(t=>this.setUpdateState(t)))}onFrameDataChanged(t){this.frameService&&this.frameService.onFrameDataChanged((e=>{e&&t(e)}))}selectImage(t){return io.selectImage(this.step,t,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(t,e,i,A){return A&&A.length>1&&void 0===t?Wc.SelectFrame:e||i||this.getImageData()?Wc.Position:Wc.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 Zc=t=>{const e=(0,A.useRef)(null),n=(0,A.useRef)(void 0),[a,r]=(0,A.useState)(void 0),{addEvent:s,removeEvent:o,updateEvent:c,eventCache:l}=Ga(),[g,h]=(0,A.useState)(!1),[d,u]=(0,A.useState)(!1),{state:w,uiDispatcher:B}=Xa(),p=(0,A.useCallback)((t=>{const e=t;B(new Wa({zoom:Math.max(.1,Math.min(e,w.maxZoom))}))}),[B,w.maxZoom]),E=(0,A.useCallback)((t=>{o(t),1===l.length&&(n.current=void 0),2===l.length&&r(void 0);"touch"===t.pointerType&&l.length>1&&l.length-1==1&&(u(!1),h(!1))}),[o,l.length]),m=(0,A.useCallback)((t=>{s(t);"touch"===t.pointerType&&1===l.length&&(B(new Wa({selectedElement:void 0})),u(!0),h(!0))}),[s,l.length,B]),f=(0,A.useCallback)((t=>{c(t);const e=1===l.length&&"touch"!==l[0].pointerType,i=2===l.length&&"touch"===l[0].pointerType;if(g&&i){const[t,e]=l,i=Math.abs(t.clientX-e.clientX),A=a;A&&p(w.zoom-.0055*(A-i)),r(i)}if(d&&(e||i)&&t.isPrimary){const e=(n?.current?.x||t.screenX)-t.screenX,i=(n?.current?.y||t.screenY)-t.screenY;B(new Wa({selectedElement:void 0,xTranslation:w.xTranslation-e/w.zoom,yTranslation:w.yTranslation-i/w.zoom}))}t.isPrimary&&(n.current={x:t.screenX,y:t.screenY})}),[c,l,g,d,a,p,w.zoom,w.xTranslation,w.yTranslation,B]),C=(0,A.useCallback)((t=>{g&&p(w.zoom-.035*Math.sign(t.deltaY))}),[p,w.zoom,g]);(0,A.useEffect)((()=>{if(!e.current||0===l.length)return;const t=l[0].pointerId,i=e.current.hasPointerCapture(t);d&&!i&&e.current.setPointerCapture(t),!d&&i&&e.current.releasePointerCapture(t)}),[e,d,l]),Ur([" "],(()=>{u(!0),B(new Wa({selectedElement:void 0}))}),(()=>u(!1))),Ur(["Control"],(()=>h(!0)),(()=>h(!1)));const Q=(0,A.useMemo)((()=>({cursor:d&&0===l.length?"grab":d&&1===l.length?"grabbing":g?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[d,g,l]);return(0,i.jsx)("div",{ref:e,className:"transform-wrapper",onWheel:C,onPointerDown:m,onPointerUp:E,onPointerCancel:E,onPointerLeave:E,onPointerMove:f,style:Q,children:t.children})};
1361
+ `,Jc=async t=>(await ya.getShadowGraphqlClient().query({query:Nc,errorPolicy:"all",fetchPolicy:"cache-first",variables:{id:t}})).data.workflow,Lc=(t,e)=>{const i=t.workflowState,A=i?JSON.parse(i):void 0;return A?Object.values(A.layouts).map((t=>t.layout)):e.panels.sort(((t,e)=>t.index-e.index)).map((t=>({id:Te(),panelId:t.name,name:t.name,index:t.index,createdAt:new Date,updatedAt:new Date,transparentBackground:t.transparentBackground,height:t.height,width:t.width,previewRegion:t.previewRegion,useEditableArea:t.useEditableArea,editableArea:t.editableArea})))};class zc{constructor(t){var e;Sc(this,"options",void 0),Sc(this,"initialized",void 0),Sc(this,"currencyCode",void 0),Sc(this,"customer",void 0),Sc(this,"experienceOptions",void 0),Sc(this,"updateTransactionState",(async t=>{try{return ya.getShadowGraphqlClient().mutate({...t,mutation:Ps})}catch(t){throw console.error(t),new sa("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=t,this.options.applicationKey&&(e=this.options.applicationKey,Qa=e)}getAssetManager(){return Pa}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!this.options.applicationKey)throw new Error("Application key required to use Flow Service.");return new yc}async authenticateBundleFromLocalStorage(t){const e=ha.getMap("bundleOwnerIds");if(e?.has(t)){const i=e.get(t);return ma(i),Promise.resolve({success:!0,stakeholderType:nr.Owner})}const i=ha.getMap("bundleCustomerIds");if(i?.has(t)){const e=i.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(t){const e=ya.getShadowGraphqlClient(),i=await e.query({query:Rc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:t}});if(!i.data.transactions||0===i.data.transactions.length)throw new Error(`Transaction not found: ${t}`);const A=i.data.transactions[0],n=A.product?.partner?.id;if(!n)throw new Error(`Unable to read transaction: ${t}`);if(A.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const a=ha.getMap("transactionOwnerIds");if(a?.has(t)){const e=a.get(t);return pa(e),Promise.resolve({success:!0,stakeholderType:nr.Owner})}const r=ha.getMap("transactionCustomerIds");if(r?.has(t)){const e=r.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.transactions?.some((e=>e.id===t))))||this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}const s=(await e.query({query:kc,errorPolicy:"all",variables:{id:A.workflowId}})).data.workflow;if(!s)throw new Error(`Unable to read workflow: ${A.workflowId}`);return Promise.resolve({success:!1,theme:s.overrideTheme,customLogoLink:A.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(t){const e=ha.getMap("transactionCustomerIds");e?.has(t)&&(e.delete(t),ha.setMap("transactionCustomerIds",e))}getStakeholderTypeForTransaction(t){const e=this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return e.type}async getOrCreateCustomer(t){this.customer=void 0;const e=ya.getShadowGraphqlClient(),i=(await e.query({query:Hc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t}})).data.customer;if(!i.id){const i=(await e.mutate({mutation:Uc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:t}}})).data?.customerCreate;if(!i)throw new Error("Unable to create customer.");return this.customer=i,{customer:i,isAuthenticated:!1}}const A=await this.authenticateCustomerId(i.id);return{customer:this.customer||i,isAuthenticated:A}}async authenticateCustomerId(t){const e=ya.getShadowGraphqlClient(),i=ha.getMap("customerTokens");if(!i?.has(t))return!1;const A=i.get(t);if(!A)return!1;const n=(await e.mutate({mutation:Gc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:A}})).data?.customerAuthenticate;return!!n&&(Ca(A),this.customer=n,!0)}async generateVerificationCode(t){await ya.getShadowGraphqlClient().mutate({mutation:Tc,variables:{emailAddress:t}})}async verifyCode(t,e){const i=(await ya.getShadowGraphqlClient().mutate({mutation:Oc,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t,verificationCode:e}})).data?.customerVerifyCode;if(i?.loginToken){if(!i.partner?.id)throw new Error(`Unable to find customer: ${t}`);const e=ha.getMap("customerTokens")||new Map;return e.set(i.id,i.loginToken),ha.setMap("customerTokens",e),Ca(i.loginToken),this.customer={...i,loginToken:void 0},!0}return!1}async getNewBundle(t){const e=(await ya.getShadowGraphqlClient().mutate({mutation:_o,variables:{collectionId:t},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!e)throw new Error("Unable to create bundle");ma(e.bundleOwnerId);const i=ha.getMap("bundleOwnerIds")||new Map;return i.set(e.id,e.bundleOwnerId),ha.setMap("bundleOwnerIds",i),new fc(this,e)}async getExistingBundle(t,e){const i=ha.getMap("bundleOwnerIds")?.get(t);i&&ma(i);const A=await ya.getShadowGraphqlClient().query({query:qo,variables:{id:t},fetchPolicy:"no-cache"});if(!A.data?.bundles||0===A.data?.bundles.length||!A.data?.bundles[0])throw new Error(`Unable to find bundle: ${t}`);const n=A.data?.bundles[0],a=new fc(this,n,e);return await a.getInitializationPromise(),a}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const t=await ya.getShadowGraphqlClient().query({query:$o,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!t.data?.customers||0===t.data.customers.length)throw new Error("Unable to find customer.");return t.data.customers[0].bundleStakeholders||[]}async getWorkflowExperience(t,e,i,A){if(!A)return await this.getWorkflowExperienceDeprecated(t,e,i);const n=async t=>{for(const e in t.layouts){const i=t.layouts[e].elements.filter((t=>t.type===ze.Illustration));for(let t=0;t<i.length;++t){const e=i[t];e.src&&e.svg&&(e.cachedObjectURL=await Kn(e.svg))}const A=t.layouts[e].elements.filter((t=>t.type===ze.Textbox));for(let t=0;t<A.length;++t){const e=A[t];e.fontData?.assetUrl&&rA(e.fontData.assetUrl)}}},{transaction:a,workflow:r,readOnly:s}=await(async()=>{const t=ya.getShadowGraphqlClient();if("transaction"===A.type){const{transactionId:e,readOnly:i}=A,n=await t.query({query:Ys,variables:{id:e},errorPolicy:"all"});if(!n.data?.transactions||0===n.data.transactions.length)throw new sa("Existing transaction not found.");const a=n.data?.transactions[0];if(!a.workflowId)throw new sa("Existing transaction has no workflow ID.");const r=await Jc(a.workflowId);if(!a.product)throw new sa("Failed to load transaction, product not available.");return{transaction:a,workflow:r,readOnly:i}}if("integration"===A.type||"external"===A.type){const e=async()=>{const e="integration"===A.type?{integrationProductId:A.integrationProductId}:{externalIntegrationId:A.externalIntegrationId,externalProductId:A.externalProductId},i=await t.mutate({mutation:Fs,variables:{...e,bulk:A.bulk,workflowId:A.workflowId,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!i.data||!i.data.transactionCreate)throw new sa("Failed to create transaction!");const n=i.data.transactionCreate;if(!n.product)throw new sa("Failed to create transaction, product not available.");return n},i=Jc(A.workflowId),[n,a]=await Promise.all([e(),i]);return{transaction:n,workflow:a}}throw new sa("No workflow ID provided.")})();this.currencyCode=a.product.partner?.currencyCode;const o={product:a.product,transaction:a,layouts:[],stateMutationFunc:s?async()=>{throw new aa("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:s,workflow:r};if("transaction"===A.type&&a.workflowState){const t=JSON.parse(a.workflowState);o.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await n(t),o.reloadedState=t}else if(!s&&A.workflowState){const t=JSON.parse(A.workflowState);o.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await n(t),o.reloadedState=t}else o.layouts=Lc(o.transaction,o.workflow);if(o.renderableContextService=new Cs(o.layouts),A.previewService?(o.previewService=A.previewService,o.product?.modelUrl&&(o.modelContainer=o.previewService.loadModel({model:o.product.modelUrl,contextService:o.renderableContextService}))):(o.previewService=i&&i(r),o.product?.modelUrl&&(o.previewService?.initialize({model:o.product.modelUrl,contextService:o.renderableContextService}),o.modelContainer=o.previewService?.getAllModels()[0])),"transaction"!==A.type){const t=ha.getMap("transactionOwnerIds")||new Map;t.set(a.id,a.transactionOwnerId),pa(a.transactionOwnerId||""),ha.setMap("transactionOwnerIds",t)}else{const t=(ha.getMap("transactionOwnerIds")||new Map).get(a.id);t&&pa(t),o.isReloadedTransaction=!0}this.initialized=!0,this.experienceOptions=o;const c=new Ko(this,o);return await c.getWorkflowManager().getInitializationPromise(),"transaction"!==A.type&&this.customer&&await c.attachCustomerDetails({email:this.customer.emailAddress}),c}async initFromIntegrationProduct(t){if(""===t)throw new sa("No integration product ID provided.");const e=ya.getShadowGraphqlClient(),i=await e.mutate({mutation:Fs,variables:{integrationProductId:t,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(!i.data||!i.data.transactionCreate)throw new sa("Failed to create transaction!");const A=i.data.transactionCreate;if(!A.product)throw new sa("Failed to create transaction, product not available.");this.currencyCode=A.product.partner?.currencyCode;const n=ha.getMap("transactionOwnerIds")||new Map;n.set(A.id,A.transactionOwnerId),pa(A.transactionOwnerId||""),ha.setMap("transactionOwnerIds",n),this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(t,e=!1){if(""===t)throw new sa("No transaction ID provided.");const i=ya.getShadowGraphqlClient();if(e)return await(async()=>{const A=(await i.query({query:Ys,variables:{id:t},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.transactions[0];if(!A)throw new sa("Failed to read transaction.");if(!A.product)throw new sa("Failed to load transaction, product not available.");this.currencyCode=A.product.partner?.currencyCode,this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:async()=>{throw new aa("State mutation is forbidden in read only mode!")},readOnly:e},this.initialized=!0})();const A=ha.getMap("transactionOwnerIds")||new Map,n=A.get(t);if(n){pa(n);const A=(await i.query({query:Ys,variables:{id:t},errorPolicy:"all"})).data?.transactions[0];if(!A)throw new sa("Failed to read transaction.");if(!A.product)throw new sa("Failed to load transaction, product not available.");return this.currencyCode=A.product.partner?.currencyCode,this.experienceOptions={product:A.product,transaction:A,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},void(this.initialized=!0)}try{const n=(await i.mutate({mutation:bs,variables:{id:t},errorPolicy:"all"})).data?.transactionClaim;if(!n)throw new sa("Failed to read transaction.");if(!n.product)throw new sa("Failed to load transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode,n.transactionOwnerId&&(A.set(n.id,n.transactionOwnerId),pa(n.transactionOwnerId),ha.setMap("transactionOwnerIds",A)),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},this.initialized=!0}catch{throw new sa("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(t,e,i){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot launch experience: Not initialized.");const A=async t=>{for(const e in t.layouts){const i=t.layouts[e].elements.filter((t=>t.type===ze.Illustration));for(let t=0;t<i.length;++t){const e=i[t];e.src&&e.svg&&(e.cachedObjectURL=await Kn(e.svg))}const A=t.layouts[e].elements.filter((t=>t.type===ze.Textbox));for(let t=0;t<A.length;++t){const e=A[t];e.fontData?.assetUrl&&rA(e.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const t=await Jc(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=t,this.experienceOptions.transaction.workflowState){const t=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await A(t),this.experienceOptions.reloadedState=t}this.experienceOptions.previewService=i&&i(t),this.experienceOptions.renderableContextService=new Cs(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const e=new Ko(this,this.experienceOptions);return await e.getWorkflowManager().getInitializationPromise(),e}if(t){const n=ya.getShadowGraphqlClient().mutate({mutation:Ns,variables:{workflowId:t,id:this.experienceOptions.transaction.id}}),a=Jc(t);if(await Promise.all([n,a]),this.experienceOptions.workflow=await a,e){const t=JSON.parse(e);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await XA(t),await A(t),this.experienceOptions.reloadedState=t}else this.experienceOptions.layouts=Lc(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=i&&i(await a),this.experienceOptions.renderableContextService=new Cs(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const r=new Ko(this,this.experienceOptions);return await r.getWorkflowManager().getInitializationPromise(),r}throw new sa("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new sa("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function jc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class Vc{constructor(){jc(this,"getProduct",void 0),jc(this,"getCommandContext",void 0),jc(this,"getAllLayoutData",void 0),jc(this,"getMetadata",void 0),jc(this,"getWorkflowMetadata",void 0),jc(this,"getStepStorage",void 0),jc(this,"setModelContainer",void 0),jc(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(t){}addVariationRecord(t){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(t){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(t){}addPoller(t){}addConfirmCallback(t){}addCurrentVariationCallback(t){}addEditedCallback(t){}addElementsCallback(t){}addInformationResultCallback(t){}addInitCallback(t){}addMakingAdjustmentsCallback(t){}addMandatoryCallback(t){}addMetadataCallback(t){}addSelectionCallback(t){}addStepSpecificStorageCallback(t,e){}addStorageCallback(t){}addVariationRecordsCallback(t){}getCommandDispatcher(){return t=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(t){return[]}getSerializedStep(t,e){}getStepSpecificServices(t){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(t){}markUpdateCompleted(t){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(t){}setCurrentVariationRecord(t){}setEditedStatus(t,e){}setInformationResults(t){}setMandatoryFulfilled(t,e){}async setSelectionsAndElements(t,e,i){}setVariationRecords(t){}toggleDesignConfirmed(){}updateMetadata(t,e){}async updateStorage(t,e){}injectIntoPreviewService(t){return Promise.resolve()}ejectFromPreviewService(){}}function Kc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var A=i.call(t,e||"default");if("object"!=typeof A)return A;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:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}let Wc;var Xc;(Xc=Wc||(Wc={})).SelectFrame="SelectFrame",Xc.SelectImage="SelectImage",Xc.Position="Position";class qc extends Do{constructor(t,e){super(t,e),Kc(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(t){const e=this.manager.getRegionElements(this.step.stepName);return io.selectVariant(this.step,t.getResource(),e,this.manager,(t=>this.setUpdateState(t)))}onFrameDataChanged(t){this.frameService&&this.frameService.onFrameDataChanged((e=>{e&&t(e)}))}selectImage(t){return io.selectImage(this.step,t,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(t,e,i,A){return A&&A.length>1&&void 0===t?Wc.SelectFrame:e||i||this.getImageData()?Wc.Position:Wc.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 Zc=t=>{const e=(0,A.useRef)(null),n=(0,A.useRef)(void 0),[a,r]=(0,A.useState)(void 0),{addEvent:s,removeEvent:o,updateEvent:c,eventCache:l}=Ga(),[g,h]=(0,A.useState)(!1),[d,u]=(0,A.useState)(!1),{state:w,uiDispatcher:B}=Xa(),p=(0,A.useCallback)((t=>{const e=t;B(new Wa({zoom:Math.max(.1,Math.min(e,w.maxZoom))}))}),[B,w.maxZoom]),E=(0,A.useCallback)((t=>{o(t),1===l.length&&(n.current=void 0),2===l.length&&r(void 0);"touch"===t.pointerType&&l.length>1&&l.length-1==1&&(u(!1),h(!1))}),[o,l.length]),m=(0,A.useCallback)((t=>{s(t);"touch"===t.pointerType&&1===l.length&&(B(new Wa({selectedElement:void 0})),u(!0),h(!0))}),[s,l.length,B]),f=(0,A.useCallback)((t=>{c(t);const e=1===l.length&&"touch"!==l[0].pointerType,i=2===l.length&&"touch"===l[0].pointerType;if(g&&i){const[t,e]=l,i=Math.abs(t.clientX-e.clientX),A=a;A&&p(w.zoom-.0055*(A-i)),r(i)}if(d&&(e||i)&&t.isPrimary){const e=(n?.current?.x||t.screenX)-t.screenX,i=(n?.current?.y||t.screenY)-t.screenY;B(new Wa({selectedElement:void 0,xTranslation:w.xTranslation-e/w.zoom,yTranslation:w.yTranslation-i/w.zoom}))}t.isPrimary&&(n.current={x:t.screenX,y:t.screenY})}),[c,l,g,d,a,p,w.zoom,w.xTranslation,w.yTranslation,B]),C=(0,A.useCallback)((t=>{g&&p(w.zoom-.035*Math.sign(t.deltaY))}),[p,w.zoom,g]);(0,A.useEffect)((()=>{if(!e.current||0===l.length)return;const t=l[0].pointerId,i=e.current.hasPointerCapture(t);d&&!i&&e.current.setPointerCapture(t),!d&&i&&e.current.releasePointerCapture(t)}),[e,d,l]),Ur([" "],(()=>{u(!0),B(new Wa({selectedElement:void 0}))}),(()=>u(!1))),Ur(["Control"],(()=>h(!0)),(()=>h(!1)));const Q=(0,A.useMemo)((()=>({cursor:d&&0===l.length?"grab":d&&1===l.length?"grabbing":g?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[d,g,l]);return(0,i.jsx)("div",{ref:e,className:"transform-wrapper",onWheel:C,onPointerDown:m,onPointerUp:E,onPointerCancel:E,onPointerLeave:E,onPointerMove:f,style:Q,children:t.children})};
1362
1362
  //# sourceMappingURL=main.js.map
package/dist/module.js CHANGED
@@ -1358,5 +1358,5 @@ import{CommandContext as t,AssetType as e,BringForwardCommand as A,BringToFrontC
1358
1358
  }
1359
1359
  }
1360
1360
  }
1361
- `,Oi=async t=>(await ye.getShadowGraphqlClient().query({query:Hi,errorPolicy:"all",fetchPolicy:"cache-first",variables:{id:t}})).data.workflow,zi=(t,e)=>{const A=t.workflowState,n=A?JSON.parse(A):void 0;return n?Object.values(n.layouts).map((t=>t.layout)):e.panels.sort(((t,e)=>t.index-e.index)).map((t=>({id:F(),panelId:t.name,name:t.name,index:t.index,createdAt:new Date,updatedAt:new Date,transparentBackground:t.transparentBackground,height:t.height,width:t.width,previewRegion:t.previewRegion,useEditableArea:t.useEditableArea,editableArea:t.editableArea})))};class ji{constructor(t){var e;vi(this,"options",void 0),vi(this,"initialized",void 0),vi(this,"currencyCode",void 0),vi(this,"customer",void 0),vi(this,"experienceOptions",void 0),vi(this,"updateTransactionState",(async t=>{try{return ye.getShadowGraphqlClient().mutate({...t,mutation:Un})}catch(t){throw console.error(t),new ce("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=t,this.options.applicationKey&&(e=this.options.applicationKey,Ie=e)}getAssetManager(){return He}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!this.options.applicationKey)throw new Error("Application key required to use Flow Service.");return new Ii}async authenticateBundleFromLocalStorage(t){const e=de.getMap("bundleOwnerIds");if(e?.has(t)){const A=e.get(t);return me(A),Promise.resolve({success:!0,stakeholderType:oA.Owner})}const A=de.getMap("bundleCustomerIds");if(A?.has(t)){const e=A.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(t){const e=ye.getShadowGraphqlClient(),A=await e.query({query:Ui,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:t}});if(!A.data.transactions||0===A.data.transactions.length)throw new Error(`Transaction not found: ${t}`);const n=A.data.transactions[0],a=n.product?.partner?.id;if(!a)throw new Error(`Unable to read transaction: ${t}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const i=de.getMap("transactionOwnerIds");if(i?.has(t)){const e=i.get(t);return Qe(e),Promise.resolve({success:!0,stakeholderType:oA.Owner})}const o=de.getMap("transactionCustomerIds");if(o?.has(t)){const e=o.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.transactions?.some((e=>e.id===t))))||this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}const r=(await e.query({query:bi,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(t){const e=de.getMap("transactionCustomerIds");e?.has(t)&&(e.delete(t),de.setMap("transactionCustomerIds",e))}getStakeholderTypeForTransaction(t){const e=this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return e.type}async getOrCreateCustomer(t){this.customer=void 0;const e=ye.getShadowGraphqlClient(),A=(await e.query({query:ki,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t}})).data.customer;if(!A.id){const A=(await e.mutate({mutation:Gi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:t}}})).data?.customerCreate;if(!A)throw new Error("Unable to create customer.");return this.customer=A,{customer:A,isAuthenticated:!1}}const n=await this.authenticateCustomerId(A.id);return{customer:this.customer||A,isAuthenticated:n}}async authenticateCustomerId(t){const e=ye.getShadowGraphqlClient(),A=de.getMap("customerTokens");if(!A?.has(t))return!1;const n=A.get(t);if(!n)return!1;const a=(await e.mutate({mutation:Ji,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data?.customerAuthenticate;return!!a&&(fe(n),this.customer=a,!0)}async generateVerificationCode(t){await ye.getShadowGraphqlClient().mutate({mutation:Li,variables:{emailAddress:t}})}async verifyCode(t,e){const A=(await ye.getShadowGraphqlClient().mutate({mutation:Ti,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t,verificationCode:e}})).data?.customerVerifyCode;if(A?.loginToken){if(!A.partner?.id)throw new Error(`Unable to find customer: ${t}`);const e=de.getMap("customerTokens")||new Map;return e.set(A.id,A.loginToken),de.setMap("customerTokens",e),fe(A.loginToken),this.customer={...A,loginToken:void 0},!0}return!1}async getNewBundle(t){const e=(await ye.getShadowGraphqlClient().mutate({mutation:ti,variables:{collectionId:t},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!e)throw new Error("Unable to create bundle");me(e.bundleOwnerId);const A=de.getMap("bundleOwnerIds")||new Map;return A.set(e.id,e.bundleOwnerId),de.setMap("bundleOwnerIds",A),new mi(this,e)}async getExistingBundle(t,e){const A=de.getMap("bundleOwnerIds")?.get(t);A&&me(A);const n=await ye.getShadowGraphqlClient().query({query:Za,variables:{id:t},fetchPolicy:"no-cache"});if(!n.data?.bundles||0===n.data?.bundles.length||!n.data?.bundles[0])throw new Error(`Unable to find bundle: ${t}`);const a=n.data?.bundles[0],i=new mi(this,a,e);return await i.getInitializationPromise(),i}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const t=await ye.getShadowGraphqlClient().query({query:_a,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!t.data?.customers||0===t.data.customers.length)throw new Error("Unable to find customer.");return t.data.customers[0].bundleStakeholders||[]}async getWorkflowExperience(t,e,A,n){if(!n)return await this.getWorkflowExperienceDeprecated(t,e,A);const a=async t=>{for(const e in t.layouts){const A=t.layouts[e].elements.filter((t=>t.type===h.Illustration));for(let t=0;t<A.length;++t){const e=A[t];e.src&&e.svg&&(e.cachedObjectURL=await dt(e.svg))}const n=t.layouts[e].elements.filter((t=>t.type===h.Textbox));for(let t=0;t<n.length;++t){const e=n[t];e.fontData?.assetUrl&&H(e.fontData.assetUrl)}}},{transaction:i,workflow:o,readOnly:r}=await(async()=>{const t=ye.getShadowGraphqlClient();if("transaction"===n.type){const{transactionId:e,readOnly:A}=n,a=await t.query({query:Hn,variables:{id:e},errorPolicy:"all",fetchPolicy:"no-cache"});if(!a.data?.transactions||0===a.data.transactions.length)throw new ce("Existing transaction not found.");const i=a.data?.transactions[0];if(!i.workflowId)throw new ce("Existing transaction has no workflow ID.");const o=await Oi(i.workflowId);if(!i.product)throw new ce("Failed to load transaction, product not available.");return{transaction:i,workflow:o,readOnly:A}}if("integration"===n.type||"external"===n.type){const e=async()=>{const e="integration"===n.type?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},A=await t.mutate({mutation:Pn,variables:{...e,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(!A.data||!A.data.transactionCreate)throw new ce("Failed to create transaction!");const a=A.data.transactionCreate;if(!a.product)throw new ce("Failed to create transaction, product not available.");return a},A=Oi(n.workflowId),[a,i]=await Promise.all([e(),A]);return{transaction:a,workflow:i}}throw new ce("No workflow ID provided.")})();this.currencyCode=i.product.partner?.currencyCode;const s={product:i.product,transaction:i,layouts:[],stateMutationFunc:r?async()=>{throw new re("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:r,workflow:o};if("transaction"===n.type&&i.workflowState){const t=JSON.parse(i.workflowState);s.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await a(t),s.reloadedState=t}else if(!r&&n.workflowState){const t=JSON.parse(n.workflowState);s.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await a(t),s.reloadedState=t}else s.layouts=zi(s.transaction,s.workflow);if(s.renderableContextService=new In(s.layouts),n.previewService?(s.previewService=n.previewService,s.product?.modelUrl&&(s.modelContainer=s.previewService.loadModel({model:s.product.modelUrl,contextService:s.renderableContextService}))):(s.previewService=A&&A(o),s.product?.modelUrl&&(s.previewService?.initialize({model:s.product.modelUrl,contextService:s.renderableContextService}),s.modelContainer=s.previewService?.getAllModels()[0])),"transaction"!==n.type){const t=de.getMap("transactionOwnerIds")||new Map;t.set(i.id,i.transactionOwnerId),Qe(i.transactionOwnerId||""),de.setMap("transactionOwnerIds",t)}else{const t=(de.getMap("transactionOwnerIds")||new Map).get(i.id);t&&Qe(t),s.isReloadedTransaction=!0}this.initialized=!0,this.experienceOptions=s;const c=new Xa(this,s);return await c.getWorkflowManager().getInitializationPromise(),"transaction"!==n.type&&this.customer&&await c.attachCustomerDetails({email:this.customer.emailAddress}),c}async initFromIntegrationProduct(t){if(""===t)throw new ce("No integration product ID provided.");const e=ye.getShadowGraphqlClient(),A=await e.mutate({mutation:Pn,variables:{integrationProductId:t,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(!A.data||!A.data.transactionCreate)throw new ce("Failed to create transaction!");const n=A.data.transactionCreate;if(!n.product)throw new ce("Failed to create transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode;const a=de.getMap("transactionOwnerIds")||new Map;a.set(n.id,n.transactionOwnerId),Qe(n.transactionOwnerId||""),de.setMap("transactionOwnerIds",a),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(t,e=!1){if(""===t)throw new ce("No transaction ID provided.");const A=ye.getShadowGraphqlClient();if(e)return await(async()=>{const n=(await A.query({query:Hn,variables:{id:t},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.transactions[0];if(!n)throw new ce("Failed to read transaction.");if(!n.product)throw new ce("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 re("State mutation is forbidden in read only mode!")},readOnly:e},this.initialized=!0})();const n=de.getMap("transactionOwnerIds")||new Map,a=n.get(t);if(a){Qe(a);const n=(await A.query({query:Hn,variables:{id:t},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new ce("Failed to read transaction.");if(!n.product)throw new ce("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:e},void(this.initialized=!0)}try{const a=(await A.mutate({mutation:Rn,variables:{id:t},errorPolicy:"all"})).data?.transactionClaim;if(!a)throw new ce("Failed to read transaction.");if(!a.product)throw new ce("Failed to load transaction, product not available.");this.currencyCode=a.product.partner?.currencyCode,a.transactionOwnerId&&(n.set(a.id,a.transactionOwnerId),Qe(a.transactionOwnerId),de.setMap("transactionOwnerIds",n)),this.experienceOptions={product:a.product,transaction:a,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},this.initialized=!0}catch{throw new ce("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(t,e,A){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot launch experience: Not initialized.");const n=async t=>{for(const e in t.layouts){const A=t.layouts[e].elements.filter((t=>t.type===h.Illustration));for(let t=0;t<A.length;++t){const e=A[t];e.src&&e.svg&&(e.cachedObjectURL=await dt(e.svg))}const n=t.layouts[e].elements.filter((t=>t.type===h.Textbox));for(let t=0;t<n.length;++t){const e=n[t];e.fontData?.assetUrl&&H(e.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const t=await Oi(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=t,this.experienceOptions.transaction.workflowState){const t=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await n(t),this.experienceOptions.reloadedState=t}this.experienceOptions.previewService=A&&A(t),this.experienceOptions.renderableContextService=new In(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const e=new Xa(this,this.experienceOptions);return await e.getWorkflowManager().getInitializationPromise(),e}if(t){const a=ye.getShadowGraphqlClient().mutate({mutation:bn,variables:{workflowId:t,id:this.experienceOptions.transaction.id}}),i=Oi(t);if(await Promise.all([a,i]),this.experienceOptions.workflow=await i,e){const t=JSON.parse(e);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await n(t),this.experienceOptions.reloadedState=t}else this.experienceOptions.layouts=zi(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=A&&A(await i),this.experienceOptions.renderableContextService=new In(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const o=new Xa(this,this.experienceOptions);return await o.getWorkflowManager().getInitializationPromise(),o}throw new ce("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function Ki(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 Vi{constructor(){Ki(this,"getProduct",void 0),Ki(this,"getCommandContext",void 0),Ki(this,"getAllLayoutData",void 0),Ki(this,"getMetadata",void 0),Ki(this,"getWorkflowMetadata",void 0),Ki(this,"getStepStorage",void 0),Ki(this,"setModelContainer",void 0),Ki(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(t){}addVariationRecord(t){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(t){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(t){}addPoller(t){}addConfirmCallback(t){}addCurrentVariationCallback(t){}addEditedCallback(t){}addElementsCallback(t){}addInformationResultCallback(t){}addInitCallback(t){}addMakingAdjustmentsCallback(t){}addMandatoryCallback(t){}addMetadataCallback(t){}addSelectionCallback(t){}addStepSpecificStorageCallback(t,e){}addStorageCallback(t){}addVariationRecordsCallback(t){}getCommandDispatcher(){return t=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(t){return[]}getSerializedStep(t,e){}getStepSpecificServices(t){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(t){}markUpdateCompleted(t){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(t){}setCurrentVariationRecord(t){}setEditedStatus(t,e){}setInformationResults(t){}setMandatoryFulfilled(t,e){}async setSelectionsAndElements(t,e,A){}setVariationRecords(t){}toggleDesignConfirmed(){}updateMetadata(t,e){}async updateStorage(t,e){}injectIntoPreviewService(t){return Promise.resolve()}ejectFromPreviewService(){}}function Wi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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}let Xi;var qi;(qi=Xi||(Xi={})).SelectFrame="SelectFrame",qi.SelectImage="SelectImage",qi.Position="Position";class Zi extends Ma{constructor(t,e){super(t,e),Wi(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(t){const e=this.manager.getRegionElements(this.step.stepName);return ia.selectVariant(this.step,t.getResource(),e,this.manager,(t=>this.setUpdateState(t)))}onFrameDataChanged(t){this.frameService&&this.frameService.onFrameDataChanged((e=>{e&&t(e)}))}selectImage(t){return ia.selectImage(this.step,t,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(t,e,A,n){return n&&n.length>1&&void 0===t?Xi.SelectFrame:e||A||this.getImageData()?Xi.Position:Xi.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 $i=t=>{const e=Gt(null),A=Gt(void 0),[n,a]=Pt(void 0),{addEvent:i,removeEvent:o,updateEvent:r,eventCache:s}=Le(),[c,g]=Pt(!1),[l,B]=Pt(!1),{state:w,uiDispatcher:d}=Ze(),h=Rt((t=>{const e=t;d(new qe({zoom:Math.max(.1,Math.min(e,w.maxZoom))}))}),[d,w.maxZoom]),E=Rt((t=>{o(t),1===s.length&&(A.current=void 0),2===s.length&&a(void 0);"touch"===t.pointerType&&s.length>1&&s.length-1==1&&(B(!1),g(!1))}),[o,s.length]),u=Rt((t=>{i(t);"touch"===t.pointerType&&1===s.length&&(d(new qe({selectedElement:void 0})),B(!0),g(!0))}),[i,s.length,d]),C=Rt((t=>{r(t);const e=1===s.length&&"touch"!==s[0].pointerType,i=2===s.length&&"touch"===s[0].pointerType;if(c&&i){const[t,e]=s,A=Math.abs(t.clientX-e.clientX),i=n;i&&h(w.zoom-.0055*(i-A)),a(A)}if(l&&(e||i)&&t.isPrimary){const e=(A?.current?.x||t.screenX)-t.screenX,n=(A?.current?.y||t.screenY)-t.screenY;d(new qe({selectedElement:void 0,xTranslation:w.xTranslation-e/w.zoom,yTranslation:w.yTranslation-n/w.zoom}))}t.isPrimary&&(A.current={x:t.screenX,y:t.screenY})}),[r,s,c,l,n,h,w.zoom,w.xTranslation,w.yTranslation,d]),Q=Rt((t=>{c&&h(w.zoom-.035*Math.sign(t.deltaY))}),[h,w.zoom,c]);Ut((()=>{if(!e.current||0===s.length)return;const t=s[0].pointerId,A=e.current.hasPointerCapture(t);l&&!A&&e.current.setPointerCapture(t),!l&&A&&e.current.releasePointerCapture(t)}),[e,l,s]),JA([" "],(()=>{B(!0),d(new qe({selectedElement:void 0}))}),(()=>B(!1))),JA(["Control"],(()=>g(!0)),(()=>g(!1)));const p=kt((()=>({cursor:l&&0===s.length?"grab":l&&1===s.length?"grabbing":c?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[l,c,s]);return Jt("div",{ref:e,className:"transform-wrapper",onWheel:Q,onPointerDown:u,onPointerUp:E,onPointerCancel:E,onPointerLeave:E,onPointerMove:C,style:p,children:t.children})};export{ji as SpiffCommerceClient,t as CommandContext,Ee as spiffCoreConfiguration,zA as PromiseQueue,OA as QueueablePromise,Vi as MockWorkflowManager,Qa as InformationMessageType,Ma as StepHandle,ba as TextStepHandle,Zi as FrameStepHandle,va as BulkStepHandle,Ua as ShapeStepHandle,xa as IllustrationStepHandle,Na as MaterialStepHandle,Pa as ModelStepHandle,Ra as PictureStepHandle,Ha as QuestionStepHandle,tA as BulkPriceCalculationStrategy,Ia as Variant,Xa as WorkflowExperienceImpl,ee as OptionNotFoundError,Ae as LayoutNotFoundError,ne as AssetNotFoundError,ae as ResourceNotFoundError,ie as MisconfigurationError,se as ParseError,re as UnhandledBehaviorError,He as assetService,Va as designService,za as createDesign,Ge as optionService,de as persistenceService,ye as graphQlManager,gA as toast,Zn as FrameService,Xn as getBoundedOffsets,ia as frameStepService,sa as modelStepService,ra as materialStepService,Ba as shapeStepService,la as questionStepService,na as digitalContentStepService,ca as moduleStepService,ga as pictureStepService,ua as textStepService,oa as illustrationStepService,$e as ProductCameraRig,Xi as FrameStep,AA as ConversionLocation,aA as ConversionDataType,Oi as getWorkflow,ta as shortenUrl,Yi as ObjectInput,Si as TextInput,Mi as ObjectInputType,e as AssetType,A as BringForwardCommand,n as BringToFrontCommand,a as BringToBackCommand,i as CanvasCommand,o as CreateElementCommand,r as CreateLayoutCommand,s as DeleteElementCommand,c as FontAlignmentCommand,g as FontColorCommand,l as FontSizeCommand,B as FontSourceCommand,w as GroupCommand,d as LayoutElementFactory,h as LayoutElementType,E as MoveCommand,u as ResizeCommand,C as RotateCommand,Q as SendBackwardsCommand,oA as StakeholderType,p as StepAspectType,m as StepType,D as TextChangeCommand,f as UnitOfMeasurement,I as dataUrlFromExternalUrl,y as findElement,M as frameDataCache,F as generate,Y as getAxisAlignedBoundingBox,S as generateSVGWithUnknownColors,v as getAttributesFromArrayBuffer,x as rehydrateSerializedLayout,N as getFrameData,P as getSvgElement,R as loadFontFromDataUrl,H as loadFontFromExternalUrl,U as determineCorrectFontSizeAndLines,b as patternImageDataCache,Dn as generateCommands,k as registerJSDOM,bA as minZoom,Nn as AdvancedEditor,$i as TransformWrapper,xn as EditorCore,Te as useLayouts,Ze as useEditorState,GA as useEditorInteraction,JA as useShortcutCombination,Ve as commandReducer,Ke as getDefaultState,Je as CommandContextContext,Xe as AdvancedEditorStateProvider,We as AdvancedEditorContext,qe as UICommand,ze as EditorSubMenu,lA as ElementEventType,wA as KeyEvent,Ln as gatherVaryingStepAspects};
1361
+ `,Oi=async t=>(await ye.getShadowGraphqlClient().query({query:Hi,errorPolicy:"all",fetchPolicy:"cache-first",variables:{id:t}})).data.workflow,zi=(t,e)=>{const A=t.workflowState,n=A?JSON.parse(A):void 0;return n?Object.values(n.layouts).map((t=>t.layout)):e.panels.sort(((t,e)=>t.index-e.index)).map((t=>({id:F(),panelId:t.name,name:t.name,index:t.index,createdAt:new Date,updatedAt:new Date,transparentBackground:t.transparentBackground,height:t.height,width:t.width,previewRegion:t.previewRegion,useEditableArea:t.useEditableArea,editableArea:t.editableArea})))};class ji{constructor(t){var e;vi(this,"options",void 0),vi(this,"initialized",void 0),vi(this,"currencyCode",void 0),vi(this,"customer",void 0),vi(this,"experienceOptions",void 0),vi(this,"updateTransactionState",(async t=>{try{return ye.getShadowGraphqlClient().mutate({...t,mutation:Un})}catch(t){throw console.error(t),new ce("Critical - Unable to synchronize workflow state with server.")}})),this.initialized=!1,this.options=t,this.options.applicationKey&&(e=this.options.applicationKey,Ie=e)}getAssetManager(){return He}getCurrencyCode(){if(void 0===this.currencyCode)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!this.options.applicationKey)throw new Error("Application key required to use Flow Service.");return new Ii}async authenticateBundleFromLocalStorage(t){const e=de.getMap("bundleOwnerIds");if(e?.has(t)){const A=e.get(t);return me(A),Promise.resolve({success:!0,stakeholderType:oA.Owner})}const A=de.getMap("bundleCustomerIds");if(A?.has(t)){const e=A.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(t){const e=ye.getShadowGraphqlClient(),A=await e.query({query:Ui,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:t}});if(!A.data.transactions||0===A.data.transactions.length)throw new Error(`Transaction not found: ${t}`);const n=A.data.transactions[0],a=n.product?.partner?.id;if(!a)throw new Error(`Unable to read transaction: ${t}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const i=de.getMap("transactionOwnerIds");if(i?.has(t)){const e=i.get(t);return Qe(e),Promise.resolve({success:!0,stakeholderType:oA.Owner})}const o=de.getMap("transactionCustomerIds");if(o?.has(t)){const e=o.get(t);if(e){if(await this.authenticateCustomerId(e)){const e=this.customer?.bundleStakeholders?.find((e=>e.bundle?.transactions?.some((e=>e.id===t))))||this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return Promise.resolve({success:!0,stakeholderType:e.type})}}}const r=(await e.query({query:bi,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(t){const e=de.getMap("transactionCustomerIds");e?.has(t)&&(e.delete(t),de.setMap("transactionCustomerIds",e))}getStakeholderTypeForTransaction(t){const e=this.customer?.stakeholders?.find((e=>e.transaction?.id===t));if(e)return e.type}async getOrCreateCustomer(t){this.customer=void 0;const e=ye.getShadowGraphqlClient(),A=(await e.query({query:ki,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t}})).data.customer;if(!A.id){const A=(await e.mutate({mutation:Gi,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:t}}})).data?.customerCreate;if(!A)throw new Error("Unable to create customer.");return this.customer=A,{customer:A,isAuthenticated:!1}}const n=await this.authenticateCustomerId(A.id);return{customer:this.customer||A,isAuthenticated:n}}async authenticateCustomerId(t){const e=ye.getShadowGraphqlClient(),A=de.getMap("customerTokens");if(!A?.has(t))return!1;const n=A.get(t);if(!n)return!1;const a=(await e.mutate({mutation:Ji,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data?.customerAuthenticate;return!!a&&(fe(n),this.customer=a,!0)}async generateVerificationCode(t){await ye.getShadowGraphqlClient().mutate({mutation:Li,variables:{emailAddress:t}})}async verifyCode(t,e){const A=(await ye.getShadowGraphqlClient().mutate({mutation:Ti,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:t,verificationCode:e}})).data?.customerVerifyCode;if(A?.loginToken){if(!A.partner?.id)throw new Error(`Unable to find customer: ${t}`);const e=de.getMap("customerTokens")||new Map;return e.set(A.id,A.loginToken),de.setMap("customerTokens",e),fe(A.loginToken),this.customer={...A,loginToken:void 0},!0}return!1}async getNewBundle(t){const e=(await ye.getShadowGraphqlClient().mutate({mutation:ti,variables:{collectionId:t},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!e)throw new Error("Unable to create bundle");me(e.bundleOwnerId);const A=de.getMap("bundleOwnerIds")||new Map;return A.set(e.id,e.bundleOwnerId),de.setMap("bundleOwnerIds",A),new mi(this,e)}async getExistingBundle(t,e){const A=de.getMap("bundleOwnerIds")?.get(t);A&&me(A);const n=await ye.getShadowGraphqlClient().query({query:Za,variables:{id:t},fetchPolicy:"no-cache"});if(!n.data?.bundles||0===n.data?.bundles.length||!n.data?.bundles[0])throw new Error(`Unable to find bundle: ${t}`);const a=n.data?.bundles[0],i=new mi(this,a,e);return await i.getInitializationPromise(),i}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const t=await ye.getShadowGraphqlClient().query({query:_a,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!t.data?.customers||0===t.data.customers.length)throw new Error("Unable to find customer.");return t.data.customers[0].bundleStakeholders||[]}async getWorkflowExperience(t,e,A,n){if(!n)return await this.getWorkflowExperienceDeprecated(t,e,A);const a=async t=>{for(const e in t.layouts){const A=t.layouts[e].elements.filter((t=>t.type===h.Illustration));for(let t=0;t<A.length;++t){const e=A[t];e.src&&e.svg&&(e.cachedObjectURL=await dt(e.svg))}const n=t.layouts[e].elements.filter((t=>t.type===h.Textbox));for(let t=0;t<n.length;++t){const e=n[t];e.fontData?.assetUrl&&H(e.fontData.assetUrl)}}},{transaction:i,workflow:o,readOnly:r}=await(async()=>{const t=ye.getShadowGraphqlClient();if("transaction"===n.type){const{transactionId:e,readOnly:A}=n,a=await t.query({query:Hn,variables:{id:e},errorPolicy:"all"});if(!a.data?.transactions||0===a.data.transactions.length)throw new ce("Existing transaction not found.");const i=a.data?.transactions[0];if(!i.workflowId)throw new ce("Existing transaction has no workflow ID.");const o=await Oi(i.workflowId);if(!i.product)throw new ce("Failed to load transaction, product not available.");return{transaction:i,workflow:o,readOnly:A}}if("integration"===n.type||"external"===n.type){const e=async()=>{const e="integration"===n.type?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},A=await t.mutate({mutation:Pn,variables:{...e,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(!A.data||!A.data.transactionCreate)throw new ce("Failed to create transaction!");const a=A.data.transactionCreate;if(!a.product)throw new ce("Failed to create transaction, product not available.");return a},A=Oi(n.workflowId),[a,i]=await Promise.all([e(),A]);return{transaction:a,workflow:i}}throw new ce("No workflow ID provided.")})();this.currencyCode=i.product.partner?.currencyCode;const s={product:i.product,transaction:i,layouts:[],stateMutationFunc:r?async()=>{throw new re("State mutation is forbidden in read only mode!")}:this.updateTransactionState,readOnly:r,workflow:o};if("transaction"===n.type&&i.workflowState){const t=JSON.parse(i.workflowState);s.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await a(t),s.reloadedState=t}else if(!r&&n.workflowState){const t=JSON.parse(n.workflowState);s.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await a(t),s.reloadedState=t}else s.layouts=zi(s.transaction,s.workflow);if(s.renderableContextService=new In(s.layouts),n.previewService?(s.previewService=n.previewService,s.product?.modelUrl&&(s.modelContainer=s.previewService.loadModel({model:s.product.modelUrl,contextService:s.renderableContextService}))):(s.previewService=A&&A(o),s.product?.modelUrl&&(s.previewService?.initialize({model:s.product.modelUrl,contextService:s.renderableContextService}),s.modelContainer=s.previewService?.getAllModels()[0])),"transaction"!==n.type){const t=de.getMap("transactionOwnerIds")||new Map;t.set(i.id,i.transactionOwnerId),Qe(i.transactionOwnerId||""),de.setMap("transactionOwnerIds",t)}else{const t=(de.getMap("transactionOwnerIds")||new Map).get(i.id);t&&Qe(t),s.isReloadedTransaction=!0}this.initialized=!0,this.experienceOptions=s;const c=new Xa(this,s);return await c.getWorkflowManager().getInitializationPromise(),"transaction"!==n.type&&this.customer&&await c.attachCustomerDetails({email:this.customer.emailAddress}),c}async initFromIntegrationProduct(t){if(""===t)throw new ce("No integration product ID provided.");const e=ye.getShadowGraphqlClient(),A=await e.mutate({mutation:Pn,variables:{integrationProductId:t,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(!A.data||!A.data.transactionCreate)throw new ce("Failed to create transaction!");const n=A.data.transactionCreate;if(!n.product)throw new ce("Failed to create transaction, product not available.");this.currencyCode=n.product.partner?.currencyCode;const a=de.getMap("transactionOwnerIds")||new Map;a.set(n.id,n.transactionOwnerId),Qe(n.transactionOwnerId||""),de.setMap("transactionOwnerIds",a),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:this.updateTransactionState},this.initialized=!0}async initFromTransaction(t,e=!1){if(""===t)throw new ce("No transaction ID provided.");const A=ye.getShadowGraphqlClient();if(e)return await(async()=>{const n=(await A.query({query:Hn,variables:{id:t},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.transactions[0];if(!n)throw new ce("Failed to read transaction.");if(!n.product)throw new ce("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 re("State mutation is forbidden in read only mode!")},readOnly:e},this.initialized=!0})();const n=de.getMap("transactionOwnerIds")||new Map,a=n.get(t);if(a){Qe(a);const n=(await A.query({query:Hn,variables:{id:t},errorPolicy:"all"})).data?.transactions[0];if(!n)throw new ce("Failed to read transaction.");if(!n.product)throw new ce("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:e},void(this.initialized=!0)}try{const a=(await A.mutate({mutation:Rn,variables:{id:t},errorPolicy:"all"})).data?.transactionClaim;if(!a)throw new ce("Failed to read transaction.");if(!a.product)throw new ce("Failed to load transaction, product not available.");this.currencyCode=a.product.partner?.currencyCode,a.transactionOwnerId&&(n.set(a.id,a.transactionOwnerId),Qe(a.transactionOwnerId),de.setMap("transactionOwnerIds",n)),this.experienceOptions={product:a.product,transaction:a,layouts:[],stateMutationFunc:this.updateTransactionState,readOnly:e},this.initialized=!0}catch{throw new ce("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(t,e,A){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot launch experience: Not initialized.");const n=async t=>{for(const e in t.layouts){const A=t.layouts[e].elements.filter((t=>t.type===h.Illustration));for(let t=0;t<A.length;++t){const e=A[t];e.src&&e.svg&&(e.cachedObjectURL=await dt(e.svg))}const n=t.layouts[e].elements.filter((t=>t.type===h.Textbox));for(let t=0;t<n.length;++t){const e=n[t];e.fontData?.assetUrl&&H(e.fontData.assetUrl)}}};if(this.experienceOptions.transaction.workflowId){const t=await Oi(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=t,this.experienceOptions.transaction.workflowState){const t=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await n(t),this.experienceOptions.reloadedState=t}this.experienceOptions.previewService=A&&A(t),this.experienceOptions.renderableContextService=new In(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const e=new Xa(this,this.experienceOptions);return await e.getWorkflowManager().getInitializationPromise(),e}if(t){const a=ye.getShadowGraphqlClient().mutate({mutation:bn,variables:{workflowId:t,id:this.experienceOptions.transaction.id}}),i=Oi(t);if(await Promise.all([a,i]),this.experienceOptions.workflow=await i,e){const t=JSON.parse(e);this.experienceOptions.layouts=Object.values(t.layouts).map((t=>t.layout)),await x(t),await n(t),this.experienceOptions.reloadedState=t}else this.experienceOptions.layouts=zi(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=A&&A(await i),this.experienceOptions.renderableContextService=new In(this.experienceOptions.layouts),this.experienceOptions.product?.modelUrl&&(this.experienceOptions.previewService?.initialize({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}),this.experienceOptions.modelContainer=this.experienceOptions.previewService?.getAllModels()[0]);const o=new Xa(this,this.experienceOptions);return await o.getWorkflowManager().getInitializationPromise(),o}throw new ce("No workflow ID provided.")}getPreviewService(){return this.experienceOptions?.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new ce("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}}function Ki(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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 Vi{constructor(){Ki(this,"getProduct",void 0),Ki(this,"getCommandContext",void 0),Ki(this,"getAllLayoutData",void 0),Ki(this,"getMetadata",void 0),Ki(this,"getWorkflowMetadata",void 0),Ki(this,"getStepStorage",void 0),Ki(this,"setModelContainer",void 0),Ki(this,"getUpdatesPending",void 0)}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}getVariationRecords(){return[]}async reset(){}updateStateWithServer(t){}addVariationRecord(t){return{recordNumber:0,transactionId:"",values:[]}}getCurrentVariationRecord(){}removeVariationRecord(t){return[]}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(t){}addPoller(t){}addConfirmCallback(t){}addCurrentVariationCallback(t){}addEditedCallback(t){}addElementsCallback(t){}addInformationResultCallback(t){}addInitCallback(t){}addMakingAdjustmentsCallback(t){}addMandatoryCallback(t){}addMetadataCallback(t){}addSelectionCallback(t){}addStepSpecificStorageCallback(t,e){}addStorageCallback(t){}addVariationRecordsCallback(t){}getCommandDispatcher(){return t=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(t){return[]}getSerializedStep(t,e){}getStepSpecificServices(t){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(t){}markUpdateCompleted(t){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(t){}setCurrentVariationRecord(t){}setEditedStatus(t,e){}setInformationResults(t){}setMandatoryFulfilled(t,e){}async setSelectionsAndElements(t,e,A){}setVariationRecords(t){}toggleDesignConfirmed(){}updateMetadata(t,e){}async updateStorage(t,e){}injectIntoPreviewService(t){return Promise.resolve()}ejectFromPreviewService(){}}function Wi(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 n=A.call(t,e||"default");if("object"!=typeof n)return n;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}let Xi;var qi;(qi=Xi||(Xi={})).SelectFrame="SelectFrame",qi.SelectImage="SelectImage",qi.Position="Position";class Zi extends Ma{constructor(t,e){super(t,e),Wi(this,"frameService",this.manager.getStepSpecificServices(this.getId())?.frameService)}selectVariant(t){const e=this.manager.getRegionElements(this.step.stepName);return ia.selectVariant(this.step,t.getResource(),e,this.manager,(t=>this.setUpdateState(t)))}onFrameDataChanged(t){this.frameService&&this.frameService.onFrameDataChanged((e=>{e&&t(e)}))}selectImage(t){return ia.selectImage(this.step,t,this.manager)}getImageData(){if(this.frameService)return this.frameService.getImageData()}getCurrentFrameStep(t,e,A,n){return n&&n.length>1&&void 0===t?Xi.SelectFrame:e||A||this.getImageData()?Xi.Position:Xi.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 $i=t=>{const e=Gt(null),A=Gt(void 0),[n,a]=Pt(void 0),{addEvent:i,removeEvent:o,updateEvent:r,eventCache:s}=Le(),[c,g]=Pt(!1),[l,B]=Pt(!1),{state:w,uiDispatcher:d}=Ze(),h=Rt((t=>{const e=t;d(new qe({zoom:Math.max(.1,Math.min(e,w.maxZoom))}))}),[d,w.maxZoom]),E=Rt((t=>{o(t),1===s.length&&(A.current=void 0),2===s.length&&a(void 0);"touch"===t.pointerType&&s.length>1&&s.length-1==1&&(B(!1),g(!1))}),[o,s.length]),u=Rt((t=>{i(t);"touch"===t.pointerType&&1===s.length&&(d(new qe({selectedElement:void 0})),B(!0),g(!0))}),[i,s.length,d]),C=Rt((t=>{r(t);const e=1===s.length&&"touch"!==s[0].pointerType,i=2===s.length&&"touch"===s[0].pointerType;if(c&&i){const[t,e]=s,A=Math.abs(t.clientX-e.clientX),i=n;i&&h(w.zoom-.0055*(i-A)),a(A)}if(l&&(e||i)&&t.isPrimary){const e=(A?.current?.x||t.screenX)-t.screenX,n=(A?.current?.y||t.screenY)-t.screenY;d(new qe({selectedElement:void 0,xTranslation:w.xTranslation-e/w.zoom,yTranslation:w.yTranslation-n/w.zoom}))}t.isPrimary&&(A.current={x:t.screenX,y:t.screenY})}),[r,s,c,l,n,h,w.zoom,w.xTranslation,w.yTranslation,d]),Q=Rt((t=>{c&&h(w.zoom-.035*Math.sign(t.deltaY))}),[h,w.zoom,c]);Ut((()=>{if(!e.current||0===s.length)return;const t=s[0].pointerId,A=e.current.hasPointerCapture(t);l&&!A&&e.current.setPointerCapture(t),!l&&A&&e.current.releasePointerCapture(t)}),[e,l,s]),JA([" "],(()=>{B(!0),d(new qe({selectedElement:void 0}))}),(()=>B(!1))),JA(["Control"],(()=>g(!0)),(()=>g(!1)));const p=kt((()=>({cursor:l&&0===s.length?"grab":l&&1===s.length?"grabbing":c?"zoom-in":void 0,width:"100%",height:"100%",overflow:"clip"})),[l,c,s]);return Jt("div",{ref:e,className:"transform-wrapper",onWheel:Q,onPointerDown:u,onPointerUp:E,onPointerCancel:E,onPointerLeave:E,onPointerMove:C,style:p,children:t.children})};export{ji as SpiffCommerceClient,t as CommandContext,Ee as spiffCoreConfiguration,zA as PromiseQueue,OA as QueueablePromise,Vi as MockWorkflowManager,Qa as InformationMessageType,Ma as StepHandle,ba as TextStepHandle,Zi as FrameStepHandle,va as BulkStepHandle,Ua as ShapeStepHandle,xa as IllustrationStepHandle,Na as MaterialStepHandle,Pa as ModelStepHandle,Ra as PictureStepHandle,Ha as QuestionStepHandle,tA as BulkPriceCalculationStrategy,Ia as Variant,Xa as WorkflowExperienceImpl,ee as OptionNotFoundError,Ae as LayoutNotFoundError,ne as AssetNotFoundError,ae as ResourceNotFoundError,ie as MisconfigurationError,se as ParseError,re as UnhandledBehaviorError,He as assetService,Va as designService,za as createDesign,Ge as optionService,de as persistenceService,ye as graphQlManager,gA as toast,Zn as FrameService,Xn as getBoundedOffsets,ia as frameStepService,sa as modelStepService,ra as materialStepService,Ba as shapeStepService,la as questionStepService,na as digitalContentStepService,ca as moduleStepService,ga as pictureStepService,ua as textStepService,oa as illustrationStepService,$e as ProductCameraRig,Xi as FrameStep,AA as ConversionLocation,aA as ConversionDataType,Oi as getWorkflow,ta as shortenUrl,Yi as ObjectInput,Si as TextInput,Mi as ObjectInputType,e as AssetType,A as BringForwardCommand,n as BringToFrontCommand,a as BringToBackCommand,i as CanvasCommand,o as CreateElementCommand,r as CreateLayoutCommand,s as DeleteElementCommand,c as FontAlignmentCommand,g as FontColorCommand,l as FontSizeCommand,B as FontSourceCommand,w as GroupCommand,d as LayoutElementFactory,h as LayoutElementType,E as MoveCommand,u as ResizeCommand,C as RotateCommand,Q as SendBackwardsCommand,oA as StakeholderType,p as StepAspectType,m as StepType,D as TextChangeCommand,f as UnitOfMeasurement,I as dataUrlFromExternalUrl,y as findElement,M as frameDataCache,F as generate,Y as getAxisAlignedBoundingBox,S as generateSVGWithUnknownColors,v as getAttributesFromArrayBuffer,x as rehydrateSerializedLayout,N as getFrameData,P as getSvgElement,R as loadFontFromDataUrl,H as loadFontFromExternalUrl,U as determineCorrectFontSizeAndLines,b as patternImageDataCache,Dn as generateCommands,k as registerJSDOM,bA as minZoom,Nn as AdvancedEditor,$i as TransformWrapper,xn as EditorCore,Te as useLayouts,Ze as useEditorState,GA as useEditorInteraction,JA as useShortcutCombination,Ve as commandReducer,Ke as getDefaultState,Je as CommandContextContext,Xe as AdvancedEditorStateProvider,We as AdvancedEditorContext,qe as UICommand,ze as EditorSubMenu,lA as ElementEventType,wA as KeyEvent,Ln as gatherVaryingStepAspects};
1362
1362
  //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "14.7.3-alpha.0",
3
+ "version": "14.7.4-beta.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",